Browse Source

[to #42322933] add cv_resnet50_live-category to maas lib

由于全规需要,修改了透出标签,将后台类目映射为前台类目,并修改了代码,不再透出层级类目,只透出最终细分类目。
        Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/9615279
master
qianming.lm yingda.chen 3 years ago
parent
commit
ca1c720cd9
3 changed files with 10 additions and 4 deletions
  1. +9
    -2
      modelscope/outputs.py
  2. +1
    -1
      modelscope/pipelines/cv/live_category_pipeline.py
  3. +0
    -1
      modelscope/utils/constant.py

+ 9
- 2
modelscope/outputs.py View File

@@ -159,10 +159,17 @@ TASK_OUTPUTS = {
# }
Tasks.action_recognition: [OutputKeys.LABELS],

# live category recognition result for single video
# {
# "scores": [0.885272, 0.014790631, 0.014558001],
# 'labels': ['修身型棉衣', '高腰牛仔裤', '休闲连体裤']
# }
Tasks.live_category: [OutputKeys.SCORES, OutputKeys.LABELS],

# video category recognition result for single video
# {
# "scores": [0.7716429233551025]
# "labels": ['生活>>好物推荐'],
# "scores": [0.7716429233551025],
# "labels": ['生活>>好物推荐']
# }
Tasks.video_category: [OutputKeys.SCORES, OutputKeys.LABELS],



+ 1
- 1
modelscope/pipelines/cv/live_category_pipeline.py View File

@@ -85,7 +85,7 @@ class LiveCategoryPipeline(Pipeline):
for label_key in label_keys:
if label_info[label_key] not in label_str:
label_str.append(label_info[label_key])
labels.append('>>'.join(label_str))
labels.append(label_str[-1])
return {OutputKeys.SCORES: list(scores), OutputKeys.LABELS: labels}

def postprocess(self, inputs: Dict[str, Any]) -> Dict[str, Any]:


+ 0
- 1
modelscope/utils/constant.py View File

@@ -61,7 +61,6 @@ class CVTasks(object):
video_category = 'video-category'

video_embedding = 'video-embedding'

virtual_try_on = 'virtual-try-on'




Loading…
Cancel
Save