faster rcnn cpp implementation based on maskrcnn-benchmark
All code architecture from maskrcnn-benchmark
export INSTALL_DIR=$PWD
git clone --recursive https://github.com/lsrock1/maskrcnn_benchmark.cpp.git
cd $INSTALL_DIR
// if opencv is not installed
// opencv install
cd maskrcnn_benchmark.cpp/lib/opencv
mkdir build
cd build
cmake ..
make install
// if yaml-cpp is not installed
// yaml-cpp install
cd $INSTALL_DIR
cd maskrcnn_benchmark.cpp/lib/yaml-cpp
mkdir build
cd build
cmake ..
make install
// Download pytorch cpp (cxx11 ABI)
// place libtorch folder in maskrcnn_benchmark.cpp/lib directory
// if you are using without cuda and get dyld: Library not loaded: @rpath/libmklml.dylib error
// https://github.com/pytorch/pytorch/issues/14165
cd $INSTALL_DIR
cd maskrcnn_benchmark.cpp
mkdir build
cd build
cmake ..
make
//run inference r50-fpn
run.out ../configs/e2e_faster_rcnn_R_50_FPN_1x.yaml inference
Download coco datasets
make directory under maskrcnn_benchmark.cpp
datasets
- coco
- train2017
- val2017
- annotations
- instances_val2017.json
- instances_train2017.json
backbone | type | lr sched | inference total batch | inference time(s/im) | box AP | Speed Improvement |
---|---|---|---|---|---|---|
R-50-FPN(python) | Fast | 1x | 8 | 0.05989 | 0.368 | 0 |
R-50-FPN(cpp) | Fast | 1x | 8 | 0.05520 | 0.368 | 7.8% |
R-101-FPN(python) | Fast | 1x | 8 | 0.07627 | 0.391 | 0 |
R-101-FPN(cpp) | Fast | 1x | 8 | 0.07176 | 0.391 | 5.9% |
VoV-39(python) | Fast | 2x | 8 | 0.06479 | 0.398 | 0 |
VoV-39(cpp) | Fast | 2x | 8 | 0.05949 | 0.398 | 8.1% |
VoV-57(python) | Fast | 2x | 8 | 0.07224 | 0.409 | 0 |
VoV-57(cpp) | Fast | 2x | 8 | 0.06713 | 0.409 | 7% |
- It doesn't support training yet.(Testing!)
- concat dataset
- python jit -> cpp model code
- multi GPU training(code complete but bug exists in libtorch)
- cmake install
- clean up code
- Yaml-cpp
- gtest
- libtorch >= 1.2
- rapidjson
- opencv
Weight python to cpp Download into /models
name | from | link(dropbox) | link(google drive) |
---|---|---|---|
R-50(backbone only) | python-pretrained | link | link |
R-101(backbone only) | python-pretrained | link | link |
R-50-FPN | python-trained | link | link |
R-101-FPN | python-trained | link | link |
R-50-C4 | python-trained | link | link |
V-39-FPN | python-trained | link | link |
V-57-FPN | python-trained | link | link |