提交 5e414030 编写于 作者: G gineshidalgo99

Added foot dataset and new paper link

上级 d8ac8438
......@@ -386,10 +386,10 @@ if (UNIX OR APPLE)
# 3D
if (WITH_3D_RENDERER)
# OpenGL
find_package(OpenGL REQUIRED)
# GLUT
find_package(GLUT REQUIRED)
# OpenGL
find_package(OpenGL REQUIRED)
endif (WITH_3D_RENDERER)
if (WITH_CERES)
# Eigen + Ceres
......@@ -818,7 +818,7 @@ if (WITH_3D_ADAM_MODEL)
include_directories(${EIGEN3_INCLUDE_DIRS})
include_directories(${IGL_INCLUDE_DIRS})
include_directories(${LIBIGL_INCLUDE_DIRS})
include_directories(${OPENGL_INCLUDE_DIR} ${GLUT_INCLUDE_DIRS} ${GLEW_INCLUDE_DIRS})
include_directories(${GLUT_INCLUDE_DIRS} ${GLEW_INCLUDE_DIRS} ${OPENGL_INCLUDE_DIR})
endif (WITH_3D_ADAM_MODEL)
# Windows includes
if (WIN32)
......@@ -863,7 +863,7 @@ if (WITH_3D_ADAM_MODEL)
${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${GLEW_LIBRARY} ${FREE_IMAGE_LIBRARY})
endif (WITH_3D_ADAM_MODEL)
if (WITH_3D_RENDERER)
set(OpenPose_3rdparty_libraries ${OpenPose_3rdparty_libraries} ${OPENGL_LIBRARIES} ${GLUT_LIBRARY})
set(OpenPose_3rdparty_libraries ${OpenPose_3rdparty_libraries} ${GLUT_LIBRARY} ${OPENGL_LIBRARIES})
endif (WITH_3D_RENDERER)
if (WITH_CERES)
set(OpenPose_3rdparty_libraries ${OpenPose_3rdparty_libraries} ${CERES_LIBRARIES})
......
......@@ -37,6 +37,7 @@
## Latest Features
- Dec 2018: [**Foot dataset and new paper released**](https://cmu-perceptual-computing-lab.github.io/foot_keypoint_dataset/)!
- Sep 2018: [**Experimental single-person tracker**](doc/quick_start.md#tracking) for further speed up or visual smoothing!
- Jun 2018: [**Combined body-foot model released! 40% faster and 5% more accurate**](doc/installation.md)!
- Jun 2018: [**Python API**](doc/modules/python_module.md) released!
......@@ -93,10 +94,11 @@ This analysis was performed using the same images for each algorithm and a batch
5. [Quick Start](#quick-start)
6. [Output](#output)
7. [Speeding Up OpenPose and Benchmark](#speeding-up-openpose-and-benchmark)
8. [Send Us Failure Cases and Feedback!](#send-us-failure-cases-and-feedback)
9. [Authors and Contributors](#authors-and-contributors)
10. [Citation](#citation)
11. [License](#license)
8. [Foot Dataset](#foot-dataset)
9. [Send Us Failure Cases and Feedback!](#send-us-failure-cases-and-feedback)
10. [Authors and Contributors](#authors-and-contributors)
11. [Citation](#citation)
12. [License](#license)
......@@ -142,6 +144,11 @@ Check the OpenPose Benchmark as well as some hints to speed up and/or reduce the
## Foot Dataset
Check the [foot dataset website](https://cmu-perceptual-computing-lab.github.io/foot_keypoint_dataset/) and new OpenPose paper for more information.
## Send Us Failure Cases and Feedback!
Our library is open source for research purposes, and we want to continuously improve it! So please, let us know if...
......@@ -168,6 +175,13 @@ We would also like to thank all the people who helped OpenPose in any way. The m
## Citation
Please cite these papers in your publications if it helps your research (the face keypoint detector was trained using the procedure described in [Simon et al. 2017] for hands):
@inproceedings{cao2018openpose,
author = {Zhe Cao and Gines Hidalgo and Tomas Simon and Shih-En Wei and Yaser Sheikh},
booktitle = {Arxiv},
title = {Open{P}ose: realtime multi-person 2{D} pose estimation using {P}art {A}ffinity {F}ields},
year = {2018}
}
@inproceedings{cao2017realtime,
author = {Zhe Cao and Tomas Simon and Shih-En Wei and Yaser Sheikh},
booktitle = {CVPR},
......
......@@ -16,6 +16,7 @@ OpenPose - Frequently Asked Question (FAQ)
11. [Difference between BODY_25 vs. COCO vs. MPI](#difference-between-body_25-vs.-coco-vs.-mpi)
12. [How to Measure the Latency Time?](#how-to-measure-the-latency-time)
13. [Zero People Detected](#zero-people-detected)
14. [3D OpenPose Returning Wrong Results: 0, NaN, Infinity, etc.](#3d-openpose-returning-wrong-results-0-nan-infinity-etc)
......@@ -112,3 +113,10 @@ COCO model will eventually be removed. BODY_25 model is faster, more accurate, a
**Q: 0 people detected and displayed in default video and images.**
**A**: This problem occurs when the caffemodel has not been properly downloaded. E.g., if the connection drops when downloading the models. Please, remove the current models in the model folder, and download them manually from the links in [doc/installation.md](./installation.md). Alternatively, remove them and re-run Cmake again.
### 3D OpenPose Returning Wrong Results: 0, NaN, Infinity, etc.
**Q: 3D OpenPose is returning wrong results.**
**A**: 99.99% of the cases, this is due to wrong or poor calibration. Repeat the calibration making sure that the final reprojection error is about or less than 0.1 pixels.
OpenPose Library - All Released Features
====================================
- Dec 2018: [**Foot dataset and new paper released**](https://cmu-perceptual-computing-lab.github.io/foot_keypoint_dataset/)!
- Sep 2018: [**Experimental tracker**](./quick_start.md#tracking)!
- Jun 2018: [**Combined body-foot model released! 40% faster and 5% more accurate**](./installation.md)!
- Jun 2018: [**Python API**](./modules/python_module.md) released!
......
......@@ -26,6 +26,7 @@ namespace op
CAR_22, /**< Experimental. Do not use. */
BODY_19E, /**< Experimental. Do not use. */
BODY_25B, /**< Experimental. Do not use. */
BODY_95, /**< Experimental. Do not use. */
Size,
};
......
......@@ -31,6 +31,7 @@ namespace op
OP_API float getPoseDefaultConnectInterThreshold(const PoseModel poseModel, const bool maximizePositives = false);
OP_API unsigned int getPoseDefaultMinSubsetCnt(const bool maximizePositives = false);
OP_API float getPoseDefaultConnectMinSubsetScore(const bool maximizePositives = false);
OP_API bool addBkgChannel(const PoseModel poseModel);
}
#endif // OPENPOSE_POSE_POSE_PARAMETERS_HPP
......@@ -148,24 +148,24 @@ namespace op
#define POSE_BODY_25B_SCALES_RENDER_GPU 1
#define POSE_BODY_25B_COLORS_RENDER_GPU \
255.f, 0.f, 85.f, \
255.f, 0.f, 0.f, \
255.f, 85.f, 0.f, \
255.f, 170.f, 0.f, \
255.f, 255.f, 0.f, \
170.f, 0.f, 255.f, \
255.f, 0.f, 170.f, \
85.f, 0.f, 255.f, \
255.f, 0.f, 255.f, \
170.f, 255.f, 0.f, \
255.f, 85.f, 0.f, \
85.f, 255.f, 0.f, \
255.f, 170.f, 0.f, \
0.f, 255.f, 0.f, \
255.f, 0.f, 0.f, \
0.f, 255.f, 85.f, \
0.f, 255.f, 170.f, \
0.f, 255.f, 255.f, \
255.f, 255.f, 0.f, \
0.f, 170.f, 255.f, \
0.f, 255.f, 85.f, \
0.f, 85.f, 255.f, \
0.f, 255.f, 170.f, \
0.f, 0.f, 255.f, \
255.f, 0.f, 170.f, \
170.f, 0.f, 255.f, \
255.f, 0.f, 255.f, \
85.f, 0.f, 255.f, \
0.f, 255.f, 255.f, \
255.f, 0.f, 0.f, \
255.f, 0.f, 0.f, \
0.f, 0.f, 255.f, \
0.f, 0.f, 255.f, \
0.f, 0.f, 255.f, \
......@@ -260,6 +260,122 @@ namespace op
// 2. Gradient color from wrist to finger tips
// - Inside each finger: 5 steps from main color to 000000, and selecting first 4 from RGB gradient.
// Note: Used HSV gradient for red finger.
// BODY_95
const auto F95 = 25;
#define POSE_BODY_95_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, \
F95+0,F95+1, F95+1,F95+2, F95+2,F95+3, F95+3,F95+4, F95+4,F95+5, F95+5,F95+6, F95+6,F95+7, F95+7,F95+8, F95+8,F95+9, F95+9,F95+10, F95+10,F95+11, F95+11,F95+12, F95+12,F95+13, F95+13,F95+14, F95+14,F95+15, F95+15,F95+16, F95+17,F95+18, F95+18,F95+19, F95+19,F95+20, \
F95+20,F95+21, F95+22,F95+23, F95+23,F95+24, F95+24,F95+25, F95+25,F95+26, F95+27,F95+28, F95+28,F95+29, F95+29,F95+30, F95+31,F95+32, F95+32,F95+33, F95+33,F95+34, F95+34,F95+35, F95+36,F95+37, F95+37,F95+38, F95+38,F95+39, F95+39,F95+40, F95+40,F95+41, \
F95+41,F95+36, F95+42,F95+43, F95+43,F95+44, F95+44,F95+45, F95+45,F95+46, F95+46,F95+47, F95+47,F95+42, F95+48,F95+49, F95+49,F95+50, F95+50,F95+51, F95+51,F95+52, F95+52,F95+53, F95+53,F95+54, F95+54,F95+55, F95+55,F95+56, F95+56,F95+57, F95+57,F95+58, \
F95+58,F95+59, F95+59,F95+48, F95+60,F95+61, F95+61,F95+62, F95+62,F95+63, F95+63,F95+64, F95+64,F95+65, F95+65,F95+66, F95+66,F95+67, F95+67,F95+60
#define POSE_BODY_95_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,1.f, \
1.f,1.f,1.f,1.f,1.f,1.f, \
0.33f,0.33f,0.33f,0.33f,0.33f, 0.33f,0.33f,0.33f,0.33f,0.33f, 0.33f,0.33f,0.33f,0.33f,0.33f, 0.33f,0.33f,0.33f,0.33f,0.33f, \
0.33f,0.33f,0.33f,0.33f,0.33f, 0.33f,0.33f,0.33f,0.33f,0.33f, 0.33f,0.33f,0.33f,0.33f,0.33f, 0.33f,0.33f,0.33f,0.33f,0.33f, \
0.33f,0.33f,0.33f,0.33f,0.33f, 0.33f,0.33f,0.33f,0.33f,0.33f, 0.33f,0.33f,0.33f,0.33f,0.33f, 0.33f,0.33f,0.33f,0.33f,0.33f, \
0.33f,0.33f,0.33f,0.33f,0.33f, 0.33f,0.33f,0.33f,0.33f,0.33f
#define POSE_BODY_95_COLORS_RENDER_GPU \
255.f, 0.f, 85.f, \
170.f, 0.f, 255.f, \
255.f, 0.f, 170.f, \
85.f, 0.f, 255.f, \
255.f, 0.f, 255.f, \
170.f, 255.f, 0.f, \
255.f, 85.f, 0.f, \
85.f, 255.f, 0.f, \
255.f, 170.f, 0.f, \
0.f, 255.f, 0.f, \
255.f, 255.f, 0.f, \
0.f, 170.f, 255.f, \
0.f, 255.f, 85.f, \
0.f, 85.f, 255.f, \
0.f, 255.f, 170.f, \
0.f, 0.f, 255.f, \
0.f, 255.f, 255.f, \
255.f, 0.f, 0.f, \
255.f, 0.f, 0.f, \
\
0.f, 0.f, 255.f, \
0.f, 0.f, 255.f, \
0.f, 0.f, 255.f, \
0.f, 255.f, 255.f, \
0.f, 255.f, 255.f, \
0.f, 255.f, 255.f, \
\
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f, \
255.f, 255.f, 255.f
// CAR_12
#define POSE_CAR_12_PAIRS_RENDER_GPU \
......
......@@ -633,7 +633,7 @@ namespace op
{
// New size & volume
mSize = sizes;
mVolume = {std::accumulate(sizes.begin(), sizes.end(), 1ull, std::multiplies<size_t>())};
mVolume = {std::accumulate(sizes.begin(), sizes.end(), std::size_t(1), std::multiplies<size_t>())};
// Prepare shared_ptr
if (dataPtr == nullptr)
{
......
......@@ -61,7 +61,7 @@ namespace op
indexesInCocoOrder = std::vector<int>{0, 14,13,16,15, 4,1,5,2,6, 3,10,7,11, 8, 12, 9};
else if (numberBodyParts == 18)
indexesInCocoOrder = std::vector<int>{0, 15,14,17,16, 5,2,6,3,7, 4,11,8,12, 9, 13,10};
else if (mPoseModel == PoseModel::BODY_25B)
else if (mPoseModel == PoseModel::BODY_25B || mPoseModel == PoseModel::BODY_95)
indexesInCocoOrder = std::vector<int>{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
else if (numberBodyParts == 19 || numberBodyParts == 25 || numberBodyParts == 59)
indexesInCocoOrder = std::vector<int>{0, 16,15,18,17, 5,2,6,3,7, 4,12,9,13,10, 14,11};
......@@ -71,7 +71,7 @@ namespace op
// Foot
else if (mCocoJsonFormat == CocoJsonFormat::Foot)
{
if (numberBodyParts == 25)
if (numberBodyParts == 25 || numberBodyParts > 60)
indexesInCocoOrder = std::vector<int>{19,20,21, 22,23,24};
else if (numberBodyParts == 23)
indexesInCocoOrder = std::vector<int>{17,18,19, 20,21,22};
......
......@@ -74,7 +74,7 @@ namespace op
// - double: person subset score
std::vector<std::pair<std::vector<int>, T>> peopleVector;
const auto& mapIdx = getPoseMapIndex(poseModel);
const auto numberBodyPartsAndBkg = numberBodyParts + (poseModel != PoseModel::BODY_25B ? 1 : 0);
const auto numberBodyPartsAndBkg = numberBodyParts + (addBkgChannel(poseModel) ? 1 : 0);
const auto vectorSize = numberBodyParts+1;
const auto peaksOffset = 3*(maxPeaks+1);
const auto heatMapOffset = heatMapSize.area();
......
......@@ -239,7 +239,7 @@ namespace op
const auto numberBodyParts = getPoseNumberBodyParts(mPoseModel);
const auto& mapIdxOffset = getPoseMapIndex(mPoseModel);
// Update mapIdx
const auto offset = (mPoseModel != PoseModel::BODY_25B ? 1 : 0);
const auto offset = (addBkgChannel(mPoseModel) ? 1 : 0);
auto mapIdx = mapIdxOffset;
for (auto& i : mapIdx)
i += (numberBodyParts+offset);
......
......@@ -80,7 +80,7 @@ namespace op
cpuToGpuMemoryIfNotCopiedYet(outputData.getPtr(), outputData.getVolume());
cudaCheck(__LINE__, __FUNCTION__, __FILE__);
const auto numberBodyParts = getPoseNumberBodyParts(mPoseModel);
const auto hasBkg = (mPoseModel != PoseModel::BODY_25B);
const auto hasBkg = addBkgChannel(mPoseModel);
const auto numberBodyPartsPlusBkg = numberBodyParts + (hasBkg ? 1 : 0);
const auto numberBodyPAFChannels = getPosePartPairs(mPoseModel).size();
const Point<int> frameSize{outputData.getSize(1), outputData.getSize(0)};
......
......@@ -199,6 +199,47 @@ namespace op
// - All fingers:
// - Fingertips
// More information: Page 6 of http://www.mccc.edu/~behrensb/documents/TheHandbig.pdf
const std::map<unsigned int, std::string> POSE_BODY_95_BODY_PARTS {
{0, "Nose"},
{1, "LEye"},
{2, "REye"},
{3, "LEar"},
{4, "REar"},
{5, "LShoulder"},
{6, "RShoulder"},
{7, "LElbow"},
{8, "RElbow"},
{9, "LWrist"},
{10, "RWrist"},
{11, "LHip"},
{12, "RHip"},
{13, "LKnee"},
{14, "RKnee"},
{15, "LAnkle"},
{16, "RAnkle"},
{17, "UpperNeck"},
{18, "HeadTop"},
{19, "LBigToe"},
{20, "LSmallToe"},
{21, "LHeel"},
{22, "RBigToe"},
{23, "RSmallToe"},
{24, "RHeel"},
// Face
{F95+0, "FaceContour0"}, {F95+1, "FaceContour1"}, {F95+2, "FaceContour2"}, {F95+3, "FaceContour3"}, {F95+4, "FaceContour4"}, {F95+5, "FaceContour5"}, // Contour 1/3
{F95+6, "FaceContour6"}, {F95+7, "FaceContour7"}, {F95+8, "FaceContour8"}, {F95+9, "FaceContour9"}, {F95+10, "FaceContour10"}, {F95+11, "FaceContour11"}, // Contour 2/3
{F95+12, "FaceContour12"}, {F95+13, "FaceContour13"}, {F95+14, "FaceContour14"}, {F95+15, "FaceContour15"}, {F95+16, "FaceContour16"}, // Contour 3/3
{F95+17, "REyeBrow0"}, {F95+18, "REyeBrow1"}, {F95+19, "REyeBrow2"}, {F95+20, "REyeBrow3"}, {F95+21, "REyeBrow4"}, // Right eyebrow
{F95+22, "LEyeBrow4"}, {F95+23, "LEyeBrow3"}, {F95+24, "LEyeBrow2"}, {F95+25, "LEyeBrow1"}, {F95+26, "LEyeBrow0"}, // Left eyebrow
{F95+27, "NoseUpper0"}, {F95+28, "NoseUpper1"}, {F95+29, "NoseUpper2"}, {F95+30, "NoseUpper3"}, // Upper nose
{F95+31, "NoseLower0"}, {F95+32, "NoseLower1"}, {F95+33, "NoseLower2"}, {F95+34, "NoseLower3"}, {F95+35, "NoseLower4"}, // Lower nose
{F95+36, "REye0"}, {F95+37, "REye1"}, {F95+38, "REye2"}, {F95+39, "REye3"}, {F95+40, "REye4"}, {F95+41, "REye5"}, // Right eye
{F95+42, "LEye0"}, {F95+43, "LEye1"}, {F95+44, "LEye2"}, {F95+45, "LEye3"}, {F95+46, "LEye4"}, {F95+47, "LEye5"}, // Left eye
{F95+48, "OMouth0"}, {F95+49, "OMouth1"}, {F95+50, "OMouth2"}, {F95+51, "OMouth3"}, {F95+52, "OMouth4"}, {F95+53, "OMouth5"}, // Outer mouth 1/2
{F95+54, "OMouth6"}, {F95+55, "OMouth7"}, {F95+56, "OMouth8"}, {F95+57, "OMouth9"}, {F95+58, "OMouth10"}, {F95+59, "OMouth11"}, // Outer mouth 2/2
{F95+60, "IMouth0"}, {F95+61, "IMouth1"}, {F95+62, "IMouth2"}, {F95+63, "IMouth3"}, {F95+64, "IMouth4"}, {F95+65, "IMouth5"}, {F95+66, "IMouth6"}, {F95+67, "IMouth7"}, // Inner mouth
{F95+68, "RPupil"}, {F95+69, "LPupil"}, // Pupils
};
const std::map<unsigned int, std::string> POSE_CAR_12_PARTS {
{0, "FRWheel"},
{1, "FLWheel"},
......@@ -322,13 +363,45 @@ namespace op
// MPII redundant, ears, ears-shoulders, shoulders-wrists, wrists, wrists-hips, hips, ankles)
48,49, 50,51, 52,53, 54,55, 56,57, 58,59, 60,61, 62,63, 64,65, 66,67, 68,69, 70,71
},
// BODY_95
std::vector<unsigned int>{
// Minimum spanning tree
// |------------------------------------------- COCO Body -------------------------------------------|
0,1, 2,3, 4,5, 6,7, 8,9,10,11, 12,13,14,15,16,17,18,19, 20,21, 22,23, 24,25, 26,27, 28,29, 30,31,
// Redundant ones
// |------------------ Foot ------------------| |-- MPII --|
32,33, 34,35, 36,37, 38,39, 40,41, 42,43, 44,45, 46,47,
// Redundant ones
// MPII redundant, ears, ears-shoulders, shoulders-wrists, wrists, wrists-hips, hips, ankles)
48,49, 50,51, 52,53, 54,55, 56,57, 58,59, 60,61, 62,63, 64,65, 66,67, 68,69, 70,71,
// Face
// COCO-Face
72,73, 74,75, 76,77,
// Contour
78,79, 80,81, 82,83, 84,85, 86,87, 88,89, 90,91, 92,93, 94,95, 96,97, 98,99, 100,101, 102,103,
104,105, 106,107, 108,109,
// Countour-Eyebrow + Eyebrows
110,111, 112,113, 114,115, 116,117, 118,119, 120,121, 122,123, 124,125, 126,127, 128,129, 130,131,
// Eyebrow-Nose + Nose
132,133, 134,135, 136,137, 138,139, 140,141, 142,143, 144,145, 146,147, 148,149, 150,151,
// Nose-Eyes + Eyes
152,153, 154,155, 156,157, 158,159, 160,161, 162,163, 164,165, 166,167, 168,169, 170,171, 172,173,
174,175,
// Nose-Mouth + Outer Mouth
176,177, 178,179, 180,181, 182,183, 184,185, 186,187, 188,189, 190,191, 192,193, 194,195, 196,197,
198,199,
// Outer-Inner + Inner Mouth
200,201, 202,203, 204,205, 206,207, 208,209, 210,211, 212,213, 214,215, 216,217//,
// // Eyes-Pupils
// 218,219, 220,221, 222,223, 224,225
},
};
// POSE_BODY_PART_MAPPING on HPP crashes on Windows at dynamic initialization if it's on hpp
const std::array<std::map<unsigned int, std::string>, (int)PoseModel::Size> POSE_BODY_PART_MAPPING{
POSE_BODY_25_BODY_PARTS,POSE_COCO_BODY_PARTS, POSE_MPI_BODY_PARTS, POSE_MPI_BODY_PARTS,
POSE_BODY_19_BODY_PARTS,POSE_BODY_19_BODY_PARTS,POSE_BODY_19_BODY_PARTS,POSE_BODY_25_BODY_PARTS,
POSE_BODY_65_BODY_PARTS,POSE_CAR_12_PARTS, POSE_BODY_25_BODY_PARTS,POSE_BODY_23_BODY_PARTS,
POSE_CAR_22_PARTS, POSE_BODY_19_BODY_PARTS,POSE_BODY_25B_BODY_PARTS
POSE_CAR_22_PARTS, POSE_BODY_19_BODY_PARTS,POSE_BODY_25B_BODY_PARTS,POSE_BODY_95_BODY_PARTS
};
const std::array<std::string, (int)PoseModel::Size> POSE_PROTOTXT{
......@@ -347,6 +420,7 @@ namespace op
"car/car_22/pose_deploy.prototxt",
"pose/body_19e/pose_deploy.prototxt",
"pose/body_25b/pose_deploy.prototxt",
"pose/body_95/pose_deploy.prototxt",
};
const std::array<std::string, (int)PoseModel::Size> POSE_TRAINED_MODEL{
"pose/body_25/pose_iter_584000.caffemodel",
......@@ -364,12 +438,13 @@ namespace op
"car/car_22/pose_iter_XXXXXX.caffemodel",
"pose/body_19e/pose_iter_XXXXXX.caffemodel",
"pose/body_25b/pose_iter_XXXXXX.caffemodel",
"pose/body_95/pose_iter_XXXXXX.caffemodel",
};
// Constant Array Parameters
// POSE_NUMBER_BODY_PARTS equivalent to size of std::map POSE_BODY_XX_BODY_PARTS - 1 (removing background)
const std::array<unsigned int, (int)PoseModel::Size> POSE_NUMBER_BODY_PARTS{
25, 18, 15, 15, 19, 19, 19, 25, 65, 12, 25, 23, 22, 19, 25
25, 18, 15, 15, 19, 19, 19, 25, 65, 12, 25, 23, 22, 19, 25, 95
};
const std::array<std::vector<unsigned int>, (int)PoseModel::Size> POSE_BODY_PART_PAIRS{
// BODY_25
......@@ -454,25 +529,43 @@ namespace op
// Redundant ones
// MPII redundant, ears, ears-shoulders, shoulders-wrists, wrists, wrists-hips, hips, ankles)
6,17, 6,18, 3,4, 3,5, 4,6, 5,9, 6,10, 9,10, 9,11, 10,12, 11,12, 15,16
},
// BODY_95
std::vector<unsigned int>{
// Minimum spanning tree
// |------------------------------------------- COCO Body -------------------------------------------|
0,1, 0,2, 1,3, 2,4, 0,5, 0,6, 5,7, 6,8, 7,9, 8,10, 5,11, 6,12, 11,13, 12,14, 13,15, 14,16,
// |------------------ Foot ------------------| |-- MPII --|
15,19, 19,20, 15,21, 16,22, 22,23, 16,24, 5,17, 5,18,
// Redundant ones
// MPII redundant, ears, ears-shoulders, shoulders-wrists, wrists, wrists-hips, hips, ankles)
6,17, 6,18, 3,4, 3,5, 4,6, 5,9, 6,10, 9,10, 9,11, 10,12, 11,12, 15,16,
// COCO-Face
0,F95+30, 2,F95+39,1,F95+42,
// Face
// Contour
F95+0,F95+1, F95+1,F95+2, F95+2,F95+3, F95+3,F95+4, F95+4,F95+5, F95+5,F95+6, F95+6,F95+7, F95+7,F95+8,
F95+8,F95+9, F95+9,F95+10, F95+10,F95+11, F95+11,F95+12, F95+12,F95+13, F95+13,F95+14, F95+14,F95+15,
F95+15,F95+16,
// Countour-Eyebrow + Eyebrows
F95+0,F95+17, F95+16,F95+26, F95+17,F95+18, F95+18,F95+19, F95+19,F95+20, F95+20,F95+21, F95+21,F95+22,
F95+22,F95+23, F95+23,F95+24, F95+24,F95+25, F95+25,F95+26,
// Eyebrow-Nose + Nose
F95+21,F95+27, F95+22,F95+27, F95+27,F95+28, F95+28,F95+29, F95+29,F95+30, F95+30,F95+33, F95+33,F95+32,
F95+32,F95+31, F95+33,F95+34, F95+34,F95+35,
// Nose-Eyes + Eyes
F95+27,F95+39, F95+27,F95+42, F95+36,F95+37, F95+37,F95+38, F95+38,F95+39, F95+39,F95+40, F95+40,F95+41,
F95+42,F95+43, F95+43,F95+44, F95+44,F95+45, F95+45,F95+46, F95+46,F95+47,
// Nose-Mouth + Outer Mouth
F95+33,F95+51, F95+48,F95+49, F95+49,F95+50, F95+50,F95+51, F95+51,F95+52, F95+52,F95+53, F95+53,F95+54,
F95+54,F95+55, F95+55,F95+56, F95+56,F95+57, F95+57,F95+58, F95+58,F95+59,
// Outer-Inner + Inner Mouth
F95+48,F95+60, F95+54,F95+64, F95+60,F95+61, F95+61,F95+62, F95+62,F95+63, F95+63,F95+64, F95+64,F95+65,
F95+65,F95+66, F95+66,F95+67//,
// // Eyes-Pupils
// F95+36,F95+68, F95+39,F95+68, F95+42,F95+69, F95+45,F95+69
}
};
const std::array<float, (int)PoseModel::Size> POSE_CCN_DECREASE_FACTOR{
8.f, // BODY_25
8.f, // COCO
8.f, // MPI_15
8.f, // MPI_15_4
8.f, // BODY_19
4.f, // BODY_19_X2
8.f, // BODY_19N
8.f, // BODY_25E
8.f, // BODY_65
8.f, // CAR_12
8.f, // BODY_25D
8.f, // BODY_23
8.f, // CAR_22
8.f, // BODY_19E
8.f, // BODY_25B
};
const std::map<unsigned int, std::string>& getPoseBodyPartMapping(const PoseModel poseModel)
{
......@@ -569,7 +662,7 @@ namespace op
{
try
{
return POSE_CCN_DECREASE_FACTOR.at((int)poseModel);
return (poseModel != PoseModel::BODY_19_X2 ? 8.f : 4.f);
}
catch (const std::exception& e)
{
......@@ -688,4 +781,17 @@ namespace op
return 0.f;
}
}
bool addBkgChannel(const PoseModel poseModel)
{
try
{
return (poseModel != PoseModel::BODY_25B && poseModel != PoseModel::BODY_95);
}
catch (const std::exception& e)
{
error(e.what(), __LINE__, __FUNCTION__, __FILE__);
return false;
}
}
}
......@@ -19,6 +19,7 @@ namespace op
std::vector<float>{POSE_CAR_22_SCALES_RENDER_GPU}, // CAR_22
std::vector<float>{POSE_BODY_19_SCALES_RENDER_GPU}, // BODY_19E
std::vector<float>{POSE_BODY_25B_SCALES_RENDER_GPU}, // BODY_25B
std::vector<float>{POSE_BODY_95_SCALES_RENDER_GPU}, // BODY_95
};
const std::array<std::vector<float>, (int)PoseModel::Size> POSE_COLORS{
std::vector<float>{POSE_BODY_25_COLORS_RENDER_GPU}, // BODY_25
......@@ -36,6 +37,7 @@ namespace op
std::vector<float>{POSE_CAR_22_COLORS_RENDER_GPU}, // CAR_22
std::vector<float>{POSE_BODY_19_COLORS_RENDER_GPU}, // BODY_19E
std::vector<float>{POSE_BODY_25B_COLORS_RENDER_GPU}, // BODY_25B
std::vector<float>{POSE_BODY_95_COLORS_RENDER_GPU}, // BODY_95
};
const std::array<std::vector<unsigned int>, (int)PoseModel::Size> POSE_BODY_PART_PAIRS_RENDER{
std::vector<unsigned int>{POSE_BODY_25_PAIRS_RENDER_GPU}, // BODY_25
......@@ -53,6 +55,7 @@ namespace op
std::vector<unsigned int>{POSE_CAR_22_PAIRS_RENDER_GPU}, // CAR_22
std::vector<unsigned int>{POSE_BODY_19_PAIRS_RENDER_GPU}, // BODY_19E
std::vector<unsigned int>{POSE_BODY_25B_PAIRS_RENDER_GPU}, // BODY_25B
std::vector<unsigned int>{POSE_BODY_95_PAIRS_RENDER_GPU}, // BODY_95
};
// Rendering functions
......
......@@ -10,16 +10,20 @@ namespace op
{
try
{
// Variables
auto partToName = getPoseBodyPartMapping(poseModel);
const auto& bodyPartPairs = getPosePartPairs(poseModel);
const auto& mapIdx = getPoseMapIndex(poseModel);
const auto numberBodyParts = getPoseNumberBodyParts(poseModel);
const auto numberBodyPartsPlusBkg = numberBodyParts+(poseModel != PoseModel::BODY_25B ? 1 : 0);
// Sanity check
const auto numberBodyPartsPlusBkg = numberBodyParts+(addBkgChannel(poseModel) ? 1 : 0);
// Sanity checks
if (bodyPartPairs.size() != mapIdx.size())
error("The variables bodyPartPairs and mapIdx should have the same size.",
error("The variables bodyPartPairs and mapIdx should have the same size ("
+ std::to_string(bodyPartPairs.size()) + " vs. "
+ std::to_string(mapIdx.size()) + ").",
__LINE__, __FUNCTION__, __FILE__);
if (partToName.empty())
error("Variable partToName is empty.", __LINE__, __FUNCTION__, __FILE__);
// PAFs
for (auto bodyPart = 0u; bodyPart < bodyPartPairs.size(); bodyPart+=2)
{
......@@ -46,7 +50,7 @@ namespace op
}
}
}
// Return result
return partToName;
}
catch (const std::exception& e)
......
......@@ -15,6 +15,7 @@ namespace op
__constant__ const unsigned int BODY_23_PAIRS_GPU[] = {POSE_BODY_23_PAIRS_RENDER_GPU};
__constant__ const unsigned int BODY_25B_PAIRS_GPU[] = {POSE_BODY_25B_PAIRS_RENDER_GPU};
__constant__ const unsigned int BODY_65_PAIRS_GPU[] = {POSE_BODY_65_PAIRS_RENDER_GPU};
__constant__ const unsigned int BODY_95_PAIRS_GPU[] = {POSE_BODY_95_PAIRS_RENDER_GPU};
__constant__ const unsigned int MPI_PAIRS_GPU[] = {POSE_MPI_PAIRS_RENDER_GPU};
__constant__ const unsigned int CAR_12_PAIRS_GPU[] = {POSE_CAR_12_PAIRS_RENDER_GPU};
__constant__ const unsigned int CAR_22_PAIRS_GPU[] = {POSE_CAR_22_PAIRS_RENDER_GPU};
......@@ -25,6 +26,7 @@ namespace op
__constant__ const float BODY_23_SCALES[] = {POSE_BODY_23_SCALES_RENDER_GPU};
__constant__ const float BODY_25B_SCALES[] = {POSE_BODY_25B_SCALES_RENDER_GPU};
__constant__ const float BODY_65_SCALES[] = {POSE_BODY_65_SCALES_RENDER_GPU};
__constant__ const float BODY_95_SCALES[] = {POSE_BODY_95_SCALES_RENDER_GPU};
__constant__ const float MPI_SCALES[] = {POSE_MPI_SCALES_RENDER_GPU};
__constant__ const float CAR_12_SCALES[] = {POSE_CAR_12_SCALES_RENDER_GPU};
__constant__ const float CAR_22_SCALES[] = {POSE_CAR_22_SCALES_RENDER_GPU};
......@@ -35,6 +37,7 @@ namespace op
__constant__ const float BODY_23_COLORS[] = {POSE_BODY_23_COLORS_RENDER_GPU};
__constant__ const float BODY_25B_COLORS[] = {POSE_BODY_25B_COLORS_RENDER_GPU};
__constant__ const float BODY_65_COLORS[] = {POSE_BODY_65_COLORS_RENDER_GPU};
__constant__ const float BODY_95_COLORS[] = {POSE_BODY_95_COLORS_RENDER_GPU};
__constant__ const float MPI_COLORS[] = {POSE_MPI_COLORS_RENDER_GPU};
__constant__ const float CAR_12_COLORS[] = {POSE_CAR_12_COLORS_RENDER_GPU};
__constant__ const float CAR_22_COLORS[] = {POSE_CAR_22_COLORS_RENDER_GPU};
......@@ -280,6 +283,33 @@ namespace op
blendOriginalFrame, (googlyEyes ? 15 : -1), (googlyEyes ? 16 : -1));
}
__global__ void renderPoseBody95(float* targetPtr, const int targetWidth, const int targetHeight,
const float* const posePtr, const int numberPeople, const float threshold,
const bool googlyEyes, const bool blendOriginalFrame, const float alphaColorToAdd)
{
const auto x = (blockIdx.x * blockDim.x) + threadIdx.x;
const auto y = (blockIdx.y * blockDim.y) + threadIdx.y;
const auto globalIdx = threadIdx.y * blockDim.x + threadIdx.x;
// Shared parameters
__shared__ float2 sharedMins[POSE_MAX_PEOPLE];
__shared__ float2 sharedMaxs[POSE_MAX_PEOPLE];
__shared__ float sharedScaleF[POSE_MAX_PEOPLE];
// Other parameters
const auto numberPartPairs = sizeof(BODY_95_PAIRS_GPU) / (2*sizeof(BODY_95_PAIRS_GPU[0]));
const auto numberScales = sizeof(BODY_95_SCALES) / sizeof(BODY_95_SCALES[0]);
const auto numberColors = sizeof(BODY_95_COLORS) / (3*sizeof(BODY_95_COLORS[0]));
const auto radius = fastMin(targetWidth, targetHeight) / 100.f;
const auto lineWidth = fastMin(targetWidth, targetHeight) / 120.f;
// Render key points
renderKeypoints(targetPtr, sharedMaxs, sharedMins, sharedScaleF, globalIdx, x, y, targetWidth, targetHeight,
posePtr, BODY_95_PAIRS_GPU, numberPeople, 95, numberPartPairs, BODY_95_COLORS, numberColors,
radius, lineWidth, BODY_95_SCALES, numberScales, threshold, alphaColorToAdd,
blendOriginalFrame, (googlyEyes ? 1 : -1), (googlyEyes ? 2 : -1));
}
__global__ void renderPoseMpi29Parts(float* targetPtr, const int targetWidth, const int targetHeight,
const float* const posePtr, const int numberPeople, const float threshold,
const bool blendOriginalFrame, const float alphaColorToAdd)
......@@ -604,6 +634,11 @@ namespace op
framePtr, frameSize.x, frameSize.y, posePtr, numberPeople, renderThreshold, googlyEyes,
blendOriginalFrame, alphaBlending
);
else if (poseModel == PoseModel::BODY_95)
renderPoseBody95<<<threadsPerBlock, numBlocks>>>(
framePtr, frameSize.x, frameSize.y, posePtr, numberPeople, renderThreshold, googlyEyes,
blendOriginalFrame, alphaBlending
);
else if (poseModel == PoseModel::MPI_15 || poseModel == PoseModel::MPI_15_4)
renderPoseMpi29Parts<<<threadsPerBlock, numBlocks>>>(
framePtr, frameSize.x, frameSize.y, posePtr, numberPeople, renderThreshold,
......
......@@ -36,6 +36,8 @@ namespace op
return PoseModel::BODY_25E;
else if (poseModeString == "BODY_65")
return PoseModel::BODY_65;
else if (poseModeString == "BODY_95")
return PoseModel::BODY_95;
// Car pose
else if (poseModeString == "CAR_12")
return PoseModel::CAR_12;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册