根据py-faster-rcnn的demo.py修改成c++版本
来源:互联网 发布:beoplayer安卓版 软件 编辑:程序博客网 时间:2024/06/11 04:16
本文是对https://github.com/galian123/libfaster_rcnn_cpp的说明,此repo是我从XieQiang 的libfaster_rcnn_cpp fork出来的代码,并做了整理。
我主要做了3个修改:
删掉了多余的头文件和cmake要include的目录位置。删掉了不需要链接的so文件。
在src目录的CMakeLists.txt增加了
faster_rcnn_path
变量,这样对cmake编译环境来说,只需要把这个变量更新为你自己的py-faster-rcnn的路径即可。不用再修改其他的CMakeLists.txt了。不用再手动拷贝gpu_nms.so文件了。这个拷贝操作是由cmake自动完成的。
下面是我整理后readme的内容:
Note:
This repo is forked from https://github.com/QiangXie/libfaster_rcnn_cpp .
But I found another similar code: https://github.com/YihangLou/FasterRCNN-Encapsulation-Cplusplus
Most of code is same.
And there is blog to explain the code: http://blog.csdn.net/xyy19920105/article/details/50440957
What I have done:
1. Delete redundant ‘include’ and undependent .so files
2. Set faster_rcnn_path
for all CMakeLists.txt.
You only need to set only one viarable (faster_rcnn_path
) to configure environment.
3. You don’t have to copy gpu_nms.so manually. This is done by cmake automatically now.
This project is Faster-rcnn detector C++ version demo, if you want to learn more about Faster-rcnn, please click py-faster-rcnn.
0. Precondition
Make sure your py-faster-rcnn
works well.
1. Download code
git clone https://github.com/galian123/libfaster_rcnn_cpp
2 set faster_rcnn_path
in src/CMakeLists.txt
Like this : set(faster_rcnn_path "~/git/py-faster-rcnn/")
If you forget to set faster_rcnn_path
, error will happen if you run cmake ..
.
CMake Error at src/CMakeLists.txt:4 (message): Error: please set ${faster_rcnn_path} before run cmake. ${faster_rcnn_path} is where your 'py-faster-rcnn' exists.-- Configuring incomplete, errors occurred!
3 Modify main.cpp
Set your path of test.prototxt
and .caffemodel
file in main.cpp
.
4 Build
Current folder is libfaster_rcnn_cpp
.
mkdir buildcd buildcmake ..make
5 Run the program
Current folder is libfaster_rcnn_cpp
.
NOTE: run main
in ./bin
folder. Because hardcode ‘test1.jpg’ is in bin
folder.
cd bin./main
This program will detect test1.jpg in bin folder, and print the detected vehicle bounding box, then rectangle bounding box and saved as test.jpg. If you need modify this project to do more, see main.cpp.
6 TODO
Make main(main.cpp) can receive arguments, or save settings to yaml file.
7 Fix protobuf version error
I1222 20:17:27.105358 24948 layer_factory.hpp:77] Creating layer proposal[libprotobuf FATAL google/protobuf/stubs/common.cc:61] This program requires version 3.4.0 of the Protocol Buffer runtime library, but the installed version is 2.6.1. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "google/protobuf/descriptor.pb.cc".)terminate called after throwing an instance of 'google::protobuf::FatalException' what(): This program requires version 3.4.0 of the Protocol Buffer runtime library, but the installed version is 2.6.1. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "google/protobuf/descriptor.pb.cc".)Aborted (core dumped)
Solution:
Run pip show protobuf
to show protobuf version in python (installed via pip).
Run protoc --version
to show protobuf version (installed via apt-get).
These two version are not same.
Uninstall protobuf: sudo pip uninstall protobuf
Install protobuf with version 2.6.1: sudo pip install protobuf==2.6.1
Then recompile `py-faster-rcnn’.
Refer to https://github.com/BVLC/caffe/issues/5711
- 根据py-faster-rcnn的demo.py修改成c++版本
- py- faster rcnn修改demo.py
- cudnn 5.1版本下跑通 py-faster-rcnn的demo
- py-faster-rcnn demo.py分析(py-faster-rcnn)
- 学习Faster-RCNN (py-faster-rcnn demo)
- Faster-Rcnn demo.py解析
- faster-rcnn demo.py详解
- py-faster-rcnn demo.py解析
- py-faster-rcnn demo.py解析
- faster rcnn修改demo.py保存网络中间结果
- CAFFE- faster rcnn修改demo.py保存网络中间结果
- Py-faster-rcnn实现自己的数据train和demo
- Py-faster-rcnn实现自己的数据train和demo
- Py-faster-rcnn实现自己的数据train和demo
- 没有界面faster-rcnn 跑demo.py
- faster-rcnn 跑demo.py 无界面
- [目标检测] faster-rcnn demo.py 解析
- py-faster-rcnn 使用的caffe sync 到最新版本
- 数据结构实验之查找七:线性之哈希表
- VIJOS-P1134 24点游戏 dfs
- Spark RDD、DataFrame和DataSet的区别
- C#调用存储过程和函数
- final关键字使用
- 根据py-faster-rcnn的demo.py修改成c++版本
- JDBC 数据库连接
- Space Filter
- C++数据序列化之MessagePack
- Android开发值JNI函数动态注册
- TCP,IP,HTTP,SOCKET区别和联系
- Notification讲解
- C#学习笔记之——动态数组(ArrayList)
- QT中一份用于项目的QSS样式,包括了多个控件