#Overview the code is a simplification version from the doppia code by rodrigob.
Reserve detection part using integral channels detector and cut the stereo part.
You cam choose to complie CPU or GPU version.
Main program is in the folder /src/applications/objects_detection
In folder /model give the human-readable version of the model files help to read the codes
#Requirements
- Linux (the code can in theory compile and run on windows, but practice has shown this to be a bad idea).
- All boost libraries.
- Google protocol buffer.
- OpenCv installed (2.4, but code also work with older versions. 3.0 not yet suppoted, but pull requests welcome).
- If speed is your concern, I strongly recommend to compile OpenCv on your machine using CUDA, enabled all relevant SIMD instructions and using -ffast-math -funroll-loops -march=native flags.
- CMake >= 2.4.3 (and knowledge on how to use it).
- Fair amount of patience to get things running.
If with GPU
-
C++ and CUDA compilation environments properly set. Only gcc 4.5 or superior are supported.
-
A GPU with CUDA capability 2.0 or higher (only for objects detection code), and ~200 Mb of free memory (for images of 640x480 pixels). #How to compile the code ? ##Step 1: install the requirements
-
boost: boost
-
Google protocol: Follow C++ Installation - Unix in Google protocol buffer
-
OpenCV: opencv
-
CMake:
sudo apt-get install cmake -
ccmake: install ccmake gui for cmake
sudo apt-get install cmake-curses-gui
If with GPU
- CUDA: cuda-downloads
##Step 2:
- Before trying to compile anything you should also execute (once) generate_protocol_buffer_files.sh to make sure the protocol buffer files match the version installed in your system.
- check the file
common_settings.cmakeand make sure the configuration specfic to your own machine
If with GPU
sm_50 should match your GPU architecture.
51 set(CUDA_NVCC_FLAGS "-arch=sm_50" CACHE STRING "CUDA architecture setting" FORCE)
##Step 3:
- Go to the application directory
cd src/applications/objects_detection - Make a directory for build and get in
mkdir build && cd build - Run ccmake to config if compile with GPU
ccmake ..If you change from gpu to cpu, you'd better clear the build pathrm -r \* - then
cmake ..andmake -j8(or-j10) to make things faster. - If things went well back to the parent directory
cd ../you should be able to run
run example for detect in one image
./build/objects_detection -c eccv2014_face_detection_pascal.config.ini
run example for detect on afw dataset
./data/afw/get_afw.sh #get afw images from web
./build/objects_detection_afw -c eccv2014_face_detection_pascal.config.ini#How to test the code?
the config for detector is in eccv2014_face_detection_pascal.config.ini
- If you compile cpu only, then change 'method = gpu_channels' to 'method = cpu_channels'
- config pertraining model in
model score_thresholdthreshold for the total score in the detector.x_strideandy_stridestride for sliding window.
#How to use the code?
in objects_detection_example.cpp I write a simple example to use and test the detector.
new
boost::scoped_ptr<doppia::ObjectsDetectionApplication> application_p( new doppia::ObjectsDetectionApplication() );
init
bool ok = application_p->init(argc, argv);
detetor in one image
application_p->one_step(inputmat);
get results
detections_t ds = application_p->getDetections();
#Read the code
I use Qt creator to read the code, it can open cmake project easily.
After run the cmake, you can open the project in Qt creator with cmake_install.cmake
Config the run settings in projects -> Build&Run -> Run. Add arguments for config file.