-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* init tensorRT * add makefiles * fix cmake * fix typo * profile * add a slow implementation of gauss smooth * fix cmake * Paf cpp (#61) * WIP * install libopencv-dev * remove python * optimize select_peak * cleanup header * use channel first * build in docker * optimize smooth * fix path * optimize resize_area * download-testdata.sh * fix * optimize max pool * optimize * draw results * pre allocate temp memory * remove unused files * move folder * remove duplicated files * rm unused file * flatten folder * mv * remove unused file * rm * fix cmake * rm * flatten folder * cleanup constants * simplify * fix yaml * create a docker image for building with CUDA * fix * fix missing dependencies * fix * add a cli tool * cleanup * add tf-runner interface * finish OpenposeRunnerImpl * export base model * use in-tree build * fix build * use CHANNEL FIRST! * cleanup debug log * support batch * update * cleanup * merge master * cleanup * update tests * remove debug code * remove bazel * remove debug code * rm * rm * fix test * fix test
- Loading branch information
Showing
41 changed files
with
1,966 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
docker/*.deb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,30 @@ | ||
# https://docs.travis-ci.com/user/languages/python/ | ||
language: python | ||
|
||
# https://docs.travis-ci.com/user/docker/ | ||
services: | ||
- docker | ||
|
||
python: | ||
- '3.6' | ||
- '2.7' | ||
- '3.6' | ||
- '2.7' | ||
|
||
sudo: required | ||
|
||
before_install: | ||
- sudo apt install -y swig | ||
- docker info | ||
- sudo apt install -y swig # FIXME: can't install libopencv-dev on travis CI | ||
- pip install -r requirements.txt | ||
- pip install pycocotools # must be installed after cython is installed | ||
- pip install git+https://github.com/tensorlayer/tensorlayer.git # TODO: create a latest release for TL | ||
- ./scripts/install-pafprocess.sh | ||
- ./scripts/download-test-data.sh | ||
|
||
script: | ||
- make docker-build | ||
- python ./test_inference.py --path-to-npz='' --images=$(ls data/media/*.jpg | sort | head -n 3 | tr '\n' ',') --base-model=vgg | ||
- python ./test_inference.py --path-to-npz='' --images=$(ls data/media/*.jpg | sort | head -n 3 | tr '\n' ',') --base-model=vggtiny | ||
- python ./test_inference.py --path-to-npz='' --images=$(ls data/media/*.jpg | sort | head -n 3 | tr '\n' ',') --base-model=mobilenet | ||
# TODO: reenable when data_format is supported in BN | ||
# - python ./test_inference.py --path-to-npz='' --images=$(ls data/media/*.jpg | sort | head -n 3 | tr '\n' ',') --base-model=hao28_experimental | ||
# TODO: add move tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
CMAKE_MINIMUM_REQUIRED(VERSION 3.5) | ||
PROJECT(openpose-plus) | ||
|
||
SET(CMAKE_CXX_STANDARD 11) | ||
INCLUDE(src/build.cmake) | ||
|
||
IF(DEFINED ENV{HAVE_CUDA}) | ||
INCLUDE(src/build-gpu.cmake) | ||
ENDIF() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
MAKEFILE ?= Makefile.config | ||
include $(MAKEFILE) | ||
|
||
default: build_with_cmake | ||
# default: docker-build-gpu | ||
|
||
cmake_targets: | ||
mkdir -p $(BUILD_DIR) | ||
cd $(BUILD_DIR); cmake $(CMAKE_FLAGS) $(CURDIR) | ||
|
||
build_with_cmake: cmake_targets | ||
make -C $(BUILD_DIR) -j $(NPROC) | ||
|
||
CPU_TAG = openpose-plus:builder | ||
docker-build: | ||
docker build --rm -t $(CPU_TAG) -f docker/Dockerfile.builder-cpu . | ||
|
||
GPU_TAG = openpose-plus:builder-gpu | ||
docker-build-gpu: | ||
docker build --rm -t $(GPU_TAG) -f docker/Dockerfile.builder-gpu . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
BUILD_DIR = $(CURDIR)/cmake-build/$(shell uname) | ||
|
||
|
||
ifeq ($(shell uname), Darwin) | ||
NPROC = $(shell sysctl -n hw.ncpu) | ||
else | ||
NPROC = $(shell nproc) | ||
endif | ||
|
||
|
||
CMAKE_FLAGS = \ | ||
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \ | ||
-DCMAKE_BUILD_TYPE=Release \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.deb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM ubuntu:xenial | ||
|
||
RUN apt update && \ | ||
apt install -y g++ cmake libopencv-dev libgflags-dev | ||
ADD . /openpose-plus | ||
WORKDIR /openpose-plus | ||
RUN make build_with_cmake | ||
RUN curl -sLOJ https://github.com/tensorlayer/fast-openpose/files/2378505/network-outputs.gz && \ | ||
gzip -d network-outputs.gz && \ | ||
tar -xf network-outputs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM tensorrt:snapshot | ||
|
||
RUN apt install -y g++ cmake libopencv-dev | ||
ADD . /openpose-plus | ||
WORKDIR /openpose-plus | ||
|
||
ENV HAVE_CUDA=1 | ||
RUN make build_with_cmake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FROM ubuntu:xenial | ||
|
||
ARG NVIDIA_CUDA_PREFIX=http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 | ||
ARG NVIDIA_ML_PREFIX=http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/ | ||
|
||
ARG CUDA_REPO=cuda-repo-ubuntu1604_9.0.176-1_amd64.deb | ||
ARG ML_REPO=nvidia-machine-learning-repo-ubuntu1604_1.0.0-1_amd64.deb | ||
ARG RT_REPO=nv-tensorrt-repo-ubuntu1604-cuda9.0-ga-trt4.0.1.6-20180612_1-1_amd64.deb | ||
|
||
ADD sources.list.ustc /etc/apt/sources.list | ||
RUN apt update && apt install -y curl && \ | ||
apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub | ||
|
||
RUN curl -sLOJ ${NVIDIA_CUDA_PREFIX}/${CUDA_REPO} && \ | ||
curl -sLOJ ${NVIDIA_ML_PREFIX}/${ML_REPO} && \ | ||
dpkg -i ${CUDA_REPO} && \ | ||
dpkg -i ${ML_REPO} | ||
|
||
ADD ${RT_REPO} /tmp/ | ||
RUN dpkg -i /tmp/${RT_REPO} \ | ||
&& apt update | ||
|
||
RUN apt install -y \ | ||
libnvinfer-dev=4.1.2-1+cuda9.0 \ | ||
cuda-cudart-dev-9-0=9.0.176-1 \ | ||
cuda-libraries-dev-9-0 | ||
|
||
RUN apt install -y g++ cmake libopencv-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
TAG = tensorrt:snapshot | ||
|
||
TENSORRT_REPO_DEB = nv-tensorrt-repo-ubuntu1604-cuda9.0-ga-trt4.0.1.6-20180612_1-1_amd64.deb | ||
|
||
tensorrt-image: $(TENSORRT_REPO_DEB) | ||
docker build --rm -t $(TAG) -f Dockerfile.tensorrt . | ||
|
||
$(TENSORRT_REPO_DEB): | ||
cp ~/Downloads/$(TENSORRT_REPO_DEB) . | ||
|
||
run: | ||
docker run --rm -it $(TAG) bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted | ||
|
||
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted | ||
|
||
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial universe | ||
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates universe | ||
|
||
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial multiverse | ||
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates multiverse | ||
|
||
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse | ||
|
||
deb http://mirrors.ustc.edu.cn/ubuntu xenial-security main restricted | ||
deb http://mirrors.ustc.edu.cn/ubuntu xenial-security universe | ||
deb http://mirrors.ustc.edu.cn/ubuntu xenial-security multiverse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
export HAVE_CUDA=1 | ||
|
||
make | ||
|
||
D=$HOME/var/data/openpose/126 | ||
|
||
# IMAGE=$HOME/Downloads/new-tests/cam0_27.png | ||
IMAGES=$D/cam2_3938.png,$D/cam1_2386.png | ||
|
||
# MODEL_FILE=$HOME/Downloads/vgg.uff | ||
MODEL_FILE=$HOME/Downloads/vggtiny.uff | ||
|
||
./cmake-build/$(uname -s)/uff-runner_main \ | ||
--model_file=${MODEL_FILE} \ | ||
--image_files=${IMAGES} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/pafprocess |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# FIXME: use TARGET_LINK_DIRECTORIES and TARGET_INCLUDE_DIRECTORIES | ||
LINK_DIRECTORIES(/usr/local/cuda-9.0/targets/x86_64-linux/lib) | ||
INCLUDE_DIRECTORIES(/usr/local/cuda-9.0/targets/x86_64-linux/include | ||
/usr/local/cuda-9.0/targets/x86_64-linux/include/crt) | ||
|
||
ADD_EXECUTABLE(uff-runner_main | ||
${CMAKE_CURRENT_LIST_DIR}/uff-runner.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/tracer.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/uff-runner_main.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/cuda_buffer.cpp) | ||
TARGET_LINK_LIBRARIES(uff-runner_main input_image paf vis gflags nvinfer cudart nvparsers) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FIND_PACKAGE(opencv) | ||
FIND_PACKAGE(gflags) | ||
|
||
|
||
ADD_LIBRARY(input_image ${CMAKE_CURRENT_LIST_DIR}/input.cpp) | ||
TARGET_LINK_LIBRARIES(input_image opencv_core opencv_imgproc opencv_highgui) | ||
|
||
ADD_LIBRARY(paf | ||
${CMAKE_CURRENT_LIST_DIR}/paf.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/post-process.cpp) | ||
TARGET_LINK_LIBRARIES(paf opencv_core opencv_imgproc opencv_highgui) | ||
|
||
ADD_LIBRARY(vis ${CMAKE_CURRENT_LIST_DIR}/vis.cpp) | ||
TARGET_LINK_LIBRARIES(vis opencv_core opencv_imgproc opencv_highgui) | ||
|
||
ADD_EXECUTABLE(fake-runner | ||
${CMAKE_CURRENT_LIST_DIR}/fake_uff-runner.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/tracer.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/uff-runner_main.cpp) | ||
TARGET_LINK_LIBRARIES(fake-runner input_image paf vis gflags) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#pragma once | ||
#include <utility> | ||
#include <vector> | ||
|
||
constexpr int COCO_N_PARTS = 18; | ||
constexpr int COCO_N_PAIRS = 19; | ||
|
||
using idx_pair_t = std::pair<int, int>; | ||
using coco_pair_list_t = std::vector<idx_pair_t>; | ||
|
||
const coco_pair_list_t COCOPAIRS_NET = { | ||
{12, 13}, // 6 | ||
{20, 21}, // 10 | ||
{14, 15}, // 7 | ||
{16, 17}, // 8 | ||
{22, 23}, // 11 | ||
{24, 25}, // 12 | ||
{0, 1}, // 0 | ||
{2, 3}, // 1 | ||
{4, 5}, // 2 | ||
{6, 7}, // 3 | ||
{8, 9}, // 4 | ||
{10, 11}, // 5 | ||
{28, 29}, // 14 | ||
{30, 31}, // 15 | ||
{34, 35}, // 17 | ||
{32, 33}, // 16 | ||
{36, 37}, // 18 | ||
{18, 19}, // 9 | ||
{26, 27}, // 13 | ||
}; | ||
|
||
const coco_pair_list_t COCOPAIRS = { | ||
{1, 2}, // 6 | ||
{1, 5}, // 10 | ||
{2, 3}, // 7 | ||
{3, 4}, // 8 | ||
{5, 6}, // 11 | ||
{6, 7}, // 12 | ||
{1, 8}, // 0 | ||
{8, 9}, // 1 | ||
{9, 10}, // 2 | ||
{1, 11}, // 3 | ||
{11, 12}, // 4 | ||
{12, 13}, // 5 | ||
{1, 0}, // 14 | ||
{0, 14}, // 15 | ||
{14, 16}, // 17 | ||
{0, 15}, // 16 | ||
{15, 17}, // 18 | ||
{2, 16}, // * 9 | ||
{5, 17}, // * 13 | ||
}; | ||
|
||
inline bool is_virtual_pair(int pair_id) { return pair_id > 16; } |
Oops, something went wrong.