提交 6d3ff8b3 编写于 作者: G Gines Hidalgo

Added support/doc for CMake 3.14 on Windows

上级 1e4a7853
......@@ -78,7 +78,15 @@ if (WIN32)
# /GL option causes the code to crash -- fix this
# sdl flags causes error -- error : unknown attribute \"guard\"
set(CMAKE_CONFIGURATION_TYPES Release Debug CACHE TYPE INTERNAL FORCE)
# https://stackoverflow.com/questions/43697154/detect-current-cmake-version-using-cmake
message(STATUS "CMAKE_VERSION = ${CMAKE_VERSION}")
# Remove "minSizeRel" and "relWithDebInfo"
if (${CMAKE_VERSION} VERSION_LESS "3.14.0")
set(CMAKE_CONFIGURATION_TYPES Release Debug CACHE TYPE INTERNAL FORCE)
else (${CMAKE_VERSION} VERSION_LESS "3.14.0")
# But the above line gives warning on CMake >= 3.14, alternative
set(CMAKE_CONFIGURATION_TYPES Release Debug CACHE STRING "" FORCE)
endif (${CMAKE_VERSION} VERSION_LESS "3.14.0")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
......@@ -127,7 +135,7 @@ if (WIN32)
# Ubuntu
else (WIN32) # if (CMAKE_COMPILER_IS_GNUCXX)
if (${INSTRUCTION_SET} MATCHES "AVX2")
set(SIMD_FLAGS "${SIMD_FLAGS} -mavx")
set(SIMD_FLAGS "${SIMD_FLAGS} -mavx -march=native")
endif (${INSTRUCTION_SET} MATCHES "AVX2")
message(STATUS "GCC detected, adding compile flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SIMD_FLAGS}")
......@@ -140,8 +148,8 @@ endif (WIN32)
# 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")
# set(SIMD_FLAGS "${SIMD_FLAGS} -mavx -march=native")
# endif (${INSTRUCTION_SET} MATCHES "AVX2")
# message(STATUS "GCC detected, adding compile flags")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SIMD_FLAGS}")
# endif (CMAKE_COMPILER_IS_GNUCXX)
......
......@@ -4,13 +4,14 @@ OpenPose - Installation
## Contents
1. [Windows Portable Demo](#windows-portable-demo)
2. [Operating Systems](#operating-systems)
3. [Requirements and Dependencies](#requirements-and-dependencies)
4. [Clone OpenPose](#clone-openpose)
5. [Update OpenPose](#update-openpose)
6. [Installation](#installation)
7. [Reinstallation](#reinstallation)
8. [Uninstallation](#uninstallation)
9. [Optional Settings](#optional-settings)
3. [Community-Based Work](#community-based-work)
4. [Requirements and Dependencies](#requirements-and-dependencies)
5. [Clone OpenPose](#clone-openpose)
6. [Update OpenPose](#update-openpose)
7. [Installation](#installation)
8. [Reinstallation](#reinstallation)
9. [Uninstallation](#uninstallation)
10. [Optional Settings](#optional-settings)
1. [Maximum Speed](#maximum-speed)
2. [COCO and MPI Models](#coco-and-mpi-models)
3. [Python API](#python-api)
......@@ -46,6 +47,22 @@ This installation section is only intended if you plan to modify the OpenPose co
## Community-Based Work
We add links to some community-based work based on OpenPose. Note: We do not support them, and we will remove GitHub issues opened asking about them as well as block those users from posting again. If you face any issue, comment only in the comment IDs especified below and/or on their respective GitHubs.
- [ROS example](https://github.com/firephinx/openpose_ros) (based on a very old OpenPose version). For questions and more details, read and post ONLY on [issue thread #51](https://github.com/CMU-Perceptual-Computing-Lab/openpose/issues/51).
- Docker Images. For questions and more details, read and post ONLY on [issue thread #347](https://github.com/CMU-Perceptual-Computing-Lab/openpose/issues/347).
- Dockerfile working with CUDA 10: [link 1](https://github.com/ExSidius/openpose-docker/blob/master/Dockerfile) and [link 2](https://cloud.docker.com/repository/docker/exsidius/openpose/general).
- [Dockerfile - OpenPose v1.4.0, OpenCV, CUDA 8, CuDNN 6, Python2.7](https://gist.github.com/moiseevigor/11c02c694fc0c22fccd59521793aeaa6).
- [Dockerfile - OpenPose v1.2.1](https://gist.github.com/sberryman/6770363f02336af82cb175a83b79de33).
- [Google Colab helper script](https://github.com/CMU-Perceptual-Computing-Lab/openpose/issues/949#issue-387855863): Script to install OpenPose on Google Colab. Really useful when access to a computer powerful enough to run OpenPose is not possible, so one possible way to use OpenPose is to build it on a GPU-enabled Colab runtime and then run the programs there. For questions and more details, read and post ONLY on [issue thread #949](https://github.com/CMU-Perceptual-Computing-Lab/openpose/issues/949).
## Requirements and Dependencies
- **Requirements** for the default configuration (you might need more resources with a greater `--net_resolution` and/or `scale_number` or less resources by reducing the net resolution and/or using the MPI and MPI_4 models):
- CUDA (Nvidia GPU) version:
......@@ -122,10 +139,11 @@ Make sure to download and install the prerequisites for your particular operatin
<img src="media/cmake_installation/im_1_windows.png", width="480">
</p>
2. Press the `Configure` button, keep the generator in `Unix Makefile` (Ubuntu) or set it to `Visual Studio 14 2015 Win64` (Windows), and press `Finish`.
2. Press the `Configure` button, keep the generator in `Unix Makefile` (Ubuntu) or set it to your 64-bit Visual Studio version (Windows), and press `Finish`. Note for Windows users: CMake-GUI has changed their design after version 14. For versions older than 14, you usually select `Visual Studio XX 20XX Win64` as the generator (`X` depends on your VS version), while the `Optional toolset to use` must be empty. However, new CMake versions require you to select only the VS version as the generator, e.g., `Visual Studio 15 2017`, and then you must manually choose `x64` for the `Optional platform for generator`. See the following images as example.
<p align="center">
<img src="media/cmake_installation/im_2.png", width="240">
<img src="media/cmake_installation/im_2_windows.png", width="240">
<img src="media/cmake_installation/im_2_windows_new.png", width="240">
</p>
3. If this step is successful, the `Configuring done` text will appear in the bottom box in the last line. Otherwise, some red text will appear in that same bottom box.
......
......@@ -70,19 +70,19 @@ namespace op
// Max/min functions
template<class T>
inline __device__ T fastMaxCuda(T a, T b)
inline __device__ T fastMaxCuda(const T a, const T b)
{
return (a > b ? a : b);
}
template<class T>
inline __device__ T fastMinCuda(T a, T b)
inline __device__ T fastMinCuda(const T a, const T b)
{
return (a < b ? a : b);
}
template<class T>
inline __device__ T fastTruncateCuda(T value, T min = 0, T max = 1)
inline __device__ T fastTruncateCuda(const T value, const T min = 0, const T max = 1)
{
return fastMinCuda(max, fastMaxCuda(min, value));
}
......
......@@ -379,10 +379,11 @@ namespace op
// BODY_135
const auto H135 = 25;
const auto F135 = H135 + 40;
// 15,19, 19,20, 15,21, 16,22, 22,23, 16,24, 5,17,
// 6,17, 17,18, 11,12,
#define POSE_BODY_135_PAIRS_RENDER_GPU \
0,1, 0,2, 1,3, 2,4, 5,7, 6,8, 7,9, 8,10, 5,11, 6,12, 11,13, 12,14, 13,15, 14,16, \
15,19, 19,20, 15,21, 16,22, 22,23, 16,24, 5,17, \
6,17, 17,18, 11,12, \
15,19, 19,20, 15,21, 16,22, 22,23, 16,24, 5,6, 17,18, 11,12, \
\
9,H135+0, H135+0,H135+1, H135+1,H135+2, H135+2,H135+3, 9,H135+4, H135+4,H135+5, H135+5,H135+6, H135+6,H135+7, \
9,H135+8, H135+8,H135+9, H135+9,H135+10, H135+10,H135+11, 9,H135+12, H135+12,H135+13, H135+13,H135+14, H135+14,H135+15, \
......@@ -399,7 +400,7 @@ namespace op
// Disabled really noisy values
#define POSE_BODY_135_SCALES_RENDER_GPU \
1.f,1.f,1.f,1.f,1.f, 1.f,1.f,1.f,1.f,1.f, 1.f,1.f,1.f,1.f,1.f, 1.f,1.f, \
1.f,0.00f, \
0.00f,0.00f, \
1.f,1.f,1.f,1.f,1.f,1.f, \
0.60f,0.60f,0.60f,0.60f,0.60f, 0.60f,0.60f,0.60f,0.60f,0.60f, 0.60f,0.60f,0.60f,0.60f,0.60f, 0.60f,0.60f,0.60f,0.60f,0.60f, \
0.60f,0.60f,0.60f,0.60f,0.60f, 0.60f,0.60f,0.60f,0.60f,0.60f, 0.60f,0.60f,0.60f,0.60f,0.60f, 0.60f,0.60f,0.60f,0.60f,0.60f, \
......
......@@ -105,10 +105,32 @@ namespace op
if (normalize == 1)
{
#ifdef WITH_AVX
// // C++ code
// // To check results are the same (norm(x1-x2) = 0)
// cv::Mat floatPtrImageCvWrapper(height, width, CV_32FC3, floatPtrImage);
// cv::Mat floatPtrImageCvWrapperTest = floatPtrImageCvWrapper*(1/256.f) - 0.5f;
// // Speed profiling
// const auto REPS = 2000;
// double timeNormalize0 = 0.;
// double timeNormalize1 = 0.;
// double timeNormalize2 = 0.;
// double timeNormalize3 = 0.;
// // OpenCV wrapper
// OP_PROFILE_INIT(REPS);
// cv::Mat floatPtrImageCvWrapper(height, width, CV_32FC3, floatPtrImage);
// floatPtrImageCvWrapper = floatPtrImageCvWrapper*(1/256.f) - 0.5f;
// OP_PROFILE_END(timeNormalize0, 1e6, REPS);
// // C++ sequential code
// OP_PROFILE_INIT(REPS);
// const auto ratio = 1.f/256.f;
// for (auto pixel = 0 ; pixel < width*height*channels ; ++pixel)
// floatPtrImage[pixel] = floatPtrImage[pixel]*ratio - 0.5f;
// OP_PROFILE_END(timeNormalize1, 1e6, REPS);
// // OpenCV wrapper
// OP_PROFILE_INIT(REPS);
// cv::Mat floatPtrImageCvWrapper(height, width, CV_32FC3, floatPtrImage);
// floatPtrImageCvWrapper = floatPtrImageCvWrapper*(1/256.f) - 0.5f;
// OP_PROFILE_END(timeNormalize2, 1e6, REPS);
// OP_PROFILE_INIT(REPS);
// AVX code
const auto volume = width*height*channels;
int pixel;
......@@ -125,6 +147,16 @@ namespace op
const auto ratio = 1.f/256.f;
for (; pixel < volume ; ++pixel)
floatPtrImage[pixel] = floatPtrImage[pixel]*ratio - 0.5f;
// OP_PROFILE_END(timeNormalize3, 1e6, REPS);
// std::cout
// << "TN1: " << timeNormalize0 << " us\n"
// << "TN1: " << timeNormalize1 << " us\n"
// << "TN2: " << timeNormalize2 << " us\n"
// << "TN3: " << timeNormalize3 << " us\n"
// << std::endl;
// std::cout
// << "Norm: " << cv::norm(floatPtrImageCvWrapper-floatPtrImageCvWrapperTest) << "\n"
// << std::endl;
// Non optimized code
#else
// floatPtrImage wrapped as cv::Mat
......
......@@ -30,5 +30,15 @@ namespace op
udpHost{udpHost_},
udpPort{udpPort_}
{
try
{
if (!writeBvh.empty())
error("BVH writing is experimental and not available yet (flag `--write_bvh`). Please, disable this"
" flag and do not open a GitHub issue asking for it.", __LINE__, __FUNCTION__, __FILE__);
}
catch (const std::exception& e)
{
error(e.what(), __LINE__, __FUNCTION__, __FILE__);
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册