Selaa lähdekoodia

Perform the squeeze in a more appropriate location

Neal Wu 8 vuotta sitten
vanhempi
commit
9dd2c618e8
2 muutettua tiedostoa jossa 3 lisäystä ja 3 poistoa
  1. 2 2
      slim/nets/resnet_v2.py
  2. 1 1
      slim/train_image_classifier.py

+ 2 - 2
slim/nets/resnet_v2.py

@@ -206,12 +206,12 @@ def resnet_v2(inputs,
         if num_classes is not None:
           net = slim.conv2d(net, num_classes, [1, 1], activation_fn=None,
                             normalizer_fn=None, scope='logits')
+        logits = tf.squeeze(net, [1, 2], name='SpatialSqueeze')
         # Convert end_points_collection into a dictionary of end_points.
         end_points = slim.utils.convert_collection_to_dict(end_points_collection)
         if num_classes is not None:
           end_points['predictions'] = slim.softmax(net, scope='predictions')
-        return net, end_points
-resnet_v2.default_image_size = 224
+        return logits, end_points
 
 
 def resnet_v2_50(inputs,

+ 1 - 1
slim/train_image_classifier.py

@@ -473,7 +473,7 @@ def main(_):
             end_points['AuxLogits'], labels,
             label_smoothing=FLAGS.label_smoothing, weights=0.4, scope='aux_loss')
       tf.losses.softmax_cross_entropy(
-          tf.squeeze(logits), labels, label_smoothing=FLAGS.label_smoothing, weights=1.0)
+          logits, labels, label_smoothing=FLAGS.label_smoothing, weights=1.0)
       return end_points
 
     # Gather initial summaries.