caffe2numpy.py 文件源码

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

项目:keras_zoo 作者: david-vazquez 项目源码 文件源码
def load_caffe(path_prototxt='weights/resnetFCN.prototxt',
               path_weights='weights/resnetFCN.caffemodel',
               out_path='weights/resnetFCN.npy',
               version='V1'):

    # Load the caffe network
    print (' --> Loading the caffe weights...')
    net_caffe = caffe.Net(path_prototxt, path_weights, caffe.TEST)
    layers_caffe = dict(zip(list(net_caffe._layer_names), net_caffe.layers))

    # Convert weights
    print (' --> Converting the caffe weights to numpy...')
    weights_caffe = convert_weights(layers_caffe, v=version)

    # Save weights
    print (' --> Saving the weights in numpy...')
    np.save(out_path, weights_caffe)


# Entry point of the script
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号