Commit 336d06f2 authored by Sergio Guadarrama's avatar Sergio Guadarrama Committed by GitHub
Browse files

Update README.md

Fixed references to slim.losses
parent d523161e
...@@ -383,7 +383,7 @@ images, labels = ... ...@@ -383,7 +383,7 @@ images, labels = ...
predictions = ... predictions = ...
# Define the loss functions and get the total loss. # Define the loss functions and get the total loss.
loss = losses.ClassificationLoss(predictions, labels) loss = losses.cross_entropy_loss(predictions, labels)
``` ```
In this example, we start by creating the model (using TF-Slim's VGG In this example, we start by creating the model (using TF-Slim's VGG
...@@ -398,8 +398,8 @@ images, scene_labels, depth_labels = ... ...@@ -398,8 +398,8 @@ images, scene_labels, depth_labels = ...
scene_predictions, depth_predictions = CreateMultiTaskModel(images) scene_predictions, depth_predictions = CreateMultiTaskModel(images)
# Define the loss functions and get the total loss. # Define the loss functions and get the total loss.
classification_loss = slim.losses.ClassificationLoss(scene_predictions, scene_labels) classification_loss = slim.losses.cross_entropy_loss(scene_predictions, scene_labels)
sum_of_squares_loss = slim.losses.SumOfSquaresLoss(depth_predictions, depth_labels) sum_of_squares_loss = slim.losses.l2loss(depth_predictions - depth_labels)
# The following two lines have the same effect: # The following two lines have the same effect:
total_loss1 = classification_loss + sum_of_squares_loss total_loss1 = classification_loss + sum_of_squares_loss
...@@ -407,7 +407,7 @@ total_loss2 = tf.get_collection(slim.losses.LOSSES_COLLECTION) ...@@ -407,7 +407,7 @@ total_loss2 = tf.get_collection(slim.losses.LOSSES_COLLECTION)
``` ```
In this example, we have two losses which we add by calling In this example, we have two losses which we add by calling
`losses.ClassificationLoss` and `losses.SumOfSquaresLoss`. We can obtain the `losses.cross_entropy_loss` and `losses.l2loss`. We can obtain the
total loss by adding them together (`total_loss1`) or by calling total loss by adding them together (`total_loss1`) or by calling
`losses.GetTotalLoss()`. How did this work? When you create a loss function via `losses.GetTotalLoss()`. How did this work? When you create a loss function via
TF-Slim, TF-Slim adds the loss to a special TensorFlow collection of loss TF-Slim, TF-Slim adds the loss to a special TensorFlow collection of loss
...@@ -426,8 +426,8 @@ images, scene_labels, depth_labels, pose_labels = ... ...@@ -426,8 +426,8 @@ images, scene_labels, depth_labels, pose_labels = ...
scene_predictions, depth_predictions, pose_predictions = CreateMultiTaskModel(images) scene_predictions, depth_predictions, pose_predictions = CreateMultiTaskModel(images)
# Define the loss functions and get the total loss. # Define the loss functions and get the total loss.
classification_loss = slim.losses.ClassificationLoss(scene_predictions, scene_labels) classification_loss = slim.losses.cross_entropy_loss(scene_predictions, scene_labels)
sum_of_squares_loss = slim.losses.SumOfSquaresLoss(depth_predictions, depth_labels) sum_of_squares_loss = slim.losses.l2loss(depth_predictions - depth_labels)
pose_loss = MyCustomLossFunction(pose_predictions, pose_labels) pose_loss = MyCustomLossFunction(pose_predictions, pose_labels)
tf.add_to_collection(slim.losses.LOSSES_COLLECTION, pose_loss) # Letting TF-Slim know about the additional loss. tf.add_to_collection(slim.losses.LOSSES_COLLECTION, pose_loss) # Letting TF-Slim know about the additional loss.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment