python照猫画虎求阶乘_新手试运行了一个 caffe 的 Python 代码,出现这个错误是怎么回事?...

完全的 caffe 新手,研究了一天的 caffe ,虽然糊里糊涂的, GitHub 上找了个项目: https://github.com/BestiVicto... 在网上找了个 Python 代码照猫画虎写成如下:

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])

print 'predicted class:', prediction[0].argmax()

然后就出现: F0423 12:33:29.282009 172 insert_splits.cpp:35] Unknown bottom blob 'label' (layer 'loss1/loss', bottom index 1)

完全新手,估计代码错的很离谱,大家就别嘲笑了哈,想问一下这个如果 Python 实现的话该怎样写? 希望能得到解答,真诚谢谢~

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值