提交 59ae459d 编写于 作者: G gineshidalgo99

Slightly improved accuracy with ear-shoulder connection

上级 37b1dc55
......@@ -106,5 +106,6 @@ OpenPose Library - Release Notes
1. Main improvements:
1. Added how to use keypoint data in `examples/tutorial_wrapper/`.
2. Added flag for warnings of type `-Wsign-compare` and removed in code.
3. Slightly improved accuracy by considering ears-shoulder connection (e.g. 0.4 mAP for 1 scale in validation set).
2. Main bugs fixed:
1. Windows version crashing with std::map copy.
# Script for internal use. We might completely change it continuously and we will not answer questions about it.
clear && clear
# USAGE EXAMPLE
# clear && clear && make all -j24 && bash ./examples/tests/pose_accuracy_coco_test.sh
# # Go back to main folder
# cd ../../
# Write COCO-format JSON
# Note: `--frame_last 3558` --> total = 3559 frames
# Last id:
# ID 20671 <--> #frames = 1471 --> ~ 1.5 min at 15fps
# ID 50006 <--> #frames = 3559 --> ~ 4 min at 15fps
# Parameters
IMAGE_FOLDER=/home/gines/devel/images/val2014/
$JSON_FOLDER=../evaluation/coco/results/openpose/
OP_BIN=./build/examples/openpose/openpose.bin
# 1 scale
./build/examples/openpose/openpose.bin --image_dir "/home/gines/devel/images/val2014" --write_coco_json ../evaluation/coco/results/openpose/1.json --no_display --render_pose 0 --frame_last 3558
$OP_BIN --image_dir $IMAGE_FOLDER --write_coco_json ${JSON_FOLDER}1_test.json --no_display --render_pose 0 --frame_last 3558
# # 3 scales
# ./build/examples/openpose/openpose.bin --image_dir "/home/gines/devel/images/val2014" --write_coco_json ../evaluation/coco/results/openpose/1_3.json --no_display --render_pose 0 --scale_number 3 --scale_gap 0.25 --frame_last 3558
# $OP_BIN --image_dir $IMAGE_FOLDER --write_coco_json ${JSON_FOLDER}1_3.json --no_display --render_pose 0 --scale_number 3 --scale_gap 0.25 --frame_last 3558
# # 4 scales
# ./build/examples/openpose/openpose.bin --num_gpu 1 --image_dir "/home/gines/devel/images/val2014" --write_coco_json ../evaluation/coco/results/openpose/1_4.json --no_display --render_pose 0 --num_gpu 1 --scale_number 4 --scale_gap 0.25 --net_resolution "1312x736" --frame_last 3558
# $OP_BIN --num_gpu 1 --image_dir $IMAGE_FOLDER --write_coco_json ${JSON_FOLDER}1_4.json --no_display --render_pose 0 --num_gpu 1 --scale_number 4 --scale_gap 0.25 --net_resolution "1312x736" --frame_last 3558
# Debugging - Rendered frames saved
# ./build/examples/openpose/openpose.bin --image_dir "/home/gines/devel/images/val2014" --write_images ../evaluation/coco/results/openpose/frameOutput --no_display
# $OP_BIN --image_dir $IMAGE_FOLDER --write_images ${JSON_FOLDER}frameOutput --no_display
......@@ -19,8 +19,8 @@ namespace op
const auto numberBodyPartPairs = bodyPartPairs.size() / 2;
std::vector<std::pair<std::vector<int>, double>> subset; // Vector<int> = Each body part + body parts counter; double = subsetScore
const auto subsetCounterIndex = numberBodyParts+1;
const auto subsetSize = numberBodyParts+2;
const auto subsetCounterIndex = numberBodyParts;
const auto subsetSize = numberBodyParts+1;
const auto peaksOffset = 3*(maxPeaks+1);
const auto heatMapOffset = heatMapSize.area();
......@@ -38,7 +38,7 @@ namespace op
if (nA == 0 || nB == 0)
{
// Change w.r.t. other
if (nB != 0)
if (nA == 0) // nB == 0 or not
{
if (poseModel == PoseModel::COCO_18 || poseModel == PoseModel::BODY_18 || poseModel == PoseModel::BODY_22)
{
......@@ -79,7 +79,7 @@ namespace op
else
error("Unknown model, cast to int = " + std::to_string((int)poseModel), __LINE__, __FUNCTION__, __FILE__);
}
else if (nA != 0)
else // if (nA != 0 && nB == 0)
{
if (poseModel == PoseModel::COCO_18 || poseModel == PoseModel::BODY_18 || poseModel == PoseModel::BODY_22)
{
......@@ -121,7 +121,7 @@ namespace op
error("Unknown model, cast to int = " + std::to_string((int)poseModel), __LINE__, __FUNCTION__, __FILE__);
}
}
else
else // if (nA != 0 && nB != 0)
{
std::vector<std::tuple<double, int, int>> temp;
const auto numInter = 10;
......@@ -159,7 +159,7 @@ namespace op
}
}
// parts score + cpnnection score
// parts score + connection score
if (count > interMinAboveThreshold)
temp.emplace_back(std::make_tuple(sum/count, i, j));
}
......@@ -213,24 +213,24 @@ namespace op
subset.emplace_back(std::make_pair(rowVector, subsetScore));
}
}
// // Add ears connections (in case person is looking to opposite direction to camera)
// else if (poseModel == PoseModel::COCO_18 && (pairIndex==16 || pairIndex==17))
// {
// for (const auto& connectionKI : connectionK)
// {
// const auto indexA = std::get<0>(connectionKI);
// const auto indexB = std::get<1>(connectionKI);
// for (auto& subsetJ : subset)
// {
// auto& subsetJFirst = subsetJ.first[bodyPartA];
// auto& subsetJFirstPlus1 = subsetJFirst[bodyPartB];
// if (subsetJFirst == indexA && subsetJFirstPlus1 == 0)
// subsetJFirstPlus1 = indexB;
// else if (subsetJFirstPlus1 == indexB && subsetJFirst == 0)
// subsetJFirst = indexA;
// }
// }
// }
// Add ears connections (in case person is looking to opposite direction to camera)
else if (poseModel == PoseModel::COCO_18 && (pairIndex==17 || pairIndex==18))
{
for (const auto& connectionKI : connectionK)
{
const auto indexA = std::get<0>(connectionKI);
const auto indexB = std::get<1>(connectionKI);
for (auto& subsetJ : subset)
{
auto& subsetJFirst = subsetJ.first[bodyPartA];
auto& subsetJFirstPlus1 = subsetJ.first[bodyPartB];
if (subsetJFirst == indexA && subsetJFirstPlus1 == 0)
subsetJFirstPlus1 = indexB;
else if (subsetJFirstPlus1 == indexB && subsetJFirst == 0)
subsetJFirst = indexA;
}
}
}
else
{
if (!connectionK.empty())
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册