grmchn Claude commited on
Commit
c3b6536
·
1 Parent(s): f87a6e7

fix: つま先線表示問題を解決するためpose_keypoints_2d配列に25キーポイント対応パディングを実装

Browse files

- export_utils.pyにて20個キーポイントから25個キーポイントへの自動パディング機能を追加
- people形式とbodies形式の両方でパディング処理を実装
- 他のDWPoseツールでのつま先線表示互換性を向上
- issue_042対応完了

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (1) hide show
  1. utils/export_utils.py +15 -0
utils/export_utils.py CHANGED
@@ -270,6 +270,14 @@ def export_pose_as_json(pose_data, include_metadata=False):
270
  # people形式が既に存在する場合はそのまま使用
271
  if 'people' in pose_data and pose_data['people']:
272
  person_data = pose_data['people'][0].copy()
 
 
 
 
 
 
 
 
273
  else:
274
  # bodies形式からpeople形式に変換
275
  if 'bodies' in pose_data and 'candidate' in pose_data['bodies']:
@@ -281,6 +289,13 @@ def export_pose_as_json(pose_data, include_metadata=False):
281
  candidate[1],
282
  candidate[2] if len(candidate) > 2 else 1.0
283
  ])
 
 
 
 
 
 
 
284
 
285
  # 手データ
286
  if 'hands' in pose_data and pose_data['hands']:
 
270
  # people形式が既に存在する場合はそのまま使用
271
  if 'people' in pose_data and pose_data['people']:
272
  person_data = pose_data['people'][0].copy()
273
+
274
+ # 🦶✨ DWPose 25キーポイント対応:people形式でもパディング確認
275
+ if "pose_keypoints_2d" in person_data:
276
+ keypoint_count = len(person_data["pose_keypoints_2d"]) // 3
277
+ if keypoint_count < 25:
278
+ padding_needed = 25 - keypoint_count
279
+ for _ in range(padding_needed):
280
+ person_data["pose_keypoints_2d"].extend([0, 0, 0])
281
  else:
282
  # bodies形式からpeople形式に変換
283
  if 'bodies' in pose_data and 'candidate' in pose_data['bodies']:
 
289
  candidate[1],
290
  candidate[2] if len(candidate) > 2 else 1.0
291
  ])
292
+
293
+ # 🦶✨ DWPose 25キーポイント対応:25個未満の場合は0でパディング
294
+ keypoint_count = len(person_data["pose_keypoints_2d"]) // 3
295
+ if keypoint_count < 25:
296
+ padding_needed = 25 - keypoint_count
297
+ for _ in range(padding_needed):
298
+ person_data["pose_keypoints_2d"].extend([0, 0, 0])
299
 
300
  # 手データ
301
  if 'hands' in pose_data and pose_data['hands']: