将caffemodel文件转换为Matlab可用的数据形式 您所在的位置:网站首页 caffemodel文件怎么打开 将caffemodel文件转换为Matlab可用的数据形式

将caffemodel文件转换为Matlab可用的数据形式

2023-10-05 09:52| 来源: 网络整理| 查看: 265

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();

可以看见第一个卷积层的参数。

这里写图片描述

2.异常处理 1.Undefined variable “caffe” or class “caffe.Net”

这里写图片描述

解决方案:需要在Matlab中加入caffe目录及子目录的路径

2.Encountered an internal problem

这里写图片描述

解决方案:可能是因为CUDA等版本变动导致,重新编译caffe。

$ cd $(CAFFE_ROOT) $ make clean $ make -j24 $ make pycaffe $ make matcaffe

这里写图片描述

3.部分网络会产生其他错误,具体问题具体分析。

(FRCNN可以选择其他caffe源,编译并添加路径试试。)



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有