caffe_features_classify.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:image-classifier 作者: gustavkkk 项目源码 文件源码
def init_net():
    net = caffe.Classifier(caffe_root  + 'models/bvlc_reference_caffenet/deploy.prototxt',
                           caffe_root + 'models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel')
    net.set_phase_test()
    net.set_mode_cpu()
    # input preprocessing: 'data' is the name of the input blob == net.inputs[0]
    net.set_mean('data', np.load(caffe_root + 'python/caffe/imagenet/ilsvrc_2012_mean.npy'))  # ImageNet mean
    net.set_raw_scale('data', 255)  # the reference model operates on images in [0,255] range instead of [0,1]
    net.set_channel_swap('data', (2,1,0))  # the reference model has channels in BGR order instead of RGB
    return net
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号