From c0b3fc9708439c89863bf910dedb66ba2f3609f6 Mon Sep 17 00:00:00 2001 From: gineshidalgo99 Date: Thu, 3 Jan 2019 13:47:19 -0500 Subject: [PATCH] Ubuntu fixes for TX2 --- .travis.yml | 2 +- .../Makefile.config.Ubuntu16_cuda8_JetsonTX2 | 0 ...file.config.Ubuntu16_cuda9_JetsonTX2_caffe | 2 +- ...e.config.Ubuntu16_cuda9_JetsonTX2_openpose | 0 .../ubuntu}/Makefile.example | 4 +- .../install_caffe_JetsonTX2_JetPack3.3.sh | 0 ...caffe_and_openpose_JetsonTX2_JetPack3.1.sh | 4 +- ...caffe_and_openpose_JetsonTX2_JetPack3.3.sh | 8 ++-- {ubuntu => 3rdparty/ubuntu}/install_cuda.sh | 6 ++- {ubuntu => 3rdparty/ubuntu}/install_cudnn.sh | 3 +- .../install_openpose_JetsonTX2_JetPack3.1.sh | 6 +-- .../install_openpose_JetsonTX2_JetPack3.3.sh | 6 +-- 3rdparty/ubuntu/install_ubuntu_deps.sh | 16 ++++++++ .../ubuntu/install_ubuntu_deps_and_cuda.sh | 12 ++++++ .../Makefile.config.Ubuntu14_cuda7.example | 0 .../Makefile.config.Ubuntu14_cuda8.example | 0 .../Makefile.config.Ubuntu16_cuda7.example | 0 .../Makefile.config.Ubuntu16_cuda8.example | 0 .../install_caffe_and_openpose_if_cuda8.sh | 4 +- .../install_openpose_if_cuda8.sh | 8 ++-- 3rdparty/windows/getSpinnaker.bat | 22 +++++++++++ doc/installation.md | 8 ++-- doc/installation_deprecated.md | 8 ++-- ... => installation_jetson_tx2_jetpack3.1.md} | 4 +- doc/installation_jetson_tx2_jetpack3.3.md | 4 +- doc/modules/calibration_module.md | 5 ++- doc/release_notes.md | 3 ++ .../calibration/cameraParameterEstimation.cpp | 37 ++++++++++--------- ubuntu/install_cmake.sh | 34 ----------------- 29 files changed, 118 insertions(+), 88 deletions(-) rename {ubuntu => 3rdparty/ubuntu}/Makefile.config.Ubuntu16_cuda8_JetsonTX2 (100%) rename {ubuntu => 3rdparty/ubuntu}/Makefile.config.Ubuntu16_cuda9_JetsonTX2_caffe (98%) rename {ubuntu => 3rdparty/ubuntu}/Makefile.config.Ubuntu16_cuda9_JetsonTX2_openpose (100%) rename {ubuntu_deprecated => 3rdparty/ubuntu}/Makefile.example (98%) rename {ubuntu => 3rdparty/ubuntu}/install_caffe_JetsonTX2_JetPack3.3.sh (100%) rename {ubuntu => 3rdparty/ubuntu}/install_caffe_and_openpose_JetsonTX2_JetPack3.1.sh (97%) rename {ubuntu => 3rdparty/ubuntu}/install_caffe_and_openpose_JetsonTX2_JetPack3.3.sh (80%) rename {ubuntu => 3rdparty/ubuntu}/install_cuda.sh (75%) mode change 100755 => 100644 rename {ubuntu => 3rdparty/ubuntu}/install_cudnn.sh (65%) mode change 100755 => 100644 rename {ubuntu => 3rdparty/ubuntu}/install_openpose_JetsonTX2_JetPack3.1.sh (93%) mode change 100755 => 100644 rename {ubuntu => 3rdparty/ubuntu}/install_openpose_JetsonTX2_JetPack3.3.sh (93%) create mode 100644 3rdparty/ubuntu/install_ubuntu_deps.sh create mode 100644 3rdparty/ubuntu/install_ubuntu_deps_and_cuda.sh rename {ubuntu_deprecated => 3rdparty/ubuntu_deprecated}/Makefile.config.Ubuntu14_cuda7.example (100%) rename {ubuntu_deprecated => 3rdparty/ubuntu_deprecated}/Makefile.config.Ubuntu14_cuda8.example (100%) rename {ubuntu_deprecated => 3rdparty/ubuntu_deprecated}/Makefile.config.Ubuntu16_cuda7.example (100%) rename {ubuntu_deprecated => 3rdparty/ubuntu_deprecated}/Makefile.config.Ubuntu16_cuda8.example (100%) rename {ubuntu_deprecated => 3rdparty/ubuntu_deprecated}/install_caffe_and_openpose_if_cuda8.sh (91%) rename {ubuntu_deprecated => 3rdparty/ubuntu_deprecated}/install_openpose_if_cuda8.sh (91%) create mode 100644 3rdparty/windows/getSpinnaker.bat rename doc/{installation_jetson_tx2.md => installation_jetson_tx2_jetpack3.1.md} (95%) delete mode 100755 ubuntu/install_cmake.sh diff --git a/.travis.yml b/.travis.yml index 575f96cd..ef5ce0b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,7 +29,7 @@ addons: # Build your code e.g. by calling make script: - - ./ubuntu/install_cmake.sh + - ./3rdparty/ubuntu/install_ubuntu_deps_and_cuda.sh - sudo apt-get -y install libatlas-base-dev - sudo apt-get -y install libopencv-dev - pip install --upgrade numpy diff --git a/ubuntu/Makefile.config.Ubuntu16_cuda8_JetsonTX2 b/3rdparty/ubuntu/Makefile.config.Ubuntu16_cuda8_JetsonTX2 similarity index 100% rename from ubuntu/Makefile.config.Ubuntu16_cuda8_JetsonTX2 rename to 3rdparty/ubuntu/Makefile.config.Ubuntu16_cuda8_JetsonTX2 diff --git a/ubuntu/Makefile.config.Ubuntu16_cuda9_JetsonTX2_caffe b/3rdparty/ubuntu/Makefile.config.Ubuntu16_cuda9_JetsonTX2_caffe similarity index 98% rename from ubuntu/Makefile.config.Ubuntu16_cuda9_JetsonTX2_caffe rename to 3rdparty/ubuntu/Makefile.config.Ubuntu16_cuda9_JetsonTX2_caffe index 6f89509d..8c86b565 100644 --- a/ubuntu/Makefile.config.Ubuntu16_cuda9_JetsonTX2_caffe +++ b/3rdparty/ubuntu/Makefile.config.Ubuntu16_cuda9_JetsonTX2_caffe @@ -101,7 +101,7 @@ PYTHON_LIB := /usr/lib /usr/local/lib # Whatever else you find you need goes here. INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial -LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/aarch64-linux-gnu /usr/lib/aarch64-linux-gnu/hdf5/serial +LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/aarch64-linux-gnu /usr/lib/aarch64-linux-gnu/hdf5/serial # If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies # INCLUDE_DIRS += $(shell brew --prefix)/include diff --git a/ubuntu/Makefile.config.Ubuntu16_cuda9_JetsonTX2_openpose b/3rdparty/ubuntu/Makefile.config.Ubuntu16_cuda9_JetsonTX2_openpose similarity index 100% rename from ubuntu/Makefile.config.Ubuntu16_cuda9_JetsonTX2_openpose rename to 3rdparty/ubuntu/Makefile.config.Ubuntu16_cuda9_JetsonTX2_openpose diff --git a/ubuntu_deprecated/Makefile.example b/3rdparty/ubuntu/Makefile.example similarity index 98% rename from ubuntu_deprecated/Makefile.example rename to 3rdparty/ubuntu/Makefile.example index d3fbc022..27eb4fda 100644 --- a/ubuntu_deprecated/Makefile.example +++ b/3rdparty/ubuntu/Makefile.example @@ -212,7 +212,9 @@ ifeq ($(USE_OPENCV), 1) LIBRARIES += opencv_core opencv_highgui opencv_imgproc opencv_objdetect opencv_video opencv_calib3d ifeq ($(OPENCV_VERSION), 3) - LIBRARIES += opencv_imgcodecs opencv_videoio opencv_cudawarping + LIBRARIES += opencv_imgcodecs opencv_videoio + # Cuda warping removed for TX2 compatibility (PR #989) + # LIBRARIES += opencv_imgcodecs opencv_videoio opencv_cudawarping else LIBRARIES += opencv_contrib opencv_gpu endif diff --git a/ubuntu/install_caffe_JetsonTX2_JetPack3.3.sh b/3rdparty/ubuntu/install_caffe_JetsonTX2_JetPack3.3.sh similarity index 100% rename from ubuntu/install_caffe_JetsonTX2_JetPack3.3.sh rename to 3rdparty/ubuntu/install_caffe_JetsonTX2_JetPack3.3.sh diff --git a/ubuntu/install_caffe_and_openpose_JetsonTX2_JetPack3.1.sh b/3rdparty/ubuntu/install_caffe_and_openpose_JetsonTX2_JetPack3.1.sh similarity index 97% rename from ubuntu/install_caffe_and_openpose_JetsonTX2_JetPack3.1.sh rename to 3rdparty/ubuntu/install_caffe_and_openpose_JetsonTX2_JetPack3.1.sh index 6ac1dc63..57639c4c 100644 --- a/ubuntu/install_caffe_and_openpose_JetsonTX2_JetPack3.1.sh +++ b/3rdparty/ubuntu/install_caffe_and_openpose_JetsonTX2_JetPack3.1.sh @@ -23,7 +23,7 @@ function executeShInItsFolder { # $1 = sh file name # $2 = folder where the sh file is # $3 = folder to go back - cd $2 + cd $2 exitIfError sudo chmod +x $1 exitIfError @@ -41,7 +41,7 @@ exitIfError -executeShInItsFolder "install_openpose_JetsonTX2_JetPack3.1.sh" "./ubuntu" "./" +executeShInItsFolder "install_openpose_JetsonTX2_JetPack3.1.sh" "./3rdparty/ubuntu/" "./" exitIfError diff --git a/ubuntu/install_caffe_and_openpose_JetsonTX2_JetPack3.3.sh b/3rdparty/ubuntu/install_caffe_and_openpose_JetsonTX2_JetPack3.3.sh similarity index 80% rename from ubuntu/install_caffe_and_openpose_JetsonTX2_JetPack3.3.sh rename to 3rdparty/ubuntu/install_caffe_and_openpose_JetsonTX2_JetPack3.3.sh index 0ecadd32..63244e61 100644 --- a/ubuntu/install_caffe_and_openpose_JetsonTX2_JetPack3.3.sh +++ b/3rdparty/ubuntu/install_caffe_and_openpose_JetsonTX2_JetPack3.3.sh @@ -23,7 +23,7 @@ function executeShInItsFolder { # $1 = sh file name # $2 = folder where the sh file is # $3 = folder to go back - cd $2 + cd $2 exitIfError sudo chmod +x $1 exitIfError @@ -36,14 +36,14 @@ function executeShInItsFolder { rm -r ./3rdparty/caffe git submodule update --init --recursive -mv ./ubuntu/install_caffe_JetsonTX2_JetPack3.3.sh ./3rdparty/caffe/install_caffe_JetsonTX2_JetPack3.3.sh -mv ./ubuntu/Makefile.config.Ubuntu16_cuda9_JetsonTX2_caffe ./3rdparty/caffe/Makefile.config.Ubuntu16_cuda9_JetsonTX2_caffe +mv ./3rdparty/ubuntu/install_caffe_JetsonTX2_JetPack3.3.sh ./3rdparty/caffe/install_caffe_JetsonTX2_JetPack3.3.sh +mv ./3rdparty/ubuntu/Makefile.config.Ubuntu16_cuda9_JetsonTX2_caffe ./3rdparty/caffe/Makefile.config.Ubuntu16_cuda9_JetsonTX2_caffe executeShInItsFolder "install_caffe_JetsonTX2_JetPack3.3.sh" "./3rdparty/caffe" "../.." exitIfError -executeShInItsFolder "install_openpose_JetsonTX2_JetPack3.3.sh" "./ubuntu" "./" +executeShInItsFolder "install_openpose_JetsonTX2_JetPack3.3.sh" "./3rdparty/ubuntu/" "./" exitIfError diff --git a/ubuntu/install_cuda.sh b/3rdparty/ubuntu/install_cuda.sh old mode 100755 new mode 100644 similarity index 75% rename from ubuntu/install_cuda.sh rename to 3rdparty/ubuntu/install_cuda.sh index 16ce7cad..9f14c494 --- a/ubuntu/install_cuda.sh +++ b/3rdparty/ubuntu/install_cuda.sh @@ -1,5 +1,8 @@ #!/bin/bash +echo "NOTE: This script assumes Ubuntu 16 or 14 and Nvidia Graphics card up to 10XX. Otherwise, install it by yourself or it will fail." + +# Install CUDA 8.0 ubuntu_version="$(lsb_release -r)" sudo apt-get update && sudo apt-get install wget -y --no-install-recommends if [[ $ubuntu_version == *"14."* ]]; then @@ -10,4 +13,5 @@ elif [[ $ubuntu_version == *"16."* ]]; then sudo dpkg --install cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb fi sudo apt-get update -sudo apt-get install cuda +sudo apt-get install cuda-8-0 +# sudo apt-get install cuda diff --git a/ubuntu/install_cudnn.sh b/3rdparty/ubuntu/install_cudnn.sh old mode 100755 new mode 100644 similarity index 65% rename from ubuntu/install_cudnn.sh rename to 3rdparty/ubuntu/install_cudnn.sh index ce9cffe1..1d09f533 --- a/ubuntu/install_cudnn.sh +++ b/3rdparty/ubuntu/install_cudnn.sh @@ -1,7 +1,8 @@ #!/bin/bash +echo "NOTE: This script assumes Ubuntu 16 or 14 and Nvidia Graphics card up to 10XX. Otherwise, install it by yourself or it will fail." + # Install cuDNN 5.1 -ubuntu_version="$(lsb_release -r)" CUDNN_URL="http://developer.download.nvidia.com/compute/redist/cudnn/v5.1/cudnn-8.0-linux-x64-v5.1.tgz" wget -c ${CUDNN_URL} sudo tar -xzf cudnn-8.0-linux-x64-v5.1.tgz -C /usr/local diff --git a/ubuntu/install_openpose_JetsonTX2_JetPack3.1.sh b/3rdparty/ubuntu/install_openpose_JetsonTX2_JetPack3.1.sh old mode 100755 new mode 100644 similarity index 93% rename from ubuntu/install_openpose_JetsonTX2_JetPack3.1.sh rename to 3rdparty/ubuntu/install_openpose_JetsonTX2_JetPack3.1.sh index bd594d1f..9eac19c2 --- a/ubuntu/install_openpose_JetsonTX2_JetPack3.1.sh +++ b/3rdparty/ubuntu/install_openpose_JetsonTX2_JetPack3.1.sh @@ -51,10 +51,10 @@ echo "" echo "------------------------- Compiling OpenPose -------------------------" # Go back to main folder -cd .. +cd ../.. # Copy Makefile & Makefile.config -cp ubuntu/Makefile.example Makefile -cp ubuntu/Makefile.config.Ubuntu16_cuda8_JetsonTX2 Makefile.config +cp 3rdparty/ubuntu/Makefile.example Makefile +cp 3rdparty/ubuntu/Makefile.config.Ubuntu16_cuda8_JetsonTX2 Makefile.config # Compile OpenPose make all -j$NUM_CORES exitIfError diff --git a/ubuntu/install_openpose_JetsonTX2_JetPack3.3.sh b/3rdparty/ubuntu/install_openpose_JetsonTX2_JetPack3.3.sh similarity index 93% rename from ubuntu/install_openpose_JetsonTX2_JetPack3.3.sh rename to 3rdparty/ubuntu/install_openpose_JetsonTX2_JetPack3.3.sh index ed0bf6b8..671692e8 100644 --- a/ubuntu/install_openpose_JetsonTX2_JetPack3.3.sh +++ b/3rdparty/ubuntu/install_openpose_JetsonTX2_JetPack3.3.sh @@ -51,10 +51,10 @@ echo "" echo "------------------------- Compiling OpenPose -------------------------" # Go back to main folder -cd .. +cd ../.. # Copy Makefile & Makefile.config -cp ubuntu/Makefile.example_openpose Makefile -cp ubuntu/Makefile.config.Ubuntu16_cuda9_JetsonTX2_openpose Makefile.config +cp 3rdparty/ubuntu/Makefile.example_openpose Makefile +cp 3rdparty/ubuntu/Makefile.config.Ubuntu16_cuda9_JetsonTX2_openpose Makefile.config # Compile OpenPose make all -j$NUM_CORES exitIfError diff --git a/3rdparty/ubuntu/install_ubuntu_deps.sh b/3rdparty/ubuntu/install_ubuntu_deps.sh new file mode 100644 index 00000000..3b19422b --- /dev/null +++ b/3rdparty/ubuntu/install_ubuntu_deps.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +### INSTALL PREREQUISITES + +# Basic +sudo apt-get --assume-yes update +sudo apt-get --assume-yes install build-essential +# General dependencies +sudo apt-get --assume-yes install libatlas-base-dev libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compiler +sudo apt-get --assume-yes install --no-install-recommends libboost-all-dev +# Remaining dependencies, 14.04 +sudo apt-get --assume-yes install libgflags-dev libgoogle-glog-dev liblmdb-dev +# Python libs +sudo -H pip install --upgrade numpy protobuf +# OpenCV 2.4 -> Added as option +# sudo apt-get --assume-yes install libopencv-dev diff --git a/3rdparty/ubuntu/install_ubuntu_deps_and_cuda.sh b/3rdparty/ubuntu/install_ubuntu_deps_and_cuda.sh new file mode 100644 index 00000000..e4254dca --- /dev/null +++ b/3rdparty/ubuntu/install_ubuntu_deps_and_cuda.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +### INSTALL PREREQUISITES + +# Install CUDA 8.0 +bash install_cuda.sh + +# Install cuDNN 5.1 +bash install_cudnn.sh + +# Caffe prerequisites +bash install_ubuntu_deps.sh diff --git a/ubuntu_deprecated/Makefile.config.Ubuntu14_cuda7.example b/3rdparty/ubuntu_deprecated/Makefile.config.Ubuntu14_cuda7.example similarity index 100% rename from ubuntu_deprecated/Makefile.config.Ubuntu14_cuda7.example rename to 3rdparty/ubuntu_deprecated/Makefile.config.Ubuntu14_cuda7.example diff --git a/ubuntu_deprecated/Makefile.config.Ubuntu14_cuda8.example b/3rdparty/ubuntu_deprecated/Makefile.config.Ubuntu14_cuda8.example similarity index 100% rename from ubuntu_deprecated/Makefile.config.Ubuntu14_cuda8.example rename to 3rdparty/ubuntu_deprecated/Makefile.config.Ubuntu14_cuda8.example diff --git a/ubuntu_deprecated/Makefile.config.Ubuntu16_cuda7.example b/3rdparty/ubuntu_deprecated/Makefile.config.Ubuntu16_cuda7.example similarity index 100% rename from ubuntu_deprecated/Makefile.config.Ubuntu16_cuda7.example rename to 3rdparty/ubuntu_deprecated/Makefile.config.Ubuntu16_cuda7.example diff --git a/ubuntu_deprecated/Makefile.config.Ubuntu16_cuda8.example b/3rdparty/ubuntu_deprecated/Makefile.config.Ubuntu16_cuda8.example similarity index 100% rename from ubuntu_deprecated/Makefile.config.Ubuntu16_cuda8.example rename to 3rdparty/ubuntu_deprecated/Makefile.config.Ubuntu16_cuda8.example diff --git a/ubuntu_deprecated/install_caffe_and_openpose_if_cuda8.sh b/3rdparty/ubuntu_deprecated/install_caffe_and_openpose_if_cuda8.sh similarity index 91% rename from ubuntu_deprecated/install_caffe_and_openpose_if_cuda8.sh rename to 3rdparty/ubuntu_deprecated/install_caffe_and_openpose_if_cuda8.sh index 6f6b9078..337a8d2a 100644 --- a/ubuntu_deprecated/install_caffe_and_openpose_if_cuda8.sh +++ b/3rdparty/ubuntu_deprecated/install_caffe_and_openpose_if_cuda8.sh @@ -23,7 +23,7 @@ function executeShInItsFolder { # $1 = sh file name # $2 = folder where the sh file is # $3 = folder to go back - cd $2 + cd $2 exitIfError sudo chmod +x $1 exitIfError @@ -41,7 +41,7 @@ exitIfError -executeShInItsFolder "install_openpose_if_cuda8.sh" "./ubuntu" "./" +executeShInItsFolder "install_openpose_if_cuda8.sh" "./3rdparty/ubuntu_deprecated/" "./" exitIfError diff --git a/ubuntu_deprecated/install_openpose_if_cuda8.sh b/3rdparty/ubuntu_deprecated/install_openpose_if_cuda8.sh similarity index 91% rename from ubuntu_deprecated/install_openpose_if_cuda8.sh rename to 3rdparty/ubuntu_deprecated/install_openpose_if_cuda8.sh index c020cd90..bfbe1715 100644 --- a/ubuntu_deprecated/install_openpose_if_cuda8.sh +++ b/3rdparty/ubuntu_deprecated/install_openpose_if_cuda8.sh @@ -63,13 +63,13 @@ echo "" echo "------------------------- Compiling OpenPose -------------------------" # Go back to main folder -cd .. +cd ../.. # Copy Makefile & Makefile.config -cp ubuntu/Makefile.example Makefile +cp 3rdparty/ubuntu/Makefile.example Makefile if [[ $ubuntu_le_14 == true ]]; then - cp ubuntu/Makefile.config.Ubuntu14_cuda8.example Makefile.config + cp 3rdparty/ubuntu_deprecated/Makefile.config.Ubuntu14_cuda8.example Makefile.config else - cp ubuntu/Makefile.config.Ubuntu16_cuda8.example Makefile.config + cp 3rdparty/ubuntu_deprecated/Makefile.config.Ubuntu16_cuda8.example Makefile.config fi # Compile OpenPose make all -j$NUM_CORES diff --git a/3rdparty/windows/getSpinnaker.bat b/3rdparty/windows/getSpinnaker.bat new file mode 100644 index 00000000..685943c4 --- /dev/null +++ b/3rdparty/windows/getSpinnaker.bat @@ -0,0 +1,22 @@ +:: Avoid printing all the comments in the Windows cmd +@echo off + +SET UNZIP_EXE=unzip\unzip.exe +SET WGET_EXE=wget\wget.exe + +:: Download temporary zip +echo ----- Downloading Caffe ----- +SET SPINNAKER_FOLDER=spinnaker\ +SET ZIP_NAME=spinnaker_2018_01_24.zip +SET ZIP_FULL_PATH=%SPINNAKER_FOLDER%%ZIP_NAME% +%WGET_EXE% -c http://posefs1.perception.cs.cmu.edu/OpenPose/3rdparty/windows/%ZIP_NAME% -P %SPINNAKER_FOLDER% +echo: + +echo ----- Unzipping Caffe ----- +%UNZIP_EXE% %ZIP_FULL_PATH% +echo: + +:: echo ----- Deleting Temporary Zip File %ZIP_FULL_PATH% ----- +:: del "%ZIP_FULL_PATH%" + +echo ----- Caffe Downloaded and Unzipped ----- diff --git a/doc/installation.md b/doc/installation.md index 7d37dcec..2334b53b 100644 --- a/doc/installation.md +++ b/doc/installation.md @@ -39,7 +39,7 @@ This installation section is only intended if you plan to modify the OpenPose co - **Ubuntu** 14 and 16. - **Windows** 8 and 10. - **Mac OSX** Mavericks and above. -- **Nvidia Jetson TX2**, installation instructions in [doc/installation_jetson_tx2.md](./installation_jetson_tx2.md). +- **Nvidia Jetson TX2**, 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). - 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. @@ -125,14 +125,14 @@ Any problem installing OpenPose? Check [doc/faq.md](./faq.md) and/or post a GitH 4. Nvidia GPU version prerequisites: 1. **Note: OpenPose has been tested extensively with CUDA 8.0 and cuDNN 5.1**. We highly recommend using those versions to minimize potential installation issues. Other versions should also work, but we do not provide support about any CUDA/cuDNN installation/compilation issue, as well as problems relate dto their integration into OpenPose. 2. [**CUDA 8**](https://developer.nvidia.com/cuda-80-ga2-download-archive): - - Ubuntu: Run `sudo ubuntu/install_cuda.sh` or alternatively download and install it from their website. + - Ubuntu: Run `sudo 3rdparty/ubuntu/install_cuda.sh` (if Ubuntu 16 or 14 and for Graphic cards up to 10XX) or alternatively download and install it from their website. - Windows: Install CUDA 8.0 after Visual Studio 2015 is installed to assure that the CUDA installation will generate all necessary files for VS. If CUDA was already installed, re-install it. - **Important installation tips**: - New Nvidia model GPUs (e.g., Nvidia V, GTX 2080, any Nvidia with Volta or Turing architecture, etc.) require at least CUDA 9. - (Windows issue, reported Sep 2018): If your computer hangs when installing CUDA drivers, try installing first the [Nvidia drivers](http://www.nvidia.com/Download/index.aspx), and then installing CUDA without the Graphics Driver flag. - (Windows): If CMake returns and error message similar to `CUDA_TOOLKIT_ROOT_DIR not found or specified` or any other CUDA component missing, then: 1) Re-install Visual Studio 2015; 2) Reboot your PC; 3) Re-install CUDA. 3. [**cuDNN 5.1**](https://developer.nvidia.com/rdp/cudnn-archive): - - Ubuntu: Run `sudo ubuntu/install_cudnn.sh` or alternatively download and install it from their website. + - Ubuntu: Run `sudo 3rdparty/ubuntu/install_cudnn.sh` (if Ubuntu 16 or 14 and for Graphic cards up to 10XX) or alternatively download and install it from their website. - Windows (and Ubuntu if manual installation): In order to manually install it, just unzip it and copy (merge) the contents on the CUDA folder, usually `/usr/local/cuda/` in Ubuntu and `C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0` in Windows. 5. AMD GPU version prerequisites: 1. Download official AMD drivers for Windows from [**AMD - Windows**](https://support.amd.com/en-us/download). @@ -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 ./ubuntu/install_cmake.sh`. + - Caffe prerequisites: By default, OpenPose uses Caffe under the hood. If you have not used Caffe previously, install its dependencies by running `sudo bash ./3rdparty/ubuntu/install_ubuntu_deps_and_cuda.sh` (if Ubuntu 16 or 14 and for Graphic cards up to 10XX) or run `sudo bash ./3rdparty/ubuntu/install_ubuntu_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: diff --git a/doc/installation_deprecated.md b/doc/installation_deprecated.md index 586ad115..8a7e49b7 100644 --- a/doc/installation_deprecated.md +++ b/doc/installation_deprecated.md @@ -54,7 +54,7 @@ CUDA, cuDNN, OpenCV and Atlas must be already installed on your machine: ### Installation - Script Compilation Build Caffe & the OpenPose library + download the required Caffe models for Ubuntu 14.04 or 16.04 (auto-detected for the script) and CUDA 8: ```bash -bash ./ubuntu/install_caffe_and_openpose_if_cuda8.sh +bash ./3rdparty/ubuntu_deprecated/install_caffe_and_openpose_if_cuda8.sh ``` **Highly important**: This script only works with CUDA 8 and Ubuntu 14 or 16. Otherwise, see [doc/installation.md](installation.md) or [Installation - Manual Compilation](#installation---manual-compilation). @@ -81,9 +81,9 @@ Alternatively to the script installation, if you want to use CUDA 7, avoid using cd ../../models/ bash ./getModels.sh # It just downloads the Caffe trained models cd .. - cp ubuntu/Makefile.example Makefile + cp 3rdparty/ubuntu/Makefile.example Makefile # Same file cp command as the one used for Caffe - cp ubuntu/Makefile.config.Ubuntu14_cuda7.example Makefile.config + cp 3rdparty/ubuntu_deprecated/Makefile.config.Ubuntu14_cuda7.example Makefile.config # Change any custom flag from the resulting Makefile.config (e.g., OpenCV 3, Atlas/OpenBLAS/MKL, etc.) make all -j`nproc` ``` @@ -97,7 +97,7 @@ Alternatively to the script installation, if you want to use CUDA 7, avoid using make clean make all -j$(NUM_CORES) ``` -**Highly important**: There are 2 `Makefile.config.Ubuntu##.example` analogous files, one in the main folder and one in [3rdparty/caffe/](../3rdparty/caffe/), corresponding to OpenPose and Caffe configuration files respectively. Any change must be done to both files (e.g., OpenCV 3 flag, Atlab/OpenBLAS/MKL flag, etc.). E.g., for CUDA 8 and Ubuntu16: [3rdparty/caffe/Makefile.config.Ubuntu16_cuda8.example](../3rdparty/caffe/Makefile.config.Ubuntu16.example) and [ubuntu/Makefile.config.Ubuntu16_cuda8.example](../ubuntu/Makefile.config.Ubuntu16_cuda8.example). +**Highly important**: There are 2 `Makefile.config.Ubuntu##.example` analogous files, one in the main folder and one in [3rdparty/caffe/](../3rdparty/caffe/), corresponding to OpenPose and Caffe configuration files respectively. Any change must be done to both files (e.g., OpenCV 3 flag, Atlab/OpenBLAS/MKL flag, etc.). E.g., for CUDA 8 and Ubuntu16: [3rdparty/caffe/Makefile.config.Ubuntu16_cuda8.example](../3rdparty/caffe/Makefile.config.Ubuntu16.example) and [3rdparty/ubuntu_deprecated/Makefile.config.Ubuntu16_cuda8.example](../3rdparty/ubuntu_deprecated/Makefile.config.Ubuntu16_cuda8.example). diff --git a/doc/installation_jetson_tx2.md b/doc/installation_jetson_tx2_jetpack3.1.md similarity index 95% rename from doc/installation_jetson_tx2.md rename to doc/installation_jetson_tx2_jetpack3.1.md index 508dea75..63e68cc1 100644 --- a/doc/installation_jetson_tx2.md +++ b/doc/installation_jetson_tx2_jetpack3.1.md @@ -31,7 +31,7 @@ Notes: ## Installation Use the following script for installation of both caffe and OpenPose: ``` -./ubuntu/install_caffe_and_openpose_JetsonTX2_JetPack3.1.sh +./3rdparty/ubuntu/install_caffe_and_openpose_JetsonTX2_JetPack3.1.sh ``` @@ -45,4 +45,4 @@ To activate hand or face resolution please complete this command with the follow ``` --hand -hand_net_resolution 256x256 --face -face_net_resolution 256x256 -``` +``` diff --git a/doc/installation_jetson_tx2_jetpack3.3.md b/doc/installation_jetson_tx2_jetpack3.3.md index 822427ed..5535d781 100644 --- a/doc/installation_jetson_tx2_jetpack3.3.md +++ b/doc/installation_jetson_tx2_jetpack3.3.md @@ -31,7 +31,7 @@ Notes: ## Installation Use the following script for installation of both caffe and OpenPose: ``` -./ubuntu/install_caffe_and_openpose_JetsonTX2_JetPack3.3.sh +./3rdparty/ubuntu/install_caffe_and_openpose_JetsonTX2_JetPack3.3.sh ``` @@ -45,4 +45,4 @@ To activate hand or face resolution please complete this command with the follow ``` --hand -hand_net_resolution 256x256 --face -face_net_resolution 256x256 -``` \ No newline at end of file +``` diff --git a/doc/modules/calibration_module.md b/doc/modules/calibration_module.md index 7f22cb37..2b5a77b4 100644 --- a/doc/modules/calibration_module.md +++ b/doc/modules/calibration_module.md @@ -135,13 +135,14 @@ Examples: :: Ceres-compatible version not implemented for Windows yet. Make a pull request if you have a working version in Windows. ``` 5. Hint to verify extrinsic calibration is successful: - 1. Translation vector - Global distance: + 1. Our final reprojection error (after rescaling) for the bundle adjustment step is usually about 0.1-0.15 pixels. + 2. Translation vector - Global distance: 1. Manually open each one of the generated XML files from the folder indicated by the flag `--camera_parameter_path` (or the default one indicated by the `--help` flag if the former was not used). 2. The field `CameraMatrix` is a 3 x 4 matrix (you can see that the subfield `rows` in that file is 3 and `cols` is 4). 3. Order the matrix in that 3 x 4 shape (e.g., by copying in a different text file with the shape of 3 rows and 4 columns). 4. The 3 first components of the last column of the `CameraMatrix` field define the global `translation` (in meters) with respect to the global origin (in our case camera 1). 5. Thus, the distance between that camera and the origin camera 1 should be (approximately) equal to the L2-norm of the `translation` vector. - 2. Translation vector - Relative x-y-z distances: + 3. Translation vector - Relative x-y-z distances: 1. The 3x1 `translation` vector represents the `x`, `y`, and `z` distances to the origin camera, respectively. The camera is looking along the positive `z` axis, the `y` axis is down, and the `x` axis is right. This should match the real distance between both cameras. diff --git a/doc/release_notes.md b/doc/release_notes.md index 653c44cb..db4f8c63 100644 --- a/doc/release_notes.md +++ b/doc/release_notes.md @@ -299,6 +299,8 @@ OpenPose Library - Release Notes 3. Added bundle adjustment refinement for camera extrinsic calibration. 4. Added `CameraMatrixInitial` field into the XML calibration files to keep the information of the original camera extrinsic parameters when bundle adjustment is run. 27. Video with the 3D output can be saved with the new `--write_video_3d` flag. + 28. Added Mac OpenCL compatibility. + 29. Added documentation for Nvidia TX2 with JetPack 3.3. 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. @@ -319,6 +321,7 @@ OpenPose Library - Release Notes 5. Fixed bug in `KeepTopNPeople` that could provoke segmentation fault for `number_people_max` > 1. 6. Camera parameter reader can now take folder paths even if they are not finished in `/` (e.g., `~/Desktop/` worked but `~/Desktop` did not). 7. 3D module: If the image area was smaller than HD resolution image area, the 3D keypoints were not properly estimated. + 8. OpenCL fixes. diff --git a/src/openpose/calibration/cameraParameterEstimation.cpp b/src/openpose/calibration/cameraParameterEstimation.cpp index 1d192f4f..4cb1aebb 100644 --- a/src/openpose/calibration/cameraParameterEstimation.cpp +++ b/src/openpose/calibration/cameraParameterEstimation.cpp @@ -1193,7 +1193,7 @@ namespace op } #if defined(USE_CERES) && defined(USE_EIGEN) - double computeReprojectionError( + double computeReprojectionErrorInPixels( const std::vector>& points2DVectorsExtrinsic, const Eigen::MatrixXd& BAValid, const Eigen::Matrix& points3D, const std::vector cameraExtrinsics, const std::vector cameraIntrinsics, const bool verbose = true) @@ -1405,7 +1405,7 @@ namespace op try { // Outlier removal - auto reprojectionError = computeReprojectionError( + auto reprojectionError = computeReprojectionErrorInPixels( points2DVectorsExtrinsic, BAValid, points3D, cameraExtrinsics, cameraIntrinsics, false); auto reprojectionErrorPrevious = reprojectionError+1; while (reprojectionError != reprojectionErrorPrevious) @@ -1416,12 +1416,12 @@ namespace op removeOutliersReprojectionError( points2DVectorsExtrinsic, BAValid, points3D, cameraExtrinsics, cameraIntrinsics, errorThreshold); - reprojectionError = computeReprojectionError( + reprojectionError = computeReprojectionErrorInPixels( points2DVectorsExtrinsic, BAValid, points3D, cameraExtrinsics, cameraIntrinsics); // Verbose log("Reprojection Error (after outlier removal iteration): " - + std::to_string(reprojectionError) + ",\twith error threshold of " - + std::to_string(errorThreshold) + ".", Priority::High); + + std::to_string(reprojectionError) + " pixels,\twith error threshold of " + + std::to_string(errorThreshold) + " pixels.", Priority::High); } } catch (const std::exception& e) @@ -1925,10 +1925,10 @@ namespace op extrinsics.at(x, y) = rotation(x, y); refinedExtrinsics[cameraIndex] = extrinsics; } - const auto reprojectionError = computeReprojectionError( + const auto reprojectionError = computeReprojectionErrorInPixels( points2DVectorsExtrinsic, BAValid, points3D, refinedExtrinsics, cameraIntrinsics); - log("Reprojection Error (after Bundle Adjustment): " + std::to_string(reprojectionError), - Priority::High); + log("Reprojection Error (after Bundle Adjustment): " + std::to_string(reprojectionError) + + " pixels.", Priority::High); } catch (const std::exception& e) { @@ -1963,7 +1963,8 @@ namespace op const int startIndex = startPerFrame + t * numberCorners; const int endPerFrame = x + 1 + y * gridInnerCorners.x; const int endIndex = endPerFrame + t * numberCorners; - if (BAValid.col(startIndex).any() && BAValid.col(endIndex).any()) // These points are used for BA, must have been constructed. + // These points are used for BA, must have been constructed. + if (BAValid.col(startIndex).any() && BAValid.col(endIndex).any()) { const double length = (points3D.col(startIndex) - points3D.col(endIndex)).norm(); sumSquareLength += length * length; @@ -1983,7 +1984,8 @@ namespace op const int startIndex = startPerFrame + t * numberCorners; const int endPerFrame = x + (y + 1) * gridInnerCorners.x; const int endIndex = endPerFrame + t * numberCorners; - if (BAValid.col(startIndex).any() && BAValid.col(endIndex).any()) // These points are used for BA, must have been constructed. + // These points are used for BA, must have been constructed. + if (BAValid.col(startIndex).any() && BAValid.col(endIndex).any()) { const double length = (points3D.col(startIndex) - points3D.col(endIndex)).norm(); sumSquareLength += length * length; @@ -1996,10 +1998,10 @@ namespace op } } const double scalingFactor = 0.001f * gridSquareSizeMm * sumLength / sumSquareLength; - log("Scaling factor: " + std::to_string(scalingFactor) + ",\tMin grid length: " + std::to_string(minLength) - + ",\tMax grid length: " + std::to_string(maxLength), Priority::High); - // Scale extrinsics - for (auto cameraIndex = 1; cameraIndex < numberCameras; cameraIndex++) // scale the translation (and the 3D point) + log("Scaling factor: " + std::to_string(scalingFactor) + ",\tMin grid length: " + + std::to_string(minLength) + ",\tMax grid length: " + std::to_string(maxLength), Priority::High); + // Scale extrinsics: Scale the translation (and the 3D point) + for (auto cameraIndex = 1; cameraIndex < numberCameras; cameraIndex++) { refinedExtrinsics[cameraIndex].at(0, 3) *= scalingFactor; refinedExtrinsics[cameraIndex].at(1, 3) *= scalingFactor; @@ -2008,9 +2010,10 @@ namespace op // Scale 3D points points3D *= scalingFactor; // Final reprojection error - const auto reprojectionError = computeReprojectionError( + const auto reprojectionError = computeReprojectionErrorInPixels( points2DVectorsExtrinsic, BAValid, points3D, refinedExtrinsics, cameraIntrinsics); - log("Reprojection Error (after rescaling): " + std::to_string(reprojectionError), Priority::High); + log("Reprojection Error (after rescaling): " + std::to_string(reprojectionError) + " pixels.", + Priority::High); } catch (const std::exception& e) { @@ -2032,7 +2035,7 @@ namespace op // Initial reprojection error if (printInitialReprojection) { - const auto reprojectionError = computeReprojectionError( + const auto reprojectionError = computeReprojectionErrorInPixels( points2DVectorsExtrinsic, BAValid, points3D, refinedExtrinsics, cameraIntrinsics); log("Reprojection Error (initial): " + std::to_string(reprojectionError), Priority::High); log(" ", Priority::High); diff --git a/ubuntu/install_cmake.sh b/ubuntu/install_cmake.sh deleted file mode 100755 index 82de7c7c..00000000 --- a/ubuntu/install_cmake.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -### INSTALL PREREQUISITES - -ubuntu_version="$(lsb_release -r)" -sudo apt-get update && sudo apt-get install wget -y --no-install-recommends -if [[ $ubuntu_version == *"14."* ]]; then - wget -c "https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda-repo-ubuntu1404-8-0-local-ga2_8.0.61-1_amd64-deb" - sudo dpkg --install cuda-repo-ubuntu1404-8-0-local-ga2_8.0.61-1_amd64-deb -elif [[ $ubuntu_version == *"16."* ]]; then - wget -c "https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb" - sudo dpkg --install cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb -fi -sudo apt-get update -sudo apt-get install cuda-8-0 - -# Install cuDNN 5.1 -CUDNN_URL="http://developer.download.nvidia.com/compute/redist/cudnn/v5.1/cudnn-8.0-linux-x64-v5.1.tgz" -wget -c ${CUDNN_URL} -sudo tar -xzf cudnn-8.0-linux-x64-v5.1.tgz -C /usr/local -rm cudnn-8.0-linux-x64-v5.1.tgz && sudo ldconfig - -# Basic -sudo apt-get --assume-yes update -sudo apt-get --assume-yes install build-essential -# General dependencies -sudo apt-get --assume-yes install libatlas-base-dev libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compiler -sudo apt-get --assume-yes install --no-install-recommends libboost-all-dev -# Remaining dependencies, 14.04 -sudo apt-get --assume-yes install libgflags-dev libgoogle-glog-dev liblmdb-dev -# Python libs -sudo -H pip install --upgrade numpy protobuf -# OpenCV 2.4 -> Added as option -# sudo apt-get --assume-yes install libopencv-dev