Skip to content
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

Open
shinebay opened this issue Apr 23, 2017 · 5 comments
Open

Comments

@shinebay
Copy link

新手试运行了代码:
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()
不知道哪里有错,希望能解答

@BestiVictory
Copy link
Owner

你可以将deploy.prototxt里面的最后一层的类型SOFTMAX_LOSS改为SOFTMAX

@shinebay
Copy link
Author

shinebay commented May 2, 2017

@BestiVictory 谢谢,按照您的指示:deploy.prototxt里面的最后一层的类型
layers {
name: "loss1/loss"
type: SOFTMAX
bottom: "loss1/classifier_cjy"
bottom: "label"
}
更改后运行:
F0502 11:37:13.672961 60 insert_splits.cpp:35] Unknown bottom blob 'label' (layer 'loss1/loss', bottom index 1)
*** Check failure stack trace: ***
Aborted (core dumped)
还是这个错误,麻烦您了

@BestiVictory
Copy link
Owner

你的代码用到了net.predict函数,需要把最后一层改成这样:
layers {
name: "loss1/loss"
type: SOFTMAX
bottom: "loss1/classifier_cjy"
top: "prob"
}

@shinebay
Copy link
Author

shinebay commented May 3, 2017

@BestiVictory 额。。。改了之后就是:
F0503 09:54:48.940515 67 insert_splits.cpp:35] Unknown bottom blob 'prob' (layer 'loss1/loss', bottom index 1)

@BestiVictory
Copy link
Owner

抱歉由于工作原因没有及时回复你的消息,我已经更新了deploy及test的脚本,你可以使用我的脚本及deploy文件进行测试。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants