提交 f7ea3b90 编写于 作者: G Gines Hidalgo

Added doc about cli tools

上级 2268242e
......@@ -104,24 +104,61 @@ endif (WIN32)
# C++ additional flags
if (CMAKE_COMPILER_IS_GNUCXX)
message(STATUS "GCC detected, adding compile flags")
# set(OP_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -Wpedantic -Wall -Wextra -Wfatal-errors")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
set(OP_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpedantic -Wall -Wextra -Wfatal-errors")
# set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -Wpedantic -Wall -Wextra -Wfatal-errors")
endif (CMAKE_COMPILER_IS_GNUCXX)
# Select the Enhanced Instruction Set
set(INSTRUCTION_SET NONE CACHE STRING "Enable Enhanced Instruction Set")
set_property(CACHE INSTRUCTION_SET PROPERTY STRINGS NONE SSE4 AVX)
if (${INSTRUCTION_SET} MATCHES "SSE4")
add_definitions("-DWITH_SSE4")
set(SIMD_FLAGS "${SIMD_FLAGS} -msse4.1")
endif (${INSTRUCTION_SET} MATCHES "SSE4")
if (${INSTRUCTION_SET} MATCHES "AVX")
add_definitions("-DWITH_AVX")
# Select the Enhanced Instruction Set
set(INSTRUCTION_SET NONE CACHE STRING "Enable Enhanced Instruction Set")
set_property(CACHE INSTRUCTION_SET PROPERTY STRINGS NONE AVX2)
if (${INSTRUCTION_SET} MATCHES "AVX2")
add_definitions("-DWITH_AVX")
endif (${INSTRUCTION_SET} MATCHES "AVX2")
# Windows
if (WIN32)
# Suboptions for Enhanced Instruction Set
if (${INSTRUCTION_SET} MATCHES "AVX2")
add_definitions("/arch:AVX2")
endif (${INSTRUCTION_SET} MATCHES "AVX2")
# Ubuntu
else (WIN32) # if (CMAKE_COMPILER_IS_GNUCXX)
if (${INSTRUCTION_SET} MATCHES "AVX2")
set(SIMD_FLAGS "${SIMD_FLAGS} -mavx")
endif (${INSTRUCTION_SET} MATCHES "AVX")
endif (${INSTRUCTION_SET} MATCHES "AVX2")
message(STATUS "GCC detected, adding compile flags")
set(OP_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SIMD_FLAGS} -fopenmp -Wpedantic -Wall -Wextra -Wfatal-errors")
endif (CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SIMD_FLAGS}")
endif (WIN32)
# if (CMAKE_COMPILER_IS_GNUCXX)
# set_property(CACHE INSTRUCTION_SET PROPERTY STRINGS NONE SSE4 AVX)
# if (${INSTRUCTION_SET} MATCHES "SSE4")
# add_definitions("-DWITH_SSE4")
# set(SIMD_FLAGS "${SIMD_FLAGS} -msse4.1")
# endif (${INSTRUCTION_SET} MATCHES "SSE4")
# if (${INSTRUCTION_SET} MATCHES "AVX2")
# add_definitions("-DWITH_AVX")
# set(SIMD_FLAGS "${SIMD_FLAGS} -mavx")
# endif (${INSTRUCTION_SET} MATCHES "AVX")
# message(STATUS "GCC detected, adding compile flags")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SIMD_FLAGS}")
# endif (CMAKE_COMPILER_IS_GNUCXX)
# if (WIN32)
# # set_property(CACHE INSTRUCTION_SET PROPERTY STRINGS NONE SSE SSE2 AVX AVX2 IA32)
# # Suboptions for Enhanced Instruction Set
# if (${INSTRUCTION_SET} MATCHES "SSE")
# add_definitions("/arch:SSE")
# elseif (${INSTRUCTION_SET} MATCHES "SSE2")
# add_definitions("/arch:SSE2")
# elseif (${INSTRUCTION_SET} MATCHES "AVX")
# add_definitions("/arch:AVX")
# elseif (${INSTRUCTION_SET} MATCHES "AVX2")
# add_definitions("/arch:AVX2")
# elseif (${INSTRUCTION_SET} MATCHES "IA32")
# add_definitions("/arch:IA32")
# endif (${INSTRUCTION_SET} MATCHES "SSE")
# endif (WIN32)
### PROJECT OPTIONS
......@@ -139,25 +176,6 @@ if (${DL_FRAMEWORK} MATCHES "CAFFE")
add_definitions(-DUSE_CAFFE)
endif (${DL_FRAMEWORK} MATCHES "CAFFE")
if (WIN32)
# Select the Enhanced Instruction Set
set(INSTRUCTION_SET NONE CACHE STRING "Enable Enhanced Instruction Set")
set_property(CACHE INSTRUCTION_SET PROPERTY STRINGS NONE SSE SSE2 AVX AVX2 IA32)
# Suboptions for Enhanced Instruction Set
if (${INSTRUCTION_SET} MATCHES "SSE")
add_definitions("/arch:SSE")
elseif (${INSTRUCTION_SET} MATCHES "SSE2")
add_definitions("/arch:SSE2")
elseif (${INSTRUCTION_SET} MATCHES "AVX")
add_definitions("/arch:AVX")
elseif (${INSTRUCTION_SET} MATCHES "AVX2")
add_definitions("/arch:AVX2")
elseif (${INSTRUCTION_SET} MATCHES "IA32")
add_definitions("/arch:IA32")
endif (${INSTRUCTION_SET} MATCHES "SSE")
endif (WIN32)
# Set the acceleration library
if (APPLE)
set(GPU_MODE CPU_ONLY CACHE STRING "Select the acceleration GPU library or CPU otherwise.")
......
......@@ -3,7 +3,10 @@ OpenPose Demo - Overview
Forget about the OpenPose library code, just compile the library and use the demo `./build/examples/openpose/openpose.bin`.
In order to learn how to use it, run `./build/examples/openpose/openpose.bin --help` in your bash and read all the available flags (check only the flags for `examples/openpose/openpose.cpp` itself, i.e., the section `Flags from examples/openpose/openpose.cpp:`). We detail some of them in the following sections.
In order to learn how to use it, run `./build/examples/openpose/openpose.bin --help` in your favorite command-line interface tool and read all the available flags (check only the flags for `examples/openpose/openpose.cpp` itself, i.e., the section `Flags from examples/openpose/openpose.cpp:`). We detail some of them in the following sections.
In Ubuntu, Mac, and other Unix systems, use any command-line interface, such as `Terminal` or `Terminator`. In Windows, open the `PowerShell` (recommended) or Windows Command Prompt (CMD). They can be open by pressing the Windows button + X, and then A. Feel free to watch any Youtube video tutorial if you are not familiar with these non-GUI tools. Make sure that you are in the **root directory of the project** (i.e., in the OpenPose folder, not inside `build/` nor `windows/` nor `bin/`).
......
......@@ -14,7 +14,7 @@ OpenPose - Quick Start
## Quick Start
Check that the library is working properly by running any of the following commands. Make sure that you are in the **root directory of the project** (i.e., in the OpenPose folder, not inside `build/` nor `windows/` nor `bin/`). In addition, `examples/media/video.avi` and `examples/media` do exist, no need to change the paths.
Check that the library is working properly by running any of the following commands on any command-line interface program. In Ubuntu, Mac, and other Unix systems, use any command-line interface, such as `Terminal` or `Terminator`. In Windows, open the `PowerShell` (recommended) or Windows Command Prompt (CMD). They can be open by pressing the Windows button + X, and then A. Feel free to watch any Youtube video tutorial if you are not familiar with these non-GUI tools. Make sure that you are in the **root directory of the project** (i.e., in the OpenPose folder, not inside `build/` nor `windows/` nor `bin/`). In addition, `examples/media/video.avi` and `examples/media` do exist, no need to change the paths.
### Running on Video
```
......
......@@ -152,31 +152,40 @@ namespace op
// Background
if (heatMapTypesHas(mHeatMapTypes, HeatMapType::Background))
{
auto* heatMapsPtr = heatMaps.getPtr() + totalOffset;
#ifdef USE_CUDA
cudaMemcpy(heatMapsPtr, getHeatMapGpuConstPtr() + volumeBodyParts,
channelOffset * sizeof(float), cudaMemcpyDeviceToHost);
#else
const auto* heatMapCpuPtr = getHeatMapCpuConstPtr();
std::copy(heatMapCpuPtr + volumeBodyParts, heatMapCpuPtr + volumeBodyParts + channelOffset,
heatMapsPtr);
#endif
if (mHeatMapScaleMode != ScaleMode::NoScale)
if (addBkgChannel(mPoseModel))
{
// Change from [0,1] to [-1,1]
if (mHeatMapScaleMode == ScaleMode::PlusMinusOne)
for (auto i = 0u ; i < channelOffset ; i++)
heatMapsPtr[i] = fastTruncate(heatMapsPtr[i]) * 2.f - 1.f;
// [0, 255]
else if (mHeatMapScaleMode == ScaleMode::UnsignedChar)
for (auto i = 0u ; i < channelOffset ; i++)
heatMapsPtr[i] = (float)positiveIntRound(fastTruncate(heatMapsPtr[i]) * 255.f);
// Avoid values outside original range
else
for (auto i = 0u ; i < channelOffset ; i++)
heatMapsPtr[i] = fastTruncate(heatMapsPtr[i]);
auto* heatMapsPtr = heatMaps.getPtr() + totalOffset;
#ifdef USE_CUDA
cudaMemcpy(heatMapsPtr, getHeatMapGpuConstPtr() + volumeBodyParts,
channelOffset * sizeof(float), cudaMemcpyDeviceToHost);
#else
const auto* heatMapCpuPtr = getHeatMapCpuConstPtr();
std::copy(
heatMapCpuPtr + volumeBodyParts, heatMapCpuPtr + volumeBodyParts + channelOffset,
heatMapsPtr);
#endif
if (mHeatMapScaleMode != ScaleMode::NoScale)
{
// Change from [0,1] to [-1,1]
if (mHeatMapScaleMode == ScaleMode::PlusMinusOne)
for (auto i = 0u ; i < channelOffset ; i++)
heatMapsPtr[i] = fastTruncate(heatMapsPtr[i]) * 2.f - 1.f;
// [0, 255]
else if (mHeatMapScaleMode == ScaleMode::UnsignedChar)
for (auto i = 0u ; i < channelOffset ; i++)
heatMapsPtr[i] = (float)positiveIntRound(fastTruncate(heatMapsPtr[i]) * 255.f);
// Avoid values outside original range
else
for (auto i = 0u ; i < channelOffset ; i++)
heatMapsPtr[i] = fastTruncate(heatMapsPtr[i]);
}
totalOffset += (unsigned int)channelOffset;
}
else
{
error("You enabled `--heatmaps_add_bkg` for a model that does not contain one. Please,"
" remove this flag for this model.", __LINE__, __FUNCTION__, __FILE__);
}
totalOffset += (unsigned int)channelOffset;
}
// PAFs
if (heatMapTypesHas(mHeatMapTypes, HeatMapType::PAFs))
......@@ -184,12 +193,12 @@ namespace op
auto* heatMapsPtr = heatMaps.getPtr() + totalOffset;
#ifdef USE_CUDA
cudaMemcpy(heatMapsPtr,
getHeatMapGpuConstPtr() + volumeBodyParts + channelOffset,
getHeatMapGpuConstPtr() + volumeBodyParts + (addBkgChannel(mPoseModel) ? channelOffset : 0),
volumePAFs * sizeof(float), cudaMemcpyDeviceToHost);
#else
const auto* heatMapCpuPtr = getHeatMapCpuConstPtr();
std::copy(heatMapCpuPtr + volumeBodyParts + channelOffset,
heatMapCpuPtr + volumeBodyParts + channelOffset + volumePAFs,
std::copy(heatMapCpuPtr + volumeBodyParts + (addBkgChannel(mPoseModel) ? channelOffset : 0),
heatMapCpuPtr + volumeBodyParts + (addBkgChannel(mPoseModel) ? channelOffset : 0) + volumePAFs,
heatMapsPtr);
#endif
if (mHeatMapScaleMode != ScaleMode::NoScale)
......
......@@ -196,7 +196,7 @@ namespace op
if (errorMode == 1)
{
errorMessageToPropagate = errorInitBase + " occurred on a thread. OpenPose closed all its"
" threads and then propagated the error to the main thread:\n"
" threads and then propagated the error to the main thread. Error description:\n\n"
+ errorMessageToPropagate.substr(errorInit.size(), errorMessageToPropagate.size()-1);
}
if (errorMode == 2)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册