Update detector.py to use the new Net/blobs interface
authorJonathan L Long <jonlong@cs.berkeley.edu>
Tue, 11 Mar 2014 03:38:39 +0000 (20:38 -0700)
committerJonathan L Long <jonlong@cs.berkeley.edu>
Thu, 13 Mar 2014 18:15:57 +0000 (11:15 -0700)
python/caffe/detection/detector.py

index 1dcb797..021a8de 100644 (file)
@@ -332,7 +332,7 @@ def config(model_def, pretrained_model, gpu, image_dim, image_mean_file):
   # Initialize network by loading model definition and weights.
   t = time.time()
   print("Loading Caffe model.")
-  NET = caffe.CaffeNet(model_def, pretrained_model)
+  NET = caffe.Net(model_def, pretrained_model)
   NET.set_phase_test()
   if gpu:
     NET.set_mode_gpu()
@@ -340,7 +340,7 @@ def config(model_def, pretrained_model, gpu, image_dim, image_mean_file):
 
   # Configure for input/output data
   IMAGE_DIM = image_dim
-  CROPPED_DIM = NET.blobs()[0].width
+  CROPPED_DIM = NET.blobs.values()[0].width
   IMAGE_CENTER = int((IMAGE_DIM - CROPPED_DIM) / 2)
 
     # Load the data set mean file
@@ -349,8 +349,8 @@ def config(model_def, pretrained_model, gpu, image_dim, image_mean_file):
   CROPPED_IMAGE_MEAN = IMAGE_MEAN[IMAGE_CENTER:IMAGE_CENTER + CROPPED_DIM,
                                   IMAGE_CENTER:IMAGE_CENTER + CROPPED_DIM,
                                   :]
-  BATCH_SIZE = NET.blobs()[0].num  # network batch size
-  NUM_OUTPUT = NET.blobs()[-1].channels  # number of output classes
+  BATCH_SIZE = NET.blobs.values()[0].num  # network batch size
+  NUM_OUTPUT = NET.blobs.values()[-1].channels  # number of output classes
 
 
 if __name__ == "__main__":