Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 336d06f

Browse files
authored
Update README.md
Fixed references to slim.losses
1 parent d523161 commit 336d06f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

inception/inception/slim/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ images, labels = ...
383383
predictions = ...
384384

385385
# Define the loss functions and get the total loss.
386-
loss = losses.ClassificationLoss(predictions, labels)
386+
loss = losses.cross_entropy_loss(predictions, labels)
387387
```
388388

389389
In this example, we start by creating the model (using TF-Slim's VGG
@@ -398,16 +398,16 @@ images, scene_labels, depth_labels = ...
398398
scene_predictions, depth_predictions = CreateMultiTaskModel(images)
399399

400400
# Define the loss functions and get the total loss.
401-
classification_loss = slim.losses.ClassificationLoss(scene_predictions, scene_labels)
402-
sum_of_squares_loss = slim.losses.SumOfSquaresLoss(depth_predictions, depth_labels)
401+
classification_loss = slim.losses.cross_entropy_loss(scene_predictions, scene_labels)
402+
sum_of_squares_loss = slim.losses.l2loss(depth_predictions - depth_labels)
403403

404404
# The following two lines have the same effect:
405405
total_loss1 = classification_loss + sum_of_squares_loss
406406
total_loss2 = tf.get_collection(slim.losses.LOSSES_COLLECTION)
407407
```
408408

409409
In this example, we have two losses which we add by calling
410-
`losses.ClassificationLoss` and `losses.SumOfSquaresLoss`. We can obtain the
410+
`losses.cross_entropy_loss` and `losses.l2loss`. We can obtain the
411411
total loss by adding them together (`total_loss1`) or by calling
412412
`losses.GetTotalLoss()`. How did this work? When you create a loss function via
413413
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 = ...
426426
scene_predictions, depth_predictions, pose_predictions = CreateMultiTaskModel(images)
427427

428428
# Define the loss functions and get the total loss.
429-
classification_loss = slim.losses.ClassificationLoss(scene_predictions, scene_labels)
430-
sum_of_squares_loss = slim.losses.SumOfSquaresLoss(depth_predictions, depth_labels)
429+
classification_loss = slim.losses.cross_entropy_loss(scene_predictions, scene_labels)
430+
sum_of_squares_loss = slim.losses.l2loss(depth_predictions - depth_labels)
431431
pose_loss = MyCustomLossFunction(pose_predictions, pose_labels)
432432
tf.add_to_collection(slim.losses.LOSSES_COLLECTION, pose_loss) # Letting TF-Slim know about the additional loss.
433433

0 commit comments

Comments
 (0)