From 97ea6f0ebf5906393337685889db372a78b49665 Mon Sep 17 00:00:00 2001 From: gineshidalgo99 Date: Thu, 18 Jan 2018 01:07:12 -0500 Subject: [PATCH] Lighter Caffe compiled by CMake --- CMakeLists.txt | 9 ++++- doc/library_how_to_debug.md | 12 ------ doc/library_how_to_develop.md | 71 +++++++++++++++++++++++++++++++++++ doc/release_notes.md | 3 ++ 4 files changed, 81 insertions(+), 14 deletions(-) delete mode 100644 doc/library_how_to_debug.md create mode 100644 doc/library_how_to_develop.md diff --git a/CMakeLists.txt b/CMakeLists.txt index 05b65671..e5a2f7d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -282,10 +282,15 @@ if (UNIX AND NOT APPLE) ExternalProject_Add(openpose_caffe SOURCE_DIR ${CAFFE_URL} PREFIX ${CAFFE_PREFIX} - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= -DUSE_CUDNN=${USE_CUDNN} + -DBUILD_docs=OFF -DBUILD_python=OFF - -DOpenCV_DIR=${OpenCV_DIR}) + -DBUILD_python_layer=OFF + -DUSE_LEVELDB=OFF + -DUSE_LMDB=OFF + -DUSE_OPENCV=OFF) + # -DOpenCV_DIR=${OpenCV_DIR}) ExternalProject_Get_Property(openpose_caffe install_dir) diff --git a/doc/library_how_to_debug.md b/doc/library_how_to_debug.md deleted file mode 100644 index 5abc3fa1..00000000 --- a/doc/library_how_to_debug.md +++ /dev/null @@ -1,12 +0,0 @@ -OpenPose C++ API - How to Debug OpenPose -====================================================== - -# Finding Segmentation Faults -This is the faster method to debug a segmentation fault problem. Usual scenario: You are editing OpenPose source code and suddenly OpenPose returns segmentation fault when executed. In order to find where it occurs: - 1. Select one of the 2 options: - 1. Switch to debug mode. - 2. Go to `openpose/utilities/errorAndLog.hpp` and modify `dLog`: - 1. Comment `#ifndef NDEBUG` and its else and endif. - 2. Call OpenPose with `--logging_level 0 --disable_multi_thread`. - 3. At this point you have an idea of in which file class the segmentation fault is coming from. Now you can further isolate the error by iteratively adding the following line all over the code until you find the exact position of the segmentation fault: `log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);` - 4. After you have found the segmentation fault, remember to remove all the extra `log()` calls that you temporaryly added. diff --git a/doc/library_how_to_develop.md b/doc/library_how_to_develop.md new file mode 100644 index 00000000..5b2f2e0a --- /dev/null +++ b/doc/library_how_to_develop.md @@ -0,0 +1,71 @@ +OpenPose C++ API - How to Develop OpenPose +====================================================== + + + + + +## OpenPose Coding Style +1. Naming: + 1. Class parameters should start with `m`, class pointers with `p`, shared_ptrs with `sp`, unique_ptrs with `up`, static parameters with `s`. + 2. Function and class parameters coding style is the same other than the previous point. + 3. Any parameters should not contain special characters, simply letters and numbers (preferred only letters) separated with upper case. E.g., `mThisIsAParameter`, `thisIsAParameter`. +2. Lenght: + 1. Lines should contain up to 120 characters. +3. Comments: + 1. Only `//` comments are allowed in the code, `/* */` should not be used. + 2. There should be a (at least) 1-line comment for each block of code inside each function. +4. Loops and statements: + 1. There should be a space between the keyword (`if`, `for`, etc) and the parenthesis, e.g.: `if (true)`. Wrong: `if(true)`. Note: So they can be easily located with Ctrl + F. + 2. Braces should be added in the following line with respect to the loop/statement keyword. E.g.: +``` +if (booleanParameter) + anotherParameter = 25; +else +{ + anotherParameter = 2; + differentParameter = 3; +} +``` + 3. 1-line loops/statements should not contain braces. See previous example. + + + + + +## Debugging C++ Code +### Finding Segmentation Faults +This is the faster method to debug a segmentation fault problem. Usual scenario: You are editing OpenPose source code and suddenly OpenPose returns segmentation fault when executed. In order to find where it occurs: + 1. Select one of the 2 options: + 1. Switch to debug mode. + 2. Go to `openpose/utilities/errorAndLog.hpp` and modify `dLog`: + 1. Comment `#ifndef NDEBUG` and its else and endif. + 2. Call OpenPose with `--logging_level 0 --disable_multi_thread`. + 3. At this point you have an idea of in which file class the segmentation fault is coming from. Now you can further isolate the error by iteratively adding the following line all over the code until you find the exact position of the segmentation fault: `log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);` + 4. After you have found the segmentation fault, remember to remove all the extra `log()` calls that you temporaryly added. + + + + + +## Speed +### Measuring Runtime Speed +1. Enable `PROFILER_ENABLED` with CMake or in the `Makefile.config` file. +2. By default, it should print out average runtime info after 1000 frames. You can change this number with `--profile_speed`, e.g., `--profile_speed 100`. + + + + + +## Accuracy +### Checking OpenPose Accuracy Quantitatively +1. Download OpenPose training code: https://github.com/CMU-Perceptual-Computing-Lab/openpose_train +2. Download val2017 set from COCO: http://images.cocodataset.org/zips/val2017.zip +3. Get JSONs in OpenPose: examples/tests/pose_accuracy_coco_val.sh +4. Get accuracy (Matlab): validation/f_getValidations.m + +### Checking Ground-Truth Labes +From the [COCO dataset](http://cocodataset.org/#download): +1. Download 2014 or 2017 Train/Val annotations. +2. Download the [COCO API](https://github.com/cocodataset/cocoapi). +3. With the COCO API (either Python, Matlab, or LUA ones), you can check any image with the image ID (equivalent to the number in the image name). diff --git a/doc/release_notes.md b/doc/release_notes.md index 564493c4..9fc840bd 100644 --- a/doc/release_notes.md +++ b/doc/release_notes.md @@ -175,6 +175,9 @@ OpenPose Library - Release Notes 3. Caffe added as submodule. 4. CMake installer compatible with Windows. 5. Added freeglut download script (3-D reconstruction demo for Windows). + 6. Added Debug version for Windows (CMake). + 7. Runtime verbose about average speed configurable by user with `PROFILER_ENABLED` option (CMake/Makefile.config) and `--profile_speed` flag. + 8. Lighter Caffe version compiled by CMake in Ubuntu: disabled Caffe extra support (e.g., OpenCV, Python) and doc. 2. Main bugs fixed: 1. Slight speed up (~1%) for performing the non-maximum suppression stage only in the body part heatmaps channels, and not also in the PAF channels. -- GitLab