@@ -19,8 +19,8 @@ namespace op
1919 const auto numberBodyPartPairs = bodyPartPairs.size () / 2 ;
2020
2121 std::vector<std::pair<std::vector<int >, double >> subset; // Vector<int> = Each body part + body parts counter; double = subsetScore
22- const auto subsetCounterIndex = numberBodyParts+ 1 ;
23- const auto subsetSize = numberBodyParts+2 ;
22+ const auto subsetCounterIndex = numberBodyParts;
23+ const auto subsetSize = numberBodyParts+1 ;
2424
2525 const auto peaksOffset = 3 *(maxPeaks+1 );
2626 const auto heatMapOffset = heatMapSize.area ();
@@ -38,7 +38,7 @@ namespace op
3838 if (nA == 0 || nB == 0 )
3939 {
4040 // Change w.r.t. other
41- if (nB != 0 )
41+ if (nA == 0 ) // nB == 0 or not
4242 {
4343 if (poseModel == PoseModel::COCO_18 || poseModel == PoseModel::BODY_18 || poseModel == PoseModel::BODY_22)
4444 {
@@ -79,7 +79,7 @@ namespace op
7979 else
8080 error (" Unknown model, cast to int = " + std::to_string ((int )poseModel), __LINE__, __FUNCTION__, __FILE__);
8181 }
82- else if (nA != 0 )
82+ else // if (nA != 0 && nB = = 0)
8383 {
8484 if (poseModel == PoseModel::COCO_18 || poseModel == PoseModel::BODY_18 || poseModel == PoseModel::BODY_22)
8585 {
@@ -121,7 +121,7 @@ namespace op
121121 error (" Unknown model, cast to int = " + std::to_string ((int )poseModel), __LINE__, __FUNCTION__, __FILE__);
122122 }
123123 }
124- else
124+ else // if (nA != 0 && nB != 0)
125125 {
126126 std::vector<std::tuple<double , int , int >> temp;
127127 const auto numInter = 10 ;
@@ -159,7 +159,7 @@ namespace op
159159 }
160160 }
161161
162- // parts score + cpnnection score
162+ // parts score + connection score
163163 if (count > interMinAboveThreshold)
164164 temp.emplace_back (std::make_tuple (sum/count, i, j));
165165 }
@@ -213,24 +213,24 @@ namespace op
213213 subset.emplace_back (std::make_pair (rowVector, subsetScore));
214214 }
215215 }
216- // // Add ears connections (in case person is looking to opposite direction to camera)
217- // else if (poseModel == PoseModel::COCO_18 && (pairIndex==16 || pairIndex==17 ))
218- // {
219- // for (const auto& connectionKI : connectionK)
220- // {
221- // const auto indexA = std::get<0>(connectionKI);
222- // const auto indexB = std::get<1>(connectionKI);
223- // for (auto& subsetJ : subset)
224- // {
225- // auto& subsetJFirst = subsetJ.first[bodyPartA];
226- // auto& subsetJFirstPlus1 = subsetJFirst [bodyPartB];
227- // if (subsetJFirst == indexA && subsetJFirstPlus1 == 0)
228- // subsetJFirstPlus1 = indexB;
229- // else if (subsetJFirstPlus1 == indexB && subsetJFirst == 0)
230- // subsetJFirst = indexA;
231- // }
232- // }
233- // }
216+ // Add ears connections (in case person is looking to opposite direction to camera)
217+ else if (poseModel == PoseModel::COCO_18 && (pairIndex==17 || pairIndex==18 ))
218+ {
219+ for (const auto & connectionKI : connectionK)
220+ {
221+ const auto indexA = std::get<0 >(connectionKI);
222+ const auto indexB = std::get<1 >(connectionKI);
223+ for (auto & subsetJ : subset)
224+ {
225+ auto & subsetJFirst = subsetJ.first [bodyPartA];
226+ auto & subsetJFirstPlus1 = subsetJ. first [bodyPartB];
227+ if (subsetJFirst == indexA && subsetJFirstPlus1 == 0 )
228+ subsetJFirstPlus1 = indexB;
229+ else if (subsetJFirstPlus1 == indexB && subsetJFirst == 0 )
230+ subsetJFirst = indexA;
231+ }
232+ }
233+ }
234234 else
235235 {
236236 if (!connectionK.empty ())
0 commit comments