Skip to content

Commit e2b819c

Browse files
authored
Inference CLI (#308)
* 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
1 parent 33c168a commit e2b819c

34 files changed

Lines changed: 592 additions & 260 deletions

.github/workflows/ci.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-18.04
1010
strategy:
1111
matrix:
12-
python-version: [3.6, 3.7, 3.8]
12+
python-version: [3.7]
1313

1414
steps:
1515
- uses: actions/checkout@v2
@@ -19,8 +19,19 @@ jobs:
1919
python-version: ${{ matrix.python-version }}
2020
- name: Initialize Python Env
2121
run: python3 -m pip install --upgrade pip
22+
# - name: Build OpenCV from scratch
23+
# run: |
24+
# sudo apt install software-properties-common
25+
# sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
26+
# sudo apt update
27+
# sudo apt install git cmake libgtk2.0-dev libavcodec-dev libavformat-dev libswscale-dev libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
28+
# git clone --depth 1 --branch 4.4.0 https://github.com/opencv/opencv.git
29+
# cd opencv && mkdir build && cd build
30+
# cmake .. -DCMAKE_BUILD_TYPE=Release
31+
# cmake --build .
32+
# sudo make install
2233
- name: Install System Dependencies
23-
run: sudo apt-get install libopencv-dev libgflags-dev # dependencies
34+
run: sudo apt install libgflags-dev libopencv-dev # dependencies
2435
- name: Check download scripts.
2536
run: |
2637
sh scripts/download-test-data.sh

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ __pycache__
1111
*.out
1212
*.png
1313
*.uff
14+
.vscode/
1415
/3rdparty
1516
/bazel-*
1617
/bin

.vscode/settings.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ INCLUDE(cmake/3rdparty.cmake)
1313

1414
OPTION(WITH_TRACE "Build with tracing library." OFF)
1515
OPTION(BUILD_FAKE "Build fake target without CUDA libraries." OFF)
16+
OPTION(BUILD_CLI "Build HyperPose command line tool." ON)
1617
OPTION(BUILD_EXAMPLES "Build examples." ON)
1718
OPTION(BUILD_USER_CODES "Build user codes." ON)
1819
OPTION(BUILD_TESTS "Build tests." ON)
@@ -25,7 +26,7 @@ IF(WITH_TRACE)
2526
ENDIF()
2627

2728
IF(BUILD_LIB)
28-
MESSAGE("BUILD_LIB ${BUILD_LIB}")
29+
MESSAGE("[HyperPose] BUILD_LIB is ON.")
2930
IF(BUILD_FAKE)
3031
INCLUDE(cmake/hyperpose.fake.cmake)
3132
ELSE()
@@ -36,6 +37,11 @@ IF(BUILD_LIB)
3637
ENDIF()
3738
ENDIF()
3839

40+
IF(BUILD_CLI)
41+
MESSAGE("[HyperPose] BUILD_CLI is ON.")
42+
INCLUDE(cmake/cli.cmake)
43+
ENDIF()
44+
3945
IF(BUILD_EXAMPLES)
4046
MESSAGE(STATUS "[HyperPose] Examples Building Enabled.")
4147
INCLUDE(cmake/examples.cmake)

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ We provide an example to show human pose estimation achieved by HyperPose. You n
2323

2424
```bash
2525
sudo apt -y install git cmake build-essential subversion libgflags-dev libopencv-dev
26-
sh scripts/download-test-data.sh # Install data for examples.
27-
sh scripts/download-tinyvgg-model.sh # Install tiny-vgg model.
26+
git clone https://github.com/tensorlayer/hyperpose.git && cd hyperpose
27+
sh scripts/download-test-data.sh # Install data for examples.
28+
sh scripts/download-tinyvgg-model.sh # Install tiny-vgg model.
2829
mkdir build && cd build
29-
cmake .. -DCMAKE_BUILD_TYPE=RELEASE && make -j # Build library && examples.
30-
./example.operator_api_batched_images_paf # The ouput images will be in the build folder.
30+
cmake .. -DCMAKE_BUILD_TYPE=Release && cmake --build . # Build library && examples.
31+
./hyperpose-cli # The ouput images will be in the build folder.
3132
```
3233

3334
## Performance

cmake/cli.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
INCLUDE(${CMAKE_SOURCE_DIR}/cmake/helpers.cmake)
2+
3+
SET(CLI hyperpose-cli)
4+
SET(CLISRC ${CMAKE_SOURCE_DIR}/examples/cli.cpp)
5+
6+
MESSAGE(STATUS ">>> To build [CLI]: ${CLISRC} --> ${CLI}")
7+
ADD_EXECUTABLE(${CLI} ${CLISRC})
8+
TARGET_LINK_LIBRARIES(${CLI} helpers hyperpose gflags)
9+
ADD_GLOBAL_DEPS(${CLI})

cmake/examples.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ INCLUDE(${CMAKE_SOURCE_DIR}/cmake/helpers.cmake)
33
FILE(GLOB_RECURSE POSE_TESTS ${CMAKE_SOURCE_DIR}/examples/*.example.cpp)
44

55
foreach(EXAMPLE_FULL_PATH ${POSE_TESTS})
6-
MESSAGE(STATUS ">>> [EXAMPLE] TO BUILD ${EXAMPLE_FULL_PATH}")
76
GET_FILENAME_COMPONENT(EXAMPLE_NAME ${EXAMPLE_FULL_PATH} NAME_WE)
8-
97
SET(EXAMPLE_TAR example.${EXAMPLE_NAME})
8+
9+
MESSAGE(STATUS ">>> To build [EXAMPLE]: ${EXAMPLE_FULL_PATH} --> ${EXAMPLE_TAR}")
10+
1011
ADD_EXECUTABLE(${EXAMPLE_TAR} ${EXAMPLE_FULL_PATH})
1112
TARGET_LINK_LIBRARIES(${EXAMPLE_TAR} helpers hyperpose gflags)
1213
ADD_GLOBAL_DEPS(${EXAMPLE_TAR})

cmake/hyperpose.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set(POSE_LIB_NAME hyperpose)
33

44
# Dependencies(OpenCV & CUDA)
55
INCLUDE(cmake/cuda.cmake)
6-
FIND_PACKAGE(OpenCV)
6+
FIND_PACKAGE(OpenCV REQUIRED)
77

88
ADD_LIBRARY(
99
${POSE_LIB_NAME} # SHARED

cmake/tests.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ INCLUDE(${CMAKE_SOURCE_DIR}/cmake/helpers.cmake)
33
FILE(GLOB_RECURSE POSE_TESTS ${CMAKE_SOURCE_DIR}/examples/tests/*.test.cpp)
44

55
FOREACH(TEST_FULL_PATH ${POSE_TESTS})
6-
MESSAGE(STATUS ">>> [TEST] TO BUILD ${TEST_FULL_PATH}")
76
GET_FILENAME_COMPONENT(TEST_NAME ${TEST_FULL_PATH} NAME_WE)
87
# ~ NAME_WE means filename without directory | longest extension ~ See more
98
# details at
109
# https://cmake.org/cmake/help/v3.0/command/get_filename_component.html
1110

1211
SET(TEST_TAR test.${TEST_NAME})
12+
13+
MESSAGE(STATUS ">>> To build [TEST]: ${TEST_FULL_PATH} --> ${TEST_TAR}")
14+
1315
ADD_EXECUTABLE(${TEST_TAR} ${TEST_FULL_PATH} src/thread_pool.cpp)
1416
TARGET_LINK_LIBRARIES(${TEST_TAR} helpers)
1517
SET_PROPERTY(TARGET ${TEST_TAR} PROPERTY COMPILE_FLAGS "")

cmake/user_codes.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ INCLUDE(${CMAKE_SOURCE_DIR}/cmake/helpers.cmake)
33
FILE(GLOB_RECURSE USER_CODES ${CMAKE_SOURCE_DIR}/examples/user_codes/*.cpp)
44

55
foreach(USERCODE_FULL_PATH ${USER_CODES})
6-
MESSAGE(STATUS ">>> [USER CODES] TO BUILD ${USERCODE_FULL_PATH}")
76
GET_FILENAME_COMPONENT(USER_CODE_NAME ${USERCODE_FULL_PATH} NAME_WE)
87

98
SET(USER_CODE_TAR user.${USER_CODE_NAME})
9+
10+
MESSAGE(STATUS ">>> To build [USER CODES]: ${USERCODE_FULL_PATH} --> ${USER_CODE_TAR}")
11+
1012
ADD_EXECUTABLE(${USER_CODE_TAR} ${USERCODE_FULL_PATH})
1113
TARGET_LINK_LIBRARIES(${USER_CODE_TAR} helpers hyperpose gflags)
1214
ADD_GLOBAL_DEPS(${USER_CODE_TAR})

0 commit comments

Comments
 (0)