Skip to content

Commit

Permalink
Changes for Python and Unity binds
Browse files Browse the repository at this point in the history
  • Loading branch information
gineshidalgo99 committed Jan 12, 2019
1 parent 29fc003 commit 4151a19
Show file tree
Hide file tree
Showing 56 changed files with 272 additions and 256 deletions.
41 changes: 23 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,36 +32,32 @@ matrix:
- cd $TRAVIS_BUILD_DIR
- chmod +x scripts/generate_gh_pages.sh
- ./scripts/generate_gh_pages.sh
# Ubuntu 16.04 - Default - CMake - CUDA - no cuDNN
# Ubuntu 16.04 - Python - CMake - CUDA
- os: linux
dist: xenial
env: NAME="U16-default-cmake-cuda8-nocudnn" WITH_CUDNN=false
env: NAME="U16-python-cmake-cuda8" WITH_PYTHON=true
sudo: required
# Ubuntu 16.04 - Python - CMake - CUDA
# Ubuntu 16.04 - Default - CMake - CPU
- os: linux
dist: xenial
env: NAME="U16-python-cmake-cuda8" WITH_PYTHON=true
env: NAME="U16-default-cmake-cpu" WITH_CUDA=false
sudo: required
# Ubuntu 16.04 - Default - Make - CUDA
# Ubuntu 16.04 - Python - CMake - CPU
- os: linux
dist: xenial
env: NAME="U16-default-make-cuda8" WITH_CMAKE=false
env: NAME="U16-python-cmake-cpu" WITH_PYTHON=true WITH_CUDA=false
sudo: required
# Ubuntu 16.04 - Default - CMake - CPU
# Ubuntu 16.04 - Default - Make - CUDA
- os: linux
dist: xenial
env: NAME="U16-default-cmake-cpu" WITH_CUDA=false
env: NAME="U16-default-make-cuda8" WITH_CMAKE=false
sudo: required
# # TO-DO: To be implemented
# # Ubuntu 16.04 - Default - CMake - CPU MKL
# - os: linux
# dist: xenial
# env: NAME="U16-default-cmake-cpu-mkl" WITH_CUDA=false WITH_MKL=true
# sudo: required
# Ubuntu 16.04 - Python - CMake - CPU
- os: linux
dist: xenial
env: NAME="U16-python-cmake-cpu" WITH_PYTHON=true WITH_CUDA=false
sudo: required
# # Ubuntu 16.04 - Default - CMake - OpenCL
# - os: linux
# dist: xenial
Expand All @@ -72,13 +68,14 @@ matrix:
# dist: xenial
# env: NAME="U16-python-cmake-opencl" WITH_PYTHON=true WITH_CUDA=false WITH_OPEN_CL=true
# sudo: required
# # Unnecessary/redundant ones
# # Ubuntu 16.04 - Default - CMake - CUDA - no cuDNN
# - os: linux
# dist: xenial
# env: NAME="U16-default-cmake-cuda8-nocudnn" WITH_CUDNN=false
# sudo: required

# Ubuntu 14.04
# Ubuntu 14.04 - Default - CMake - CUDA
- os: linux
dist: trusty
env: NAME="U14-default-cmake-cuda8"
sudo: required
# Ubuntu 14.04 - Default - CMake - CPU
- os: linux
dist: trusty
Expand All @@ -89,12 +86,20 @@ matrix:
dist: trusty
env: NAME="U14-default-make-cuda8" WITH_CMAKE=false
sudo: required
# # Unnecessary/redundant ones
# # Ubuntu 14.04 - Default - CMake - CUDA
# - os: linux
# dist: trusty
# env: NAME="U14-default-cmake-cuda8"
# sudo: required

# # TO-DO: To be implemented
# # Windows
# # Windows - Default - CMake - CUDA
# - os: windows
# env: NAME="W10-default-cmake-cuda8"

# # TO-DO: To be implemented
# # Mac OSX
# # Mac OSX - Default - CMake - CPU
# - os: osx
Expand Down
10 changes: 6 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@ if (UNIX OR APPLE)
list(LENGTH CAFFE_DIR_VALID CAFFE_DIR_VALID_LENGTH)
if (CAFFE_DIR_VALID_LENGTH EQUAL 0)
execute_process(COMMAND git submodule update --init ${CMAKE_SOURCE_DIR}/3rdparty/caffe)
# execute_process(COMMAND git submodule update --init --recursive) # This would initialize them all
else (CAFFE_DIR_VALID_LENGTH EQUAL 0)
message(STATUS "Caffe has already been downloaded.")
endif (CAFFE_DIR_VALID_LENGTH EQUAL 0)
Expand Down Expand Up @@ -700,7 +701,7 @@ if (UNIX OR APPLE)

# One for Intel Branch and one for Master
if (USE_MKL)
ExternalProject_Add(openpose
ExternalProject_Add(openpose_lib
SOURCE_DIR ${CAFFE_URL}
PREFIX ${CAFFE_PREFIX}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
Expand All @@ -720,7 +721,7 @@ if (UNIX OR APPLE)
-DUSE_OPENCV=OFF)
# -DOpenCV_DIR=${OpenCV_DIR})
else (USE_MKL)
ExternalProject_Add(openpose
ExternalProject_Add(openpose_lib
SOURCE_DIR ${CAFFE_URL}
PREFIX ${CAFFE_PREFIX}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
Expand All @@ -739,10 +740,10 @@ if (UNIX OR APPLE)
# -DOpenCV_DIR=${OpenCV_DIR})
endif (USE_MKL)

ExternalProject_Get_Property(openpose install_dir)
ExternalProject_Get_Property(openpose_lib install_dir)

if (NOT Caffe_FOUND)
add_custom_command(TARGET openpose
add_custom_command(TARGET openpose_lib
POST_BUILD
COMMAND ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR}
COMMAND $(MAKE)
Expand Down Expand Up @@ -922,6 +923,7 @@ if (BUILD_PYTHON)
elseif (UNIX OR APPLE)
if (Caffe_FOUND)
execute_process(COMMAND git submodule update --init ${CMAKE_SOURCE_DIR}/3rdparty/pybind11/)
# execute_process(COMMAND git submodule update --init --recursive) # This would initialize them all
add_subdirectory(3rdparty/pybind11)
add_subdirectory(python)
endif (Caffe_FOUND)
Expand Down
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,18 @@
- **OS**: Ubuntu (14, 16), Windows (8, 10), Mac OSX, Nvidia TX2.
- **Others**:
- Available: command-line demo, C++ wrapper, and C++ API.
- [**Python API**](doc/modules/python_module.md).
- [**Unity Plugin**](https://github.com/CMU-Perceptual-Computing-Lab/openpose_unity_plugin).
- CUDA (Nvidia GPU), OpenCL (AMD GPU), and CPU versions.



## Latest Features
- Dec 2018: [**Foot dataset**](https://cmu-perceptual-computing-lab.github.io/foot_keypoint_dataset) [**and new paper released**](https://arxiv.org/abs/1812.08008)!
- Jan 2018: [**Unity plugin released**](https://github.com/CMU-Perceptual-Computing-Lab/openpose_unity_plugin)!
- Jan 2018: [**Improved Python API**](doc/modules/python_module.md) released! Including body, face, hands, and all the functionality of the C++ API!
- Dec 2018: [**Foot dataset**](https://cmu-perceptual-computing-lab.github.io/foot_keypoint_dataset) and [**new paper released**](https://arxiv.org/abs/1812.08008)!
- Sep 2018: [**Experimental single-person tracker**](doc/quick_start.md#tracking) for further speed up or visual smoothing!
- Jun 2018: [**Combined body-foot model released! 40% faster and 5% more accurate**](doc/installation.md)!
- Jun 2018: [**Python API**](doc/modules/python_module.md) released!
- Jun 2018: [**OpenCL/AMD graphic card version**](doc/installation.md) released!
- Jun 2018: [**Calibration toolbox**](doc/modules/calibration_module.md) released!

Expand All @@ -49,29 +52,27 @@ For further details, check [all released features](doc/released_features.md) and


## Results
### Body-Foot Estimation
### Body and Foot Estimation
<p align="center">
<img src="doc/media/dance_foot.gif", width="360">
</p>

### Body, Face, and Hands Estimation
<p align="center">
<img src="doc/media/pose_face.gif", width="360">
</p>

### 3-D Reconstruction Module
### 3-D Reconstruction Module (Body, Foot, Face, and Hands)
<p align="center">
<img src="doc/media/openpose3d.gif", width="360">
</p>

### Body and Hands Estimation
### Body, Foot, Face, and Hands Estimation
<p align="center">
<img src="doc/media/pose_face.gif", width="360">
<img src="doc/media/pose_hands.gif", width="360">
</p>

### Body Estimation
### Unity Plugin
<p align="center">
<img src="doc/media/dance.gif", width="360">
<img src="doc/media/unity_main.png", width="240">
<img src="doc/media/unity_body_foot.png", width="240">
<img src="doc/media/unity_hand_face.png", width="240">
</p>

### Runtime Analysis
Expand Down
4 changes: 2 additions & 2 deletions doc/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ This installation section is only intended if you plan to modify the OpenPose co

## Operating Systems
- **Ubuntu** 14 and 16.
- **Windows** 8 and 10.
- **Windows** 7, 8, 10.
- **Mac OSX** Mavericks and above.
- **Nvidia Jetson TX2** (for JetPack 3.1 or 3.3), installation instructions in [doc/installation_jetson_tx2_jetpack3.1.md](./installation_jetson_tx2_jetpack3.1.md) and [doc/installation_jetson_tx2_jetpack3.3.md](./installation_jetson_tx2_jetpack3.3.md) respectively.
- OpenPose has also been used on **Windows 7**, **CentOS**, and **Nvidia Jetson (TK1 and TX1)** embedded systems. However, we do not officially support them at the moment.
Expand Down Expand Up @@ -140,7 +140,7 @@ Any problem installing OpenPose? Check [doc/faq.md](./faq.md) and/or post a GitH
3. Ubuntu only: Install `sudo apt-get install libviennacl-dev`. This comes packaged inside OpenPose for Windows.
4. AMD Drivers have not been tested on OSX. Please email us if you wish to test it. This has only been tested on Vega series cards.
6. Ubuntu - Other prerequisites:
- Caffe prerequisites: By default, OpenPose uses Caffe under the hood. If you have not used Caffe previously, install its dependencies by running `sudo bash ./scripts/ubuntu/install_ubuntu_deps_and_cuda.sh` (if Ubuntu 16 or 14 and for Graphic cards up to 10XX) or run `sudo bash ./scripts/ubuntu/install_ubuntu_deps.sh` after installing your desired CUDA and cuDNN versions.
- Caffe prerequisites: By default, OpenPose uses Caffe under the hood. If you have not used Caffe previously, install its dependencies by running `sudo bash ./scripts/ubuntu/install_deps_and_cuda.sh` (if Ubuntu 16 or 14 and for Graphic cards up to 10XX) or run `sudo bash ./scripts/ubuntu/install_deps.sh` after installing your desired CUDA and cuDNN versions.
- OpenCV must be already installed on your machine. It can be installed with `apt-get install libopencv-dev`. You can also use your own compiled OpenCV version.
7. Windows - **Caffe, OpenCV, and Caffe prerequisites**:
- CMake automatically downloads all the Windows DLLs. Alternatively, you might prefer to download them manually:
Expand Down
Binary file removed doc/media/dance.gif
Binary file not shown.
Binary file added doc/media/unity_body_foot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/media/unity_hand_face.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/media/unity_main.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 13 additions & 1 deletion doc/modules/python_module.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ Check [doc/installation.md#python-module](../installation.md#python-api) for ins
The Python API requires Numpy for array management, and OpenCV for image loading. They can be installed via:

```
pip install numpy opencv-python
# Python 2
sudo pip install numpy opencv-python
# Python 3 (recommended)
sudo pip3 install numpy opencv-python
```


Expand All @@ -39,7 +42,16 @@ All the Python examples from the Tutorial API Python module can be found in `bui
```
# From command line
cd build/examples/tutorial_api_python
# Python 2
python2 1_body_from_image.py
python2 2_whole_body_from_image.py
# python2 [any_other_example.py]
# Python 3 (recommended)
python3 1_body_from_image.py
python3 2_whole_body_from_image.py
# python3 [any_other_example.py]
```


Expand Down
1 change: 1 addition & 0 deletions doc/release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ OpenPose Library - Release Notes
30. Added Travis build check for several configurations: Ubuntu (14/16)/Mac/Windows and CPU/CUDA/OpenCL and with/without Python.
31. Assigned 755 access to all sh scripts (some of them were only 644).
32. Added the flags `--prototxt_path` and `--caffemodel_path` to allow custom ProtoTxt and CaffeModel paths.
33. Replaced the old Python wrapper for an updated Pybind11 wrapper version, that includes all the functionality of the C++ API.
2. Functions or parameters renamed:
1. By default, python example `tutorial_developer/python_2_pose_from_heatmaps.py` was using 2 scales starting at -1x736, changed to 1 scale at -1x368.
2. WrapperStructPose default parameters changed to match those of the OpenPose demo binary.
Expand Down
4 changes: 3 additions & 1 deletion doc/released_features.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
OpenPose Library - All Released Features
====================================

- Dec 2018: [**Foot dataset**](https://cmu-perceptual-computing-lab.github.io/foot_keypoint_dataset) [**and new paper released**](https://arxiv.org/abs/1812.08008)!
- Jan 2018: [**Unity plugin released**](https://github.com/CMU-Perceptual-Computing-Lab/openpose_unity_plugin)!
- Jan 2018: [**Improved Python API**](doc/modules/python_module.md) released! Including body, face, hands, and all the functionality of the C++ API!
- Dec 2018: [**Foot dataset**](https://cmu-perceptual-computing-lab.github.io/foot_keypoint_dataset) and [**new paper released**](https://arxiv.org/abs/1812.08008)!
- Sep 2018: [**Experimental tracker**](./quick_start.md#tracking)!
- Jun 2018: [**Combined body-foot model released! 40% faster and 5% more accurate**](./installation.md)!
- Jun 2018: [**Python API**](./modules/python_module.md) released!
Expand Down
2 changes: 1 addition & 1 deletion examples/calibration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ foreach(EXAMPLE_FILE ${EXAMPLE_FILES})

message(STATUS "Adding Example ${EXE_NAME}")
add_executable(${EXE_NAME} ${EXAMPLE_FILE})
target_link_libraries(${EXE_NAME} openpose_src ${examples_3rdparty_libraries})
target_link_libraries(${EXE_NAME} openpose ${examples_3rdparty_libraries})

if (WIN32)
set_property(TARGET ${EXE_NAME} PROPERTY FOLDER "Examples")
Expand Down
2 changes: 1 addition & 1 deletion examples/openpose/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ foreach(EXAMPLE_FILE ${EXAMPLE_FILES})

message(STATUS "Adding Example ${EXE_NAME}")
add_executable(${EXE_NAME} ${EXAMPLE_FILE})
target_link_libraries(${EXE_NAME} openpose_src ${examples_3rdparty_libraries})
target_link_libraries(${EXE_NAME} openpose ${examples_3rdparty_libraries})

if (WIN32)
set_property(TARGET ${EXE_NAME} PROPERTY FOLDER "Examples")
Expand Down
10 changes: 5 additions & 5 deletions examples/openpose/openpose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ int openPoseDemo()
if (!FLAGS_write_keypoint.empty())
op::log("Flag `write_keypoint` is deprecated and will eventually be removed."
" Please, use `write_json` instead.", op::Priority::Max);
// keypointScale
const auto keypointScale = op::flagsToScaleMode(FLAGS_keypoint_scale);
// keypointScaleMode
const auto keypointScaleMode = op::flagsToScaleMode(FLAGS_keypoint_scale);
// heatmaps to add
const auto heatMapTypes = op::flagsToHeatMaps(FLAGS_heatmaps_add_parts, FLAGS_heatmaps_add_bkg,
FLAGS_heatmaps_add_PAFs);
const auto heatMapScale = op::flagsToHeatMapScaleMode(FLAGS_heatmaps_scale);
const auto heatMapScaleMode = op::flagsToHeatMapScaleMode(FLAGS_heatmaps_scale);
// >1 camera view?
const auto multipleView = (FLAGS_3d || FLAGS_3d_views > 1 || FLAGS_flir_camera);
// Enabling Google Logging
Expand All @@ -68,10 +68,10 @@ int openPoseDemo()
op::Wrapper opWrapper;
// Pose configuration (use WrapperStructPose{} for default and recommended configuration)
const op::WrapperStructPose wrapperStructPose{
!FLAGS_body_disable, netInputSize, outputSize, keypointScale, FLAGS_num_gpu, FLAGS_num_gpu_start,
!FLAGS_body_disable, netInputSize, outputSize, keypointScaleMode, FLAGS_num_gpu, FLAGS_num_gpu_start,
FLAGS_scale_number, (float)FLAGS_scale_gap, op::flagsToRenderMode(FLAGS_render_pose, multipleView),
poseModel, !FLAGS_disable_blending, (float)FLAGS_alpha_pose, (float)FLAGS_alpha_heatmap,
FLAGS_part_to_show, FLAGS_model_folder, heatMapTypes, heatMapScale, FLAGS_part_candidates,
FLAGS_part_to_show, FLAGS_model_folder, heatMapTypes, heatMapScaleMode, FLAGS_part_candidates,
(float)FLAGS_render_threshold, FLAGS_number_people_max, FLAGS_maximize_positives, FLAGS_fps_max,
FLAGS_prototxt_path, FLAGS_caffemodel_path, enableGoogleLogging};
opWrapper.configure(wrapperStructPose);
Expand Down
2 changes: 1 addition & 1 deletion examples/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ foreach(EXAMPLE_FILE ${EXAMPLE_FILES})

message(STATUS "Adding Example ${EXE_NAME}")
add_executable(${EXE_NAME} ${EXAMPLE_FILE})
target_link_libraries(${EXE_NAME} openpose_src ${examples_3rdparty_libraries})
target_link_libraries(${EXE_NAME} openpose ${examples_3rdparty_libraries})

if (WIN32)
set_property(TARGET ${EXE_NAME} PROPERTY FOLDER "Examples/Tutorial/Tests")
Expand Down
5 changes: 3 additions & 2 deletions examples/tests/wrapperHandFromJsonTest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,9 @@ namespace op
mPostProcessingWs.emplace_back(std::make_shared<WOpOutputToCvMat<TDatumsPtr>>(opOutputToCvMat));
}
// Re-scale pose if desired
if (wrapperStructPose.keypointScale != ScaleMode::InputResolution)
error("Only wrapperStructPose.keypointScale == ScaleMode::InputResolution.", __LINE__, __FUNCTION__, __FILE__);
if (wrapperStructPose.keypointScaleMode != ScaleMode::InputResolution)
error("Only wrapperStructPose.keypointScaleMode == ScaleMode::InputResolution.",
__LINE__, __FUNCTION__, __FILE__);

mOutputWs.clear();
// Write people pose data on disk (json format)
Expand Down
10 changes: 5 additions & 5 deletions examples/tutorial_add_module/1_custom_post_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ int tutorialAddModule1()
if (!FLAGS_write_keypoint.empty())
op::log("Flag `write_keypoint` is deprecated and will eventually be removed."
" Please, use `write_json` instead.", op::Priority::Max);
// keypointScale
const auto keypointScale = op::flagsToScaleMode(FLAGS_keypoint_scale);
// keypointScaleMode
const auto keypointScaleMode = op::flagsToScaleMode(FLAGS_keypoint_scale);
// heatmaps to add
const auto heatMapTypes = op::flagsToHeatMaps(FLAGS_heatmaps_add_parts, FLAGS_heatmaps_add_bkg,
FLAGS_heatmaps_add_PAFs);
const auto heatMapScale = op::flagsToHeatMapScaleMode(FLAGS_heatmaps_scale);
const auto heatMapScaleMode = op::flagsToHeatMapScaleMode(FLAGS_heatmaps_scale);
// >1 camera view?
const auto multipleView = (FLAGS_3d || FLAGS_3d_views > 1 || FLAGS_flir_camera);
// Enabling Google Logging
Expand All @@ -81,10 +81,10 @@ int tutorialAddModule1()
op::WrapperT<op::UserDatum> opWrapperT;
// Pose configuration (use WrapperStructPose{} for default and recommended configuration)
const op::WrapperStructPose wrapperStructPose{
!FLAGS_body_disable, netInputSize, outputSize, keypointScale, FLAGS_num_gpu, FLAGS_num_gpu_start,
!FLAGS_body_disable, netInputSize, outputSize, keypointScaleMode, FLAGS_num_gpu, FLAGS_num_gpu_start,
FLAGS_scale_number, (float)FLAGS_scale_gap, op::flagsToRenderMode(FLAGS_render_pose, multipleView),
poseModel, !FLAGS_disable_blending, (float)FLAGS_alpha_pose, (float)FLAGS_alpha_heatmap,
FLAGS_part_to_show, FLAGS_model_folder, heatMapTypes, heatMapScale, FLAGS_part_candidates,
FLAGS_part_to_show, FLAGS_model_folder, heatMapTypes, heatMapScaleMode, FLAGS_part_candidates,
(float)FLAGS_render_threshold, FLAGS_number_people_max, FLAGS_maximize_positives, FLAGS_fps_max,
FLAGS_prototxt_path, FLAGS_caffemodel_path, enableGoogleLogging};
opWrapperT.configure(wrapperStructPose);
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial_add_module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ foreach(EXAMPLE_FILE ${EXAMPLE_FILES})

message(STATUS "Adding Example ${EXE_NAME}")
add_executable(${EXE_NAME} ${EXAMPLE_FILE})
target_link_libraries(${EXE_NAME} openpose_src ${examples_3rdparty_libraries})
target_link_libraries(${EXE_NAME} openpose ${examples_3rdparty_libraries})

if (WIN32)
set_property(TARGET ${EXE_NAME} PROPERTY FOLDER "Examples/Tutorial/AddModule")
Expand Down
Loading

0 comments on commit 4151a19

Please sign in to comment.