01 资源
vs2015 update3,git,cmake,opencv3.3.0。
opencv\samples\dnn\fcn_semsegm.cpp
。
这个demo需要使用4个文件:fcn8s-heavy-pascal.prototxt、pascal-classes.txt、rgb.jpg、fcn8s-heavy-pascal.caffemodel。
fcn8s-heavy-pascal.prototxt、pascal-classes.txt、rgb.jpg三个文件,可以在opencv的源码中找到,位置:opencv\samples\data\dnn
。
fcn8s-heavy-pascal.caffemodel可以到对应官网下载:http://dl.caffe.berkeleyvision.org/fcn8s-heavy-pascal.caffemodel
# D:\git\opencv\samples\dnn\fcn_semsegm.cpp
D:\git\opencv\samples\data\dnn\fcn8s-heavy-pascal.prototxt
D:\git\opencv\samples\data\dnn\pascal-classes.txt
D:\git\opencv\samples\data\dnn\rgb.jpg
http://dl.caffe.berkeleyvision.org/fcn8s-heavy-pascal.caffemodel
02 编译fcn_semsegm
参考opencv01 相对完整的编译opencv3.3.0 win版本,编译opencv3.3.0 vs2015版本。
生成目录文件:
D:\git\opencv\build\v3.3.0\x64\bin\Debug\example_dnn-fcn_semsegm.exe
03 配置项目运行环境
配置项目属性
设置samples/dnn/下面的fcn_semsegm项目为启动项,设置项目属性
配置属性==>调试==>工作目录=$(OutDir)
把需要的资源的文件拷贝到目标目录
把4个文件拷贝到Debug目录下(如果使用release版本,放入release目录下):
fcn8s-heavy-pascal.prototxt
pascal-classes.txt
rgb.jpg
fcn8s-heavy-pascal.caffemodel
Debug目录: D:\git\opencv\build\v3.3.0\x64\bin\Debug\
Release目录:D:\git\opencv\build\v3.3.0\x64\bin\Release\
04 运行结果
[libprotobuf WARNING D:\git\DeepLearning\tensorflow\build1.3.0\protobuf\src\protobuf\src\google\protobuf\io\coded_stream.cc:605] Reading dangerously large protocol message. If the message turns out to be larger than 2147483647 bytes, parsing will be halted for security reasons. To increase the limit (or to disable these warnings), see CodedInputStream::SetTotalBytesLimit() in google/protobuf/io/coded_stream.h.
[libprotobuf WARNING D:\git\DeepLearning\tensorflow\build1.3.0\protobuf\src\protobuf\src\google\protobuf\io\coded_stream.cc:82] The total number of bytes read was 537963413
Net Outputs(1):
score
processing time: 19756.0ms