Hello,
I am trying to use pycaffe on my test set. I am trying to roughly follow the classification notebook, but expanding it to a set rather than just the one image.
Enter cimport sys
import numpy as np
import os.path as osp
import caffe
CLASSES = 11
num2cls = ['AMP_Scratch', 'Coat_Defect','Coat_Flake', 'Etch_Pit', 'Mussel', 'Other', 'Pansy', 'Particle', 'Scratch', 'Splatter', 'TBD']
caffe.set_device(0)
caffe.set_mode_gpu()
net_def = '/path/to/prototext'
weights = '/path/to/weights'
net = caffe.Net(net_def, weights, caffe.TEST)
num_batches = 937 #number of files to be tested
output_file = '/g/g14/amorin1/DamageNet/Models/AlexNet/7.6.2017/pytest.out'
for t in range(num_batches):
# next batch
output = net.forward()
label = net.blobs['label'].data
output_prob = output['prob'][0]
print 'label'
print 'predicted class is:', output_prob.argmax()
print 'output label:', num2cls[output_prob.argmax()]
ode here...
I get this error:
output_prob = output['prob'].
KeyError: 'prob'
I also get this error before the net is loaded, but the test continues:
W0713 15:40:53.573498 125192 _caffe.cpp:135] DEPRECATION WARNING - deprecated use of Python interface
W0713 15:40:53.573940 125192 _caffe.cpp:136] Use this instead (with the named "weights" parameter):
Not sure if these are related?
Thanks!