Spaces:
Sleeping
Sleeping
fix: DWPose推定時のつま先左右順番を正しい仕様に統一
Browse files- 左つま先(18番): DWPose 18+19番平均(左足のつま先)
- 右つま先(19番): DWPose 21+22番平均(右足のつま先)
- 画像アップロード時のDWPose推定でつま先線がクロスしていた問題を解決
- テンプレートデータとDWPose推定結果の左右統一を完全実現
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- utils/dwpose_detector.py +10 -10
utils/dwpose_detector.py
CHANGED
|
@@ -618,16 +618,7 @@ class DWPoseDetector:
|
|
| 618 |
# 足のキーポイントを追加(refsの実装を参考)
|
| 619 |
converted_20 = converted_18.copy()
|
| 620 |
|
| 621 |
-
#
|
| 622 |
-
if len(keypoints) > 22 and keypoints[21][2] > 0 and keypoints[22][2] > 0:
|
| 623 |
-
right_toe_x = (keypoints[21][0] + keypoints[22][0]) / 2
|
| 624 |
-
right_toe_y = (keypoints[21][1] + keypoints[22][1]) / 2
|
| 625 |
-
right_toe_conf = min(keypoints[21][2], keypoints[22][2])
|
| 626 |
-
converted_20.append([right_toe_x, right_toe_y, right_toe_conf])
|
| 627 |
-
else:
|
| 628 |
-
converted_20.append([0.0, 0.0, 0.0])
|
| 629 |
-
|
| 630 |
-
# 左つま先(19番): DWPoseの18番と19番の平均
|
| 631 |
if len(keypoints) > 19 and keypoints[18][2] > 0 and keypoints[19][2] > 0:
|
| 632 |
left_toe_x = (keypoints[18][0] + keypoints[19][0]) / 2
|
| 633 |
left_toe_y = (keypoints[18][1] + keypoints[19][1]) / 2
|
|
@@ -636,6 +627,15 @@ class DWPoseDetector:
|
|
| 636 |
else:
|
| 637 |
converted_20.append([0.0, 0.0, 0.0])
|
| 638 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 639 |
return converted_20
|
| 640 |
|
| 641 |
def _convert_to_openpose_format(self, keypoints: List[List[float]]) -> List[List[float]]:
|
|
|
|
| 618 |
# 足のキーポイントを追加(refsの実装を参考)
|
| 619 |
converted_20 = converted_18.copy()
|
| 620 |
|
| 621 |
+
# 左つま先(18番): DWPoseの18番と19番の平均(左足のつま先)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 622 |
if len(keypoints) > 19 and keypoints[18][2] > 0 and keypoints[19][2] > 0:
|
| 623 |
left_toe_x = (keypoints[18][0] + keypoints[19][0]) / 2
|
| 624 |
left_toe_y = (keypoints[18][1] + keypoints[19][1]) / 2
|
|
|
|
| 627 |
else:
|
| 628 |
converted_20.append([0.0, 0.0, 0.0])
|
| 629 |
|
| 630 |
+
# 右つま先(19番): DWPoseの21番と22番の平均(右足のつま先)
|
| 631 |
+
if len(keypoints) > 22 and keypoints[21][2] > 0 and keypoints[22][2] > 0:
|
| 632 |
+
right_toe_x = (keypoints[21][0] + keypoints[22][0]) / 2
|
| 633 |
+
right_toe_y = (keypoints[21][1] + keypoints[22][1]) / 2
|
| 634 |
+
right_toe_conf = min(keypoints[21][2], keypoints[22][2])
|
| 635 |
+
converted_20.append([right_toe_x, right_toe_y, right_toe_conf])
|
| 636 |
+
else:
|
| 637 |
+
converted_20.append([0.0, 0.0, 0.0])
|
| 638 |
+
|
| 639 |
return converted_20
|
| 640 |
|
| 641 |
def _convert_to_openpose_format(self, keypoints: List[List[float]]) -> List[List[float]]:
|