您的位置:首页 > Web前端

caffe提取已训练好模型的特征

2015-11-26 12:29 573 查看
按照caffe官网教程:

1、创建一个临时文件夹
$ mkdir examples/_temp
2、我们为三张图片添加一个文件列表
$ find `pwd`/examples/images -type f -exec echo {} \; > examples/_temp/temp.txt
3、将使用 imagedatalayer 预计标签之后的每一个文件名,所以让我们添加一个 0 到每一行
的末尾
$ sed "s/$/ 0/" examples/_temp/temp.txt > examples/_temp/file_list.txt
4、从 ILSVRC dataset 中下载均值图像数据库
$ ./data/ilsvrc12/get_ilsvrc_aux.sh
5、使用其中的 data/ilsvrc212/imagenet_mean.binaryproto 去定义网络结构。将定义结构的文件 cope 到我们的临时文件夹。
$ cp examples/feature_extraction/imagenet_val.prototxt examples/_temp
6、进入 imagenet_val.prototxt 更改路径。更改其中$CAFFE的地方
7、提取特征
$ ./build/tools/extract_features.bin models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel examples/_temp/imagenet_val.prototxt fc7 examples/_temp/features 10 lmdb
8、出现错误“Check failed: status.ok() Failed to open leveldb examples/_temp/features”
$ rm -rf examples/_temp/features/
再运行一次基本就可以了。



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: