V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Reign
V2EX  ›  Caffe

新手试运行了一个 caffe 的 Python 代码,出现这个错误是怎么回事?

  •  
  •   Reign · 2017-04-23 21:08:46 +08:00 · 4593 次点击
    这是一个创建于 2531 天前的主题,其中的信息可能已经有所发展或是发生改变。

    完全的 caffe 新手,研究了一天的 caffe ,虽然糊里糊涂的, GitHub 上找了个项目: https://github.com/BestiVictory/ILGnet 在网上找了个 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])

    plt.show()

    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 实现的话该怎样写? V 站高手多,希望能得到解答,真诚谢谢~

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   999 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 22:17 · PVG 06:17 · LAX 15:17 · JFK 18:17
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.