Skip to content

Commit

Permalink
Docker Image along with v2.1.0 (#309)
Browse files Browse the repository at this point in the history
* Delete .vscode

* Delete configure

* CLI.OperatorAPI

* CLI.Finished + Update.Inference.Doc

* Refine installation

format

Fix FAKE

Compatible => OpenCV3.2

CI => Compile OpenCV from source.

Accelerate CI

Accelerate CI

* Fix imshow logic

* Remove old docker codes

* Add docker files

* Enhance Docker

* Refine Dockerfile

* Optimize.Appearance

* New README

* Center.Align

* LOGO

* LOGO

* Refine.Doc
  • Loading branch information
ganler authored Aug 30, 2020
1 parent e2b819c commit c4df544
Show file tree
Hide file tree
Showing 21 changed files with 225 additions and 159 deletions.
5 changes: 4 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
docker/*.deb
.git
*build*
data
3rdparty
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ docs/make.bat
examples/user_codes/*.cpp
debug.*

!logo.png
!docs/Makefile
!docs/markdown/images/*
!docs/markdown/images/*
50 changes: 50 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Dockerfile

# docker build .

# Based on CUDA11.0 & CuDNN8
FROM nvidia/cuda:10.2-devel-ubuntu18.04

# Install Non-GPU Dependencies.
RUN apt update --allow-unauthenticated && version="7.0.0-1+cuda10.2" ; \
apt install -y \
libnvinfer7=${version} libnvonnxparsers7=${version} libnvparsers7=${version} \
libnvinfer-plugin7=${version} libnvinfer-dev=${version} libnvonnxparsers-dev=${version} \
libnvparsers-dev=${version} libnvinfer-plugin-dev=${version} python-libnvinfer=${version} \
python3-libnvinfer=${version} && \
apt-mark hold \
libnvinfer7 libnvonnxparsers7 libnvparsers7 libnvinfer-plugin7 libnvinfer-dev libnvonnxparsers-dev libnvparsers-dev libnvinfer-plugin-dev python-libnvinfer python3-libnvinfer

# Install OpenCV Dependencies
RUN apt install -y software-properties-common || apt install -y software-properties-common && \
add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main" && \
APT_DEPS="git cmake libgtk-3-dev libavcodec-dev libavformat-dev libswscale-dev libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev x264 v4l-utils python3-dev python3-pip libcanberra-gtk-module libcanberra-gtk3-module" && \
apt install -y $APT_DEPS || apt install -y $APT_DEPS && \
python3 -m pip install numpy

# Compile OpenCV
RUN git clone --branch 4.4.0 https://github.com/opencv/opencv.git && \
cd opencv && mkdir build && cd build && \
cmake .. -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DWITH_TBB=ON \
-DWITH_V4L=ON \
-DBUILD_TESTS=OFF \
-DBUILD_OPENCV_PYTHON3=OFF && \
make -j && make install

# Install HyperPose Dependencies
RUN apt install -y python3-dev python3-pip subversion libgflags-dev

COPY . /hyperpose

# Download related data
RUN for file in $(find /hyperpose/scripts -type f -iname 'download*.sh'); do sh $file; done

# Build Repo
RUN cd hyperpose && mkdir build && cd build && \
cmake .. -DCMAKE_BUILD_TYPE=Release && make -j

WORKDIR /hyperpose/build

ENTRYPOINT ["./hyperpose-cli"]
80 changes: 60 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
# HyperPose
</a>
<p align="center">
<img src="./docs/markdown/images/logo.png", width="800">
</p>

[![Documentation Status](https://readthedocs.org/projects/hyperpose/badge/?version=latest)](https://hyperpose.readthedocs.io/en/latest/?badge=latest)
<p align="center">
<a href="https://readthedocs.org/projects/hyperpose/badge/?version=latest" title="Docs Building"><img src="https://readthedocs.org/projects/hyperpose/badge/?version=latest"></a>
<a href="https://github.com/tensorlayer/hyperpose/actions?query=workflow%3ACI" title="Build Status"><img src="https://github.com/tensorlayer/hyperpose/workflows/CI/badge.svg"></a>
<a href="https://hub.docker.com/repository/docker/tensorlayer/hyperpose" title="Docker"><img src="https://img.shields.io/docker/image-size/tensorlayer/hyperpose"></a>
<a href="https://drive.google.com/drive/folders/1w9EjMkrjxOmMw3Rf6fXXkiv_ge7M99jR?usp=sharing" title="PreTrainedModels"><img src="https://img.shields.io/badge/trained%20models-GoogleDrive-brightgreen.svg"></a>
<a href="https://en.cppreference.com/w/cpp/17" title="CppStandard"><img src="https://img.shields.io/badge/C++-17-blue.svg?style=flat&logo=c%2B%2B"></a>
<a href="https://github.com/tensorlayer/hyperpose/graphs/commit-activity" title="Maintenance"><img src="https://img.shields.io/badge/maintained%3F-YES-brightgreen.svg"></a>
<a href="https://github.com/tensorlayer/tensorlayer/blob/master/LICENSE.rst" title="TensorLayer"><img src="https://img.shields.io/github/license/tensorlayer/tensorlayer">
</p>

HyperPose is a library for building human pose estimation systems that can efficiently operate in the wild.
---

> **News**: The PoseProposal inference model is released! See the HyperPose models on [Google Drive](https://drive.google.com/drive/folders/1w9EjMkrjxOmMw3Rf6fXXkiv_ge7M99jR?usp=sharing).
<p align="center">
<a href="#Features">Features</a> •
<a href="#Documentation">Documentation</a> •
<a href="#Quick-Start-with-Docker">Quick-Start with Docker</a> •
<a href="#Performance">Performance</a> •
<a href="#License">License</a>
</p>

HyperPose is a library for building human pose estimation systems that can efficiently operate in the wild.

## Features

Expand All @@ -13,42 +32,63 @@ HyperPose has two key features, which are not available in existing libraries:
- **Flexible training platform**: HyperPose provides flexible Python APIs to build many useful pose estimation models (e.g., OpenPose and PoseProposalNetwork). HyperPose users can, for example, customize data augmentation, use parallel GPUs for training, and replace deep neural networks (e.g., changing from ResNet to MobileNet), thus building models specific to their real-world scenarios.
- **High-performance pose estimation**: HyperPose achieves real-time pose estimation though a high-performance pose estimation engine. This engine implements numerous system optimizations: pipeline parallelism, model inference with TensorRT, CPU/GPU hybrid scheduling, and many others. This allows HyperPose to run 4x faster than OpenPose and 10x faster than TF-Pose.

## Get Started
## Documentation

You can install HyperPose(Python Training Library, C++ inference Library) and learn its APIs through [HyperPose Documentation](https://hyperpose.readthedocs.io/en/latest/).

You can install HyperPose and learn its APIs through [Documentation](https://hyperpose.readthedocs.io/en/latest/).
## Quick-Start with Docker

## Example
The official docker image is on [DockerHub](https://hub.docker.com/r/tensorlayer/hyperpose).

We provide an example to show human pose estimation achieved by HyperPose. You need to install CUDA Toolkit 10+, TensorRT 7+, OpenCV 3.2+ and gFlags (cmake version), and enable C++ 17 support. Once the prerequisite are met, run the following script:
Make sure you have [docker](https://docs.docker.com/get-docker/) with [nvidia-docker](https://github.com/NVIDIA/nvidia-docker) functionality installed.

> Also note that your nvidia driver should be [compatible](https://docs.nvidia.com/deploy/cuda-compatibility/index.html#support-title) with CUDA10.2.
```bash
sudo apt -y install git cmake build-essential subversion libgflags-dev libopencv-dev
git clone https://github.com/tensorlayer/hyperpose.git && cd hyperpose
sh scripts/download-test-data.sh # Install data for examples.
sh scripts/download-tinyvgg-model.sh # Install tiny-vgg model.
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release && cmake --build . # Build library && examples.
./hyperpose-cli # The ouput images will be in the build folder.
# [Example 1]: Doing inference on given video, copy the output.avi to the local path.
docker run --name quick-start --gpus all tensorlayer/hyperpose --runtime=stream
docker cp quick-start:/hyperpose/build/output.avi .
docker rm quick-start


# [Example 2](X11 server required to see the imshow window): Real-time inference.
# You may need to install X11 server locally:
# sudo apt install xorg openbox xauth
xhost +; docker run --rm --gpus all -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix tensorlayer/hyperpose --imshow


# [Example 3]: Camera + imshow window
xhost +; docker run --name pose-camera --rm --gpus all -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --device=/dev/video0:/dev/video0 tensorlayer/hyperpose --source=camera --imshow
# To quit this image, please type `docker kill pose-camera` in another terminal.


# [Dive into the image]
xhost +; docker run --rm --gpus all -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --device=/dev/video0:/dev/video0 --entrypoint /bin/bash tensorlayer/hyperpose
# For users that cannot access a camera or X11 server. You may also use:
# docker run --rm --gpus all -it --entrypoint /bin/bash tensorlayer/hyperpose
```

> For more details, please check [here](https://hyperpose.readthedocs.io/en/latest/markdown/quick_start/prediction.html#table-of-flags-for-hyperpose-cli).
## Performance

We compare the prediction performance of HyperPose with [OpenPose 1.6](https://github.com/CMU-Perceptual-Computing-Lab/openpose) and [TF-Pose](https://github.com/ildoonet/tf-pose-estimation). We implement the OpenPose algorithms with different configurations in HyperPose. The test-bed has Ubuntu18.04, 1070Ti GPU, Intel i7 CPU (12 logic cores). The test video is Crazy Updown Funk ([YouTube](https://www.youtube.com/watch?v=2DiQUX11YaY)). The HyperPose models (in the ONNX or Uff formats) are available [here](https://github.com/tensorlayer/pretrained-models/tree/master/models/hyperpose).
We compare the prediction performance of HyperPose with [OpenPose 1.6](https://github.com/CMU-Perceptual-Computing-Lab/openpose) and [TF-Pose](https://github.com/ildoonet/tf-pose-estimation). We implement the OpenPose algorithms with different configurations in HyperPose. The test-bed has Ubuntu18.04, 1070Ti GPU, Intel i7 CPU (12 logic cores).

| HyperPose Configuration | DNN Size | DNN Input Shape | HyerPose | Baseline |
| HyperPose Configuration | DNN Size | Input Size | HyerPose | Baseline |
| --------------- | ------------- | ------------------ | ------------------ | --------------------- |
| OpenPose (VGG) | 209.3MB | 656 x 368 | 27.32 FPS | 8 FPS (OpenPose) |
| OpenPose (TinyVGG) | 34.7 MB | 384 x 256 | 124.925 FPS | N/A |
| OpenPose (MobileNet) | 17.9 MB | 432 x 368 | 84.32 FPS | 8.5 FPS (TF-Pose) |
| OpenPose (ResNet18) | 45.0 MB | 432 x 368 | 62.52 FPS | N/A |

As we can see, HyperPose is the only library that can achieve **real-time** human pose estimation.

</a>
<p align="center">
<img src="https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/media/dance_foot.gif?raw=true", width="360">
<img src="./docs/markdown/images/demo-xbd.gif", width="600">
</p>

<p align="center">
新宝岛 with HyperPose(Lightweight OpenPose model)
</p>
## License

HyperPose is open-sourced under the [Apache 2.0 license](https://github.com/tensorlayer/tensorlayer/blob/master/LICENSE.rst).
Expand Down
5 changes: 0 additions & 5 deletions deps/apt.txt

This file was deleted.

14 changes: 0 additions & 14 deletions deps/check.sh

This file was deleted.

1 change: 0 additions & 1 deletion docker/.gitignore

This file was deleted.

10 changes: 0 additions & 10 deletions docker/Dockerfile.builder-cpu

This file was deleted.

7 changes: 0 additions & 7 deletions docker/Dockerfile.builder-cpu-ubuntu18

This file was deleted.

7 changes: 0 additions & 7 deletions docker/Dockerfile.builder-gpu

This file was deleted.

28 changes: 0 additions & 28 deletions docker/Dockerfile.tensorrt

This file was deleted.

17 changes: 0 additions & 17 deletions docker/Makefile

This file was deleted.

15 changes: 0 additions & 15 deletions docker/sources.list.bionic.ustc

This file was deleted.

15 changes: 0 additions & 15 deletions docker/sources.list.ustc

This file was deleted.

18 changes: 15 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,26 @@
Welcome to HyperPose's Documentation!
=====================================

Get Started
Installation
-----------
.. toctree::
:maxdepth: 1

markdown/design/design
markdown/install/prediction
markdown/install/training

Get Started
-----------
.. toctree::
:maxdepth: 1

markdown/quick_start/prediction
markdown/quick_start/training

Tutorials
-------------
.. toctree::
:maxdepth: 2
:maxdepth: 1

markdown/tutorial/prediction
markdown/tutorial/training
Expand All @@ -41,6 +46,13 @@ Performance and Supports
markdown/performance/supports
markdown/performance/prediction

Insights
------------------------
.. toctree::
:maxdepth: 1

markdown/design/design

Frequently Asked Questions(FAQs)
--------------------------------
.. toctree::
Expand Down
Binary file added docs/markdown/images/demo-xbd.gif
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 docs/markdown/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit c4df544

Please sign in to comment.