hans

hans

【Machine Learning】【Python】六、Edge Boxes + SVM + NMS for Localization ---- 《SVM物体分类和定位检测》


前言#

总觉得 SW 效果不好,就尝试用了下 EdgeBoxes,速度提升一点点,不明显,平均 1.1 帧吧。但是框出物体的稳定程度和框正物体的准确率高很多,误检测相对也少了。

** 最新代码地址 GitHub: ** https://github.com/HansRen1024/SVM-classification-localization

配置 EdgeBoxes#

原作者只开源了 matlab 代码,在 github 找到了通过生成.so 库文件并调用的开源项目。

地址是: https://github.com/samarth-robo/edges

EdgeBoxes 安装流程:

先安装 numpy-opencv-converter

git clone https://github.com/samarth-robo/numpy-opencv-converter.git
cd numpy-opencv-converter/build
cmake ..
make

再安装 cvmatio

git clone https://github.com/samarth-robo/cvmatio.git
cd cvmatio/build
cmake ..
make
make install

这里可能编译不通过,说找不到 numpy/ndarrayobject.h 头文件。

将 /usr/local/lib/python2.7/side-
packages/numpy/core/include/ 目录中的 numpy 目录复制到 /usr/local/include 即可

sudo cp -r /usr/local/lib/python2.7/side-packages/numpy/core/include/numpy /usr/local/include

最后安装 edge

git clone https://github.com/samarth-robo/edges.git
cd edges/cpp
修改CMakeList.txt
将 CVMATIO_PATH 和 NUMPY_OPENCV_CONVERTER_PATH 路径改成上面安装好的路径。
cd build
cmake ..
make -j6

编译好之后,将 build 目录中的 edge_boxes_python.so 拷贝到要调用这个库文件的.py 文件目录下

同时要将../cpp/external/gop_1.3/data/ 目录中的 sf.dat 文件一起拷贝过去。

这样在我们的.py 文件中就可以正常调用 EdgeBoxes 这个算法了。

检测代码 #

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.