Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
05057f97
Commit
05057f97
authored
Jun 17, 2016
by
Sergio Guadarrama
Committed by
GitHub
Jun 17, 2016
Browse files
Merge pull request #217 from tensorflow/sguada-patch-2
Update slim README.md
parents
d523161e
336d06f2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
inception/inception/slim/README.md
inception/inception/slim/README.md
+6
-6
No files found.
inception/inception/slim/README.md
View file @
05057f97
...
@@ -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
.
ClassificationL
oss
(
predictions
,
labels
)
loss
=
losses
.
cross_entropy_l
oss
(
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
.
ClassificationL
oss
(
scene_predictions
,
scene_labels
)
classification_loss
=
slim
.
losses
.
cross_entropy_l
oss
(
scene_predictions
,
scene_labels
)
sum_of_squares_loss
=
slim
.
losses
.
SumOfSquaresL
oss
(
depth_predictions
,
depth_labels
)
sum_of_squares_loss
=
slim
.
losses
.
l2l
oss
(
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.
ClassificationL
oss`
and
`losses.
SumOfSquaresL
oss`
. We can obtain the
`losses.
cross_entropy_l
oss`
and
`losses.
l2l
oss`
. 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
.
ClassificationL
oss
(
scene_predictions
,
scene_labels
)
classification_loss
=
slim
.
losses
.
cross_entropy_l
oss
(
scene_predictions
,
scene_labels
)
sum_of_squares_loss
=
slim
.
losses
.
SumOfSquaresL
oss
(
depth_predictions
,
depth_labels
)
sum_of_squares_loss
=
slim
.
losses
.
l2l
oss
(
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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment