怎么把网络各个层的特征保存成数据呢?以我们经典的minist例子开始,在上一篇博客生成模型的基础上提取minis的卷积1层为例。


一:

先编译好caffe,生成build。


二:参考 http://blog.csdn.net/ture_dream/article/details/77100115训练minist模型


三:

输入

./build/tools/extract_features.bin \             //可执行程序
 examples/mnist/lenet_iter_10000.caffemodel \        //预训练的网络,×.caffemodel
 examples/mnist/lenet.prototxt \                    //描述文件××.prototxt
 conv1 \                                                           //需要提取的层
 myconv1 \                                          //保存的特征名
 10 \                     //做特征提取的数据批量数目
 lmdb \                 //输入数据的格式,lmdb/leveldb
 GPU \                //cpu/gpu
 1                        //如果用GPU,则选择设备编号

四:报错

caffe提取网络各个层的特征


GPU不行,现用CPU模式: 

./build/tools/extract_features.bin examples/mnist/lenet_iter_10000.caffemodel examples/mnist/lenet.prototxt conv1 myconv1 10 lmdb CPU


五: success:

caffe提取网络各个层的特征



思考:GPU为啥出错,因为就一个GPU,序号是0

./build/tools/extract_features.bin examples/mnist/lenet_iter_10000.caffemodel examples/mnist/lenet.prototxt ip1 myip1 100 lmdb GPU 0



caffe提取网络各个层的特征

为什么上面640,这次6400张图片。

试了几次,发现minibatch是64,做特征提取的数据批量数目10时是64*10=640,100时6400


相关文章:

  • 2021-10-01
  • 2021-07-10
  • 2022-12-23
  • 2021-12-11
  • 2022-12-23
  • 2021-09-03
  • 2021-05-08
  • 2022-12-23
猜你喜欢
  • 2021-08-06
  • 2022-02-24
  • 2022-12-23
  • 2021-06-18
  • 2021-10-11
  • 2022-12-23
  • 2021-10-01
相关资源
相似解决方案