-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unknown bottom blob 'label' (layer 'loss1/loss', bottom index 1) #2
Comments
你可以将deploy.prototxt里面的最后一层的类型SOFTMAX_LOSS改为SOFTMAX |
@BestiVictory 谢谢,按照您的指示:deploy.prototxt里面的最后一层的类型 |
你的代码用到了net.predict函数,需要把最后一层改成这样: |
@BestiVictory 额。。。改了之后就是: |
抱歉由于工作原因没有及时回复你的消息,我已经更新了deploy及test的脚本,你可以使用我的脚本及deploy文件进行测试。 |
新手试运行了代码:
import numpy as np
import matplotlib.pyplot as plt
caffe_root = '/opt/caffe/'
import sys
sys.path.insert(0, caffe_root + 'python')
import caffe
MODEL_FILE = caffe_root + 'ILGnet/deploy.prototxt'
PRETRAINED = caffe_root + 'ILGnet/ILGnet-AVA2.caffemodel'
IMAGE_FILE = caffe_root+'examples/images/cat.jpg'
mean_file=caffe_root + 'ILGnet/AVA2_mean.npy'
caffe.set_mode_cpu()
net = caffe.Classifier(MODEL_FILE, PRETRAINED,
mean=np.load(mean_file).mean(1).mean(1),
channel_swap=(2,1,0),
raw_scale=255,
image_dims=(227, 227))
input_image = caffe.io.load_image(IMAGE_FILE)
plt.imshow(input_image)
prediction = net.predict([input_image])
plt.plot(prediction[0])
plt.show()
print 'predicted class:', prediction[0].argmax()
不知道哪里有错,希望能解答
The text was updated successfully, but these errors were encountered: