将caffemodel文件转换为Matlab可用的数据形式 | 您所在的位置:网站首页 › caffemodel文件怎么打开 › 将caffemodel文件转换为Matlab可用的数据形式 |
1.MATLAB示例程序:
%% Load the Caffe.Net and save in model file.
def = fullfile('..', 'models', 'VGG_CNN_M_1024', 'test.prototxt');
net = fullfile('..', 'output', 'default', 'voc_2007_trainval', ...
'vgg_cnn_m_1024_fast_rcnn_iter_40000.caffemodel');
ConvNet = caffe.Net(def, net, 'test');
save model/ConvNet ConvNet
其中,def为网络的test.prototxt文件路径,net为caffe训练得到caffemodel文件路径。调用caffe.Net可以获得MATLAB可以解析的数据形式(矩阵形式),如下所示: (示例为Small VGG训练后,转成的Matlab形式的模型参数) 在matlab命令行内输入代码 ConvNet.layers('conv1').params(1).get_data();可以看见第一个卷积层的参数。 解决方案:需要在Matlab中加入caffe目录及子目录的路径 2.Encountered an internal problem解决方案:可能是因为CUDA等版本变动导致,重新编译caffe。 $ cd $(CAFFE_ROOT) $ make clean $ make -j24 $ make pycaffe $ make matcaffe(FRCNN可以选择其他caffe源,编译并添加路径试试。) |
CopyRight 2018-2019 实验室设备网 版权所有 |