Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The C++ Inference Library of OpenPose-Plus v2.0.0 #249

Merged
merged 73 commits into from May 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
e7d919c
Modified download scripts, Added auto-format file
ganler Mar 8, 2020
df62909
1st commit about code refactorization
ganler Mar 16, 2020
3b9fcb7
Merge Master
ganler Mar 16, 2020
3e820e4
SwiftPose::Refactor::TensorRT part is done. Validation and other smal…
ganler Mar 22, 2020
949a38a
Fix@1 for inference part. Still cuda memcpy error there.
ganler Mar 22, 2020
55bd993
Fix script
ganler Mar 23, 2020
bd022a6
Merge from Master
ganler Mar 29, 2020
b2f3ad1
Simplify usage | Modify namespace and type names
ganler Mar 29, 2020
352d2ec
DNN Engine passed tests
ganler Mar 29, 2020
f05bf19
Fix DNN module
ganler Mar 29, 2020
0a1648a
Logger\
ganler Mar 29, 2020
31dfd44
Operator API finished
ganler Apr 9, 2020
47d39f3
Fix performance issue of operator API
ganler Apr 9, 2020
b446a26
Fix factor usage in nhwc to nchw
ganler Apr 19, 2020
318d016
Add thread_safe_queue
ganler Apr 19, 2020
41d3268
thread_safe_queue: replace copy to move in dump
ganler Apr 19, 2020
1c32112
Add test codes in comment of thread_safe_queue
ganler Apr 19, 2020
7f86a45
basic_stream_manager finished(test required)
ganler Apr 25, 2020
1dde2fd
Fix bug of lock from thread_safe_queue and add test module
ganler Apr 25, 2020
acecc27
Applied clang-format based on WebKit
ganler Apr 27, 2020
1fe7b34
Main code of stream API finished
ganler Apr 27, 2020
abe5937
format
ganler Apr 27, 2020
e1cccf4
Before fixing compilation(full example)
ganler Apr 28, 2020
e617ca5
Fix dead lock
ganler Apr 28, 2020
62572c2
Fix compilation. FIXME: return size of humans in stream API
ganler Apr 28, 2020
9c445f4
Fix strange return problem. Still got segmentation fault in cv::resize
ganler Apr 29, 2020
9c6e424
format
ganler Apr 29, 2020
7c841e7
Fixed joints and connections problem
ganler Apr 29, 2020
344a4bf
Example Stream API done. Clean up required.
ganler Apr 29, 2020
334fe38
Refactor done
ganler May 3, 2020
a26494e
Refactor done
ganler May 3, 2020
f60fb82
Fix gflags initialization
ganler May 3, 2020
98f061f
Format and doc for poseplus::dnn::tensorrt
ganler May 3, 2020
04e7847
Doxygen for paf
ganler May 3, 2020
dfb4e30
remove doc htmls
ganler May 3, 2020
6090d64
small fixes and found deadlock
ganler May 3, 2020
05f9b3b
Add ONNX support for tensorrt, build example of [uff+video+operator API]
ganler May 5, 2020
563869c
Format
ganler May 5, 2020
8ad2897
Proportion based human drawing
ganler May 5, 2020
f4e9922
add required apt packages
lgarithm May 7, 2020
ca0bc2f
prepare to deprecate Makefile
lgarithm May 7, 2020
24a96b9
./configure --prefix=$HOME/local/openpose-plus
lgarithm May 7, 2020
16a08e4
simplify feature_map_t
lgarithm May 7, 2020
2971a24
ln -s Makefile.old Makefile
lgarithm May 8, 2020
c7c242a
Merge pull request #250 from tensorlayer/lg-refactor
ganler May 8, 2020
51ce1e3
Merge from Master
ganler May 10, 2020
1704b18
Automate PAF resolution parameter.
ganler May 10, 2020
1d5c8f2
Format
ganler May 10, 2020
8d3e823
Remove redundant viz.cpp
ganler May 10, 2020
a8d266d
Add stream doc
ganler May 10, 2020
5218d30
Enhanced the docs with briefs
ganler May 10, 2020
5a2f1e9
Enhanced the docs with briefs
ganler May 10, 2020
09dbf40
Add docs & use createNetworkV2
ganler May 10, 2020
2d6353b
Format
ganler May 10, 2020
a042404
Refactored nvlog and examples.
ganler May 18, 2020
0f1ba81
Fix support for ONNX model
ganler May 19, 2020
ae6949e
Add checks for videowriter(which cannot work in opencv3.2)
ganler May 20, 2020
79698fd
Fix examples
ganler May 20, 2020
0304d6f
Passed Test for Original OpenPoseOnnx Model
ganler May 21, 2020
13fd658
Supported serialized TensorRT mdoel.
ganler May 22, 2020
74d9b4b
Moving source code to HyperPose
ganler May 31, 2020
c26ab9e
Add Cmake Flags: BUILD_EXAMPLES, BUILD_TESTS
ganler May 31, 2020
16b64b2
Init full documentations
ganler May 31, 2020
7a2c9e5
Add more documents
ganler May 31, 2020
7e97ea6
Update: docs && README
ganler May 31, 2020
d325ad7
Fix README
ganler May 31, 2020
cfc2a94
Fix README x 2
ganler May 31, 2020
2658e9d
Remove old doc
ganler May 31, 2020
41eb4c9
Merge branch 'master' into refactorization
lgarithm May 31, 2020
b52233d
update doc path
lgarithm May 31, 2020
ffa4186
disable tests
lgarithm May 31, 2020
1a453df
Format
ganler May 31, 2020
ef19b81
Modified README
ganler May 31, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
133 changes: 113 additions & 20 deletions .clang-format
@@ -1,22 +1,115 @@
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
# clang-format version 6.0.0 (tags/RELEASE_600/final)

AllowShortBlocksOnASingleLine: true
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true

IndentWidth: 4
BreakBeforeBraces: Linux
SortIncludes: true
# IncludeBlocks: true
# IncludeBlocks: IBS_Regroup # clang-format 8

---
Language: Cpp
# BasedOnStyle: WebKit
AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: false
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: All
BreakBeforeBraces: WebKit
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 0
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DerivePointerAlignment: false
PointerAlignment: Right

ColumnLimit: 80
SpacesBeforeTrailingComments: 2

ConstructorInitializerAllOnOneLineOrOnePerLine: true
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: false
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: Inner
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
RawStringFormats:
- Delimiters: [pb]
Language: TextProto
BasedOnStyle: google
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 8
UseTab: Never
...

# TODO: require one blank line between blocks
5 changes: 5 additions & 0 deletions .gitignore
Expand Up @@ -22,6 +22,7 @@ __pycache__
/lib
/tensorlayer
/vis
build
cmake_install.cmake
CMakeCache.txt
CMakeFiles
Expand All @@ -32,10 +33,14 @@ CPackConfig.cmake
CPackSourceConfig.cmake
CTestTestfile.cmake
inference/*png
install_manifest.txt
libstdtensor-prefix
libstdtracer-prefix
Makefile
test.py
Testing
third_party
venv
/doc
_build
docs/make.bat
4 changes: 2 additions & 2 deletions .readthedocs.yml
Expand Up @@ -4,7 +4,7 @@
version: 2

sphinx:
configuration: doc/conf.py
configuration: docs/conf.py
fail_on_warning: true

formats:
Expand All @@ -13,4 +13,4 @@ formats:
python:
version: 3.6
install:
- requirements: doc/requirements.txt
- requirements: docs/requirements.txt
27 changes: 14 additions & 13 deletions .travis.yml
Expand Up @@ -15,19 +15,20 @@ sudo: required

before_install:
- docker info
- sudo apt update
- 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
- ./scripts/install-pafprocess.sh
- ./scripts/download-test-data.sh
# - sudo apt update
# - 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
# - ./scripts/install-pafprocess.sh
# - ./scripts/download-test-data.sh

script:
- docker build --rm -t openpose-plus-test:snapshot -f docker/Dockerfile.travis-ci .
- docker run --rm -it openpose-plus-test:snapshot sh -c './configure --build-fake --with-trace && make && make test'
- python ./examples/example-inference-1.py --path-to-npz='' --images=$(ls data/media/*.jpg | sort | head -n 3 | tr '\n' ',') --base-model=vgg
- python ./examples/example-inference-1.py --path-to-npz='' --images=$(ls data/media/*.jpg | sort | head -n 3 | tr '\n' ',') --base-model=vggtiny
- python ./examples/example-inference-1.py --path-to-npz='' --images=$(ls data/media/*.jpg | sort | head -n 3 | tr '\n' ',') --base-model=mobilenet
- echo TODO
# - docker build --rm -t openpose-plus-test:snapshot -f docker/Dockerfile.travis-ci .
# - docker run --rm -it openpose-plus-test:snapshot sh -c './configure --build-fake --with-trace && make && make test'
# - python ./examples/example-inference-1.py --path-to-npz='' --images=$(ls data/media/*.jpg | sort | head -n 3 | tr '\n' ',') --base-model=vgg
# - python ./examples/example-inference-1.py --path-to-npz='' --images=$(ls data/media/*.jpg | sort | head -n 3 | tr '\n' ',') --base-model=vggtiny
# - python ./examples/example-inference-1.py --path-to-npz='' --images=$(ls data/media/*.jpg | sort | head -n 3 | tr '\n' ',') --base-model=mobilenet

- wget https://media.githubusercontent.com/media/tensorlayer/pretrained-models/master/models/hyperpose/hao28-pose345000.npz
- python ./examples/example-inference-1.py --path-to-npz='hao28-pose345000.npz' --images=$(ls data/media/*.jpg | sort | head -n 3 | tr '\n' ',') --base-model=hao28_experimental
# - wget https://media.githubusercontent.com/media/tensorlayer/pretrained-models/master/models/hyperpose/hao28-pose345000.npz
# - python ./examples/example-inference-1.py --path-to-npz='hao28-pose345000.npz' --images=$(ls data/media/*.jpg | sort | head -n 3 | tr '\n' ',') --base-model=hao28_experimental
28 changes: 17 additions & 11 deletions CMakeLists.txt
@@ -1,28 +1,34 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.5)
PROJECT(openpose-plus)
PROJECT(hyperpose)

SET(CMAKE_CXX_STANDARD 17)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)

INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
INCLUDE(cmake/3rdparty.cmake)

OPTION(WITH_TRACE "Build with tracing library." OFF)
OPTION(BUILD_FAKE "Build fake target without CUDA libraries." OFF)
OPTION(ENABLE_CUDA "Build with CUDA support." ON)
OPTION(BUILD_EXAMPLES "Build with examples." ON)
OPTION(BUILD_TESTS "Build with tests." ON)

IF(WITH_TRACE)
MESSAGE(STATUS "[OPENPOSE-PLUS] Trace Enabled.")
MESSAGE(STATUS "[HyperPose] Trace Enabled.")
ADD_DEFINITIONS(-DENABLE_TRACE)
ENDIF()

IF(BUILD_FAKE)
MESSAGE(STATUS "[OPENPOSE-PLUS] Fake Building Enabled.")
ADD_LIBRARY(openpose-plus src/fake_openpose_plus.cpp)
ELSE()
INCLUDE(cmake/openpose-plus.cmake)
INCLUDE(cmake/package.cmake)
INCLUDE(cmake/hyperpose.cmake)
INCLUDE(cmake/package.cmake)

IF(BUILD_EXAMPLES)
MESSAGE(STATUS "[HyperPose] Examples Building Enabled.")
INCLUDE(cmake/helpers.cmake)
INCLUDE(cmake/examples.cmake)
ENDIF()
INCLUDE(cmake/examples.cmake)

ENABLE_TESTING()
# TODO: add tests
IF(BUILD_TESTS)
MESSAGE(STATUS "[HyperPose] Tests Building Enabled.")
INCLUDE(cmake/helpers.cmake)
INCLUDE(cmake/tests.cmake)
ENDIF()
30 changes: 0 additions & 30 deletions Makefile

This file was deleted.

1 change: 1 addition & 0 deletions Makefile
2 changes: 1 addition & 1 deletion Makefile.config
@@ -1,4 +1,4 @@
BUILD_DIR = $(CURDIR)/cmake-build/$(shell uname)
BUILD_DIR = $(CURDIR)/cmake-build


ifeq ($(shell uname), Darwin)
Expand Down
31 changes: 31 additions & 0 deletions Makefile.old
@@ -0,0 +1,31 @@
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)

cmake_targets_with_trace:
mkdir -p $(BUILD_DIR)
cd $(BUILD_DIR); cmake -DWITH_TRACE=ON $(CMAKE_FLAGS) $(CURDIR)

build_with_cmake: cmake_targets
make -C $(BUILD_DIR) -j $(NPROC)

pack: cmake_targets
make -C $(BUILD_DIR) -j $(NPROC) package

pack_trace: cmake_targets_with_trace
make -C $(BUILD_DIR) -j $(NPROC) package

# Using Docker.
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 .