diff --git a/cmake/Utils.cmake b/cmake/Utils.cmake index d3b687f04afde6b2bfcaa535056eb675076b4757..6e8e98c763923634d53e08e88ec6e7a30c3d8f97 100644 --- a/cmake/Utils.cmake +++ b/cmake/Utils.cmake @@ -19,7 +19,7 @@ endfunction (download_model) function(download_zip FILE_NAME URL DOWNLOAD_PATH CHECKSUM) set(FULL_FILE_PATH "${DOWNLOAD_PATH}/${FILE_NAME}") if (NOT EXISTS ${FULL_FILE_PATH}) - message(STATUS "Downloading ${URL}...") + message(STATUS "Downloading ${URL}/${FILE_NAME}...") file(DOWNLOAD "${URL}/${FILE_NAME}" "${DOWNLOAD_PATH}/${FILE_NAME}" EXPECTED_MD5 ${CHECKSUM}) message(STATUS "Extracting ${FULL_FILE_PATH}...") diff --git a/doc/prerequisites.md b/doc/prerequisites.md index 5c5d9e5ba2f95429e479698baf7b8d04d302c0e2..68f3cbb6eb10ce077ce98fcd678cb539f1e6073d 100644 --- a/doc/prerequisites.md +++ b/doc/prerequisites.md @@ -103,7 +103,10 @@ NOTE: These instructions are only required when compiling OpenPose brom source. - CMake automatically downloads all the Windows DLLs. Alternatively, you might prefer to download them manually: - Dependencies: - Note: Leave the zip files in `3rdparty/windows/` so that CMake does not try to download them again. - - [Caffe](http://posefs1.perception.cs.cmu.edu/OpenPose/3rdparty/windows/caffe_15_2019_05_16.zip): Unzip as `3rdparty/windows/caffe/`. + - Caffe (if you are not sure which one you need, donwload the default one): + - [CUDA Caffe (Default)](http://posefs1.perception.cs.cmu.edu/OpenPose/3rdparty/windows/caffe_15_2019_05_16.zip): Unzip as `3rdparty/windows/caffe/`. + - [CPU Caffe](http://posefs1.perception.cs.cmu.edu/OpenPose/3rdparty/windows/caffe_cpu_2018_05_27.zip): Unzip as `3rdparty/windows/caffe_cpu/`. + - [OpenCL Caffe](http://posefs1.perception.cs.cmu.edu/OpenPose/3rdparty/windows/caffe_opencl_2018_02_13.zip): Unzip as `3rdparty/windows/caffe_opencl/`. - [Caffe dependencies](http://posefs1.perception.cs.cmu.edu/OpenPose/3rdparty/windows/caffe3rdparty_15_2019_03_14.zip): Unzip as `3rdparty/windows/caffe3rdparty/`. - [OpenCV 4.0.1](http://posefs1.perception.cs.cmu.edu/OpenPose/3rdparty/windows/opencv_401_v14_15_2019_03_14.zip): Unzip as `3rdparty/windows/opencv/`. 6. **Eigen prerequisite** (optional, only required for some specific extra functionality, such as extrinsic camera calibration): diff --git a/src/openpose/3d/poseTriangulation.cpp b/src/openpose/3d/poseTriangulation.cpp index 6806ca2cfcc1bc0964b3a71eea6796a15d3156f1..83a9084adc653bd66113afe291664d3f26b9dfaf 100644 --- a/src/openpose/3d/poseTriangulation.cpp +++ b/src/openpose/3d/poseTriangulation.cpp @@ -154,9 +154,9 @@ namespace op } } - double triangulateWithOptimization(cv::Mat& reconstructedPoint, const std::vector& cameraMatrices, - const std::vector& pointsOnEachCamera, - const double reprojectionMaxAcceptable) + double triangulateWithOptimization( + cv::Mat& reconstructedPoint, const std::vector& cameraMatrices, + const std::vector& pointsOnEachCamera, const double reprojectionMaxAcceptable) { try { @@ -356,7 +356,7 @@ namespace op { if (!keypoints.empty()) { - detectionMissed++; + ++detectionMissed; if (detectionMissed > 1) { numberBodyParts = keypoints.getSize(1); @@ -372,7 +372,7 @@ namespace op std::vector indexesUsed; std::vector> xyPoints; std::vector> cameraMatricesPerPoint; - for (auto part = 0; part < numberBodyParts; part++) + for (auto part = 0; part < numberBodyParts; ++part) { // Create vector of points // auto missedPoint = false; @@ -383,7 +383,7 @@ namespace op for (auto i = 0u ; i < keypointsVector.size() ; i++) { const auto& keypoints = keypointsVector[i]; - if (isValidKeypoint(&keypoints[baseIndex], imageSizes[i])) + if (!keypoints.empty() && isValidKeypoint(&keypoints[baseIndex], imageSizes[i])) { xyPointsElement.emplace_back( cv::Point2d{keypoints[baseIndex], keypoints[baseIndex+1]}); @@ -408,9 +408,9 @@ namespace op const auto imageRatio = std::sqrt(imageSizes[0].x * imageSizes[0].y / 1310720.); const auto reprojectionMaxAcceptable = 25 * imageRatio; std::vector reprojectionErrors(xyPoints.size()); - keypoints3D.reset({ 1, numberBodyParts, 4 }, 0.f); if (!xyPoints.empty()) { + keypoints3D.reset({ 1, numberBodyParts, 4 }, 0.f); // Do 3D reconstruction std::vector xyzPoints(xyPoints.size()); for (auto i = 0u; i < xyPoints.size(); i++) @@ -434,7 +434,7 @@ namespace op // 20 pixels for 1280x1024 image bool atLeastOnePointProjected = false; const auto lastChannelLength = keypoints3D.getSize(2); - for (auto index = 0u; index < indexesUsed.size(); index++) + for (auto index = 0u; index < indexesUsed.size(); ++index) { if (std::isfinite(xyzPoints[index].x) && std::isfinite(xyzPoints[index].y) && std::isfinite(xyzPoints[index].z) diff --git a/src/openpose/net/bodyPartConnectorBaseCL.cpp b/src/openpose/net/bodyPartConnectorBaseCL.cpp index 50d9e906bd5f677263059806fd29ad2c70b9c044..cee53a1ad9b1ccd9260f9edfe7b20dcead1cc4c6 100644 --- a/src/openpose/net/bodyPartConnectorBaseCL.cpp +++ b/src/openpose/net/bodyPartConnectorBaseCL.cpp @@ -11,7 +11,8 @@ namespace op { #ifdef USE_OPENCL - typedef cl::KernelFunctor PAFScoreKernelFunctor; + typedef cl::KernelFunctor PAFScoreKernelFunctor; const std::string pafScoreKernel = MULTI_LINE_STRING( int intRoundGPU(const Type a) @@ -19,9 +20,10 @@ namespace op return (int)(a+0.5); } - Type process(__global const Type* bodyPartA, __global const Type* bodyPartB, __global const Type* mapX, __global const Type* mapY, - const int heatmapWidth, const int heatmapHeight, const Type interThreshold, - const Type interMinAboveThreshold, const Type defaultNmsThreshold) + Type process( + __global const Type* bodyPartA, __global const Type* bodyPartB, __global const Type* mapX, + __global const Type* mapY, const int heatmapWidth, const int heatmapHeight, const Type interThreshold, + const Type interMinAboveThreshold, const Type defaultNmsThreshold) { const Type vectorAToBX = bodyPartB[0] - bodyPartA[0]; const Type vectorAToBY = bodyPartB[1] - bodyPartA[1]; @@ -67,7 +69,7 @@ namespace op const Type l2Dist = sqrt((Type)(vectorAToBX*vectorAToBX + vectorAToBY*vectorAToBY)); const Type threshold = sqrt((Type)(heatmapWidth*heatmapHeight))/150; // 3.3 for 368x656, 6.6 for 2x resolution if (l2Dist < threshold) - return T(defaultNmsThreshold+1e-6); // Without 1e-6 will not work because I use strict greater + return Type(defaultNmsThreshold+1e-6); // Without 1e-6 will not work because I use strict greater } } return -1;