Browse Source

[to #42322933] unify keys forbody_3d_keypoints

统一关键点检测输出key的名字
        Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/10359335
master
hanyuan.chy yingda.chen 3 years ago
parent
commit
67d6fa001d
3 changed files with 5 additions and 5 deletions
  1. +2
    -2
      modelscope/outputs.py
  2. +2
    -2
      modelscope/pipelines/cv/body_3d_keypoints_pipeline.py
  3. +1
    -1
      tests/pipelines/test_body_3d_keypoints.py

+ 2
- 2
modelscope/outputs.py View File

@@ -222,7 +222,7 @@ TASK_OUTPUTS = {

# 3D human body keypoints detection result for single sample
# {
# "poses": [ # 3d pose coordinate in camera coordinate
# "keypoints": [ # 3d pose coordinate in camera coordinate
# [[x, y, z]*17], # joints of per image
# [[x, y, z]*17],
# ...
@@ -236,7 +236,7 @@ TASK_OUTPUTS = {
# and is only avaialbe when the "render" option is enabled.
# }
Tasks.body_3d_keypoints:
[OutputKeys.POSES, OutputKeys.TIMESTAMPS, OutputKeys.OUTPUT_VIDEO],
[OutputKeys.KEYPOINTS, OutputKeys.TIMESTAMPS, OutputKeys.OUTPUT_VIDEO],

# 2D hand keypoints result for single sample
# {


+ 2
- 2
modelscope/pipelines/cv/body_3d_keypoints_pipeline.py View File

@@ -180,7 +180,7 @@ class Body3DKeypointsPipeline(Pipeline):
return res

def postprocess(self, input: Dict[str, Any], **kwargs) -> Dict[str, Any]:
res = {OutputKeys.POSES: [], OutputKeys.TIMESTAMPS: []}
res = {OutputKeys.KEYPOINTS: [], OutputKeys.TIMESTAMPS: []}

if not input['success']:
pass
@@ -197,7 +197,7 @@ class Body3DKeypointsPipeline(Pipeline):
self.render_prediction(pred_3d_pose, output_video_path)
res[OutputKeys.OUTPUT_VIDEO] = output_video_path

res[OutputKeys.POSES] = pred_3d_pose
res[OutputKeys.KEYPOINTS] = pred_3d_pose
res[OutputKeys.TIMESTAMPS] = self.timestamps
return res



+ 1
- 1
tests/pipelines/test_body_3d_keypoints.py View File

@@ -21,7 +21,7 @@ class Body3DKeypointsTest(unittest.TestCase, DemoCompatibilityCheck):

def pipeline_inference(self, pipeline: Pipeline, pipeline_input):
output = pipeline(pipeline_input, output_video='./result.mp4')
poses = np.array(output[OutputKeys.POSES])
poses = np.array(output[OutputKeys.KEYPOINTS])
print(f'result 3d points shape {poses.shape}')

@unittest.skipUnless(test_level() >= 0, 'skip test in current test level')


Loading…
Cancel
Save