camenduru commited on
Commit
4e5ceef
·
1 Parent(s): 467084c

thanks to facechain ❤

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +4 -0
  2. ast_indexer +0 -0
  3. hub/Cherrytest/rot_bgr/.mdl +0 -0
  4. hub/Cherrytest/rot_bgr/.msc +0 -0
  5. hub/Cherrytest/rot_bgr/README.md +12 -0
  6. hub/Cherrytest/rot_bgr/rot_bgr.onnx +3 -0
  7. hub/Cherrytest/zjz_mj_jiyi_small_addtxt_fromleo/.mdl +0 -0
  8. hub/Cherrytest/zjz_mj_jiyi_small_addtxt_fromleo/.msc +0 -0
  9. hub/Cherrytest/zjz_mj_jiyi_small_addtxt_fromleo/README.md +12 -0
  10. hub/Cherrytest/zjz_mj_jiyi_small_addtxt_fromleo/zjz_mj_jiyi_small_addtxt_fromleo.safetensors +3 -0
  11. hub/damo/cv_ddsar_face-detection_iclr23-damofd/.mdl +0 -0
  12. hub/damo/cv_ddsar_face-detection_iclr23-damofd/.msc +0 -0
  13. hub/damo/cv_ddsar_face-detection_iclr23-damofd/DamoFD_lms.py +166 -0
  14. hub/damo/cv_ddsar_face-detection_iclr23-damofd/README.md +214 -0
  15. hub/damo/cv_ddsar_face-detection_iclr23-damofd/configuration.json +14 -0
  16. hub/damo/cv_ddsar_face-detection_iclr23-damofd/pytorch_model.pt +3 -0
  17. hub/damo/cv_ir101_facerecognition_cfglint/.mdl +0 -0
  18. hub/damo/cv_ir101_facerecognition_cfglint/.msc +0 -0
  19. hub/damo/cv_ir101_facerecognition_cfglint/README.md +84 -0
  20. hub/damo/cv_ir101_facerecognition_cfglint/configuration.json +7 -0
  21. hub/damo/cv_ir101_facerecognition_cfglint/description/SCRFD-sota.jpg +0 -0
  22. hub/damo/cv_ir101_facerecognition_cfglint/pytorch_model.bin +3 -0
  23. hub/damo/cv_ir_face-recognition-ood_rts/.mdl +0 -0
  24. hub/damo/cv_ir_face-recognition-ood_rts/.msc +0 -0
  25. hub/damo/cv_ir_face-recognition-ood_rts/README.md +153 -0
  26. hub/damo/cv_ir_face-recognition-ood_rts/configuration.json +14 -0
  27. hub/damo/cv_ir_face-recognition-ood_rts/pytorch_model.pt +3 -0
  28. hub/damo/cv_ir_face-recognition-ood_rts/rts.png +0 -0
  29. hub/damo/cv_manual_face-quality-assessment_fqa/.mdl +0 -0
  30. hub/damo/cv_manual_face-quality-assessment_fqa/.msc +0 -0
  31. hub/damo/cv_manual_face-quality-assessment_fqa/README.md +80 -0
  32. hub/damo/cv_manual_face-quality-assessment_fqa/arcface.jpg +0 -0
  33. hub/damo/cv_manual_face-quality-assessment_fqa/arch.jpg +0 -0
  34. hub/damo/cv_manual_face-quality-assessment_fqa/configuration.json +7 -0
  35. hub/damo/cv_manual_face-quality-assessment_fqa/model.onnx +3 -0
  36. hub/damo/cv_manual_face-quality-assessment_fqa/performance.jpg +0 -0
  37. hub/damo/cv_manual_face-quality-assessment_fqa/quality_rank.jpg +0 -0
  38. hub/damo/cv_manual_face-quality-assessment_fqa/result.png +0 -0
  39. hub/damo/cv_manual_facial-landmark-confidence_flcm/.mdl +0 -0
  40. hub/damo/cv_manual_facial-landmark-confidence_flcm/.msc +0 -0
  41. hub/damo/cv_manual_facial-landmark-confidence_flcm/FLC.png +0 -0
  42. hub/damo/cv_manual_facial-landmark-confidence_flcm/README.md +151 -0
  43. hub/damo/cv_manual_facial-landmark-confidence_flcm/configuration.json +7 -0
  44. hub/damo/cv_manual_facial-landmark-confidence_flcm/flc_demo.png +0 -0
  45. hub/damo/cv_manual_facial-landmark-confidence_flcm/flc_demo_1.jpg +0 -0
  46. hub/damo/cv_manual_facial-landmark-confidence_flcm/pytorch_model.pt +3 -0
  47. hub/damo/cv_resnet101_image-multiple-human-parsing/.mdl +0 -0
  48. hub/damo/cv_resnet101_image-multiple-human-parsing/.msc +0 -0
  49. hub/damo/cv_resnet101_image-multiple-human-parsing/README.md +131 -0
  50. hub/damo/cv_resnet101_image-multiple-human-parsing/configuration.json +97 -0
.gitattributes CHANGED
@@ -33,3 +33,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ hub/damo/cv_resnet50_face-detection_retinaface/result.png filter=lfs diff=lfs merge=lfs -text
37
+ hub/damo/cv_unet-image-face-fusion_damo/BFM/BFM_model_front.mat filter=lfs diff=lfs merge=lfs -text
38
+ hub/damo/cv_unet-image-face-fusion_damo/description/Picture1.png filter=lfs diff=lfs merge=lfs -text
39
+ hub/damo/cv_unet-image-face-fusion_damo/description/demo.png filter=lfs diff=lfs merge=lfs -text
ast_indexer ADDED
The diff for this file is too large to render. See raw diff
 
hub/Cherrytest/rot_bgr/.mdl ADDED
Binary file (41 Bytes). View file
 
hub/Cherrytest/rot_bgr/.msc ADDED
Binary file (159 Bytes). View file
 
hub/Cherrytest/rot_bgr/README.md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ #以下为文本生成的 "tasks"示例,您可以从此网页中了解更多相关信息:https://modelscope.cn/docs/%E4%BB%BB%E5%8A%A1%E7%9A%84%E4%BB%8B%E7%BB%8D
3
+ #tasks:
4
+ #- text-generation
5
+ license: Apache License 2.0
6
+ ---
7
+ ###### 该模型当前使用的是默认介绍模版,处于“预发布”阶段,页面仅限所有者可见。
8
+ ###### 请根据[模型贡献文档说明](https://www.modelscope.cn/docs/%E5%A6%82%E4%BD%95%E6%92%B0%E5%86%99%E5%A5%BD%E7%94%A8%E7%9A%84%E6%A8%A1%E5%9E%8B%E5%8D%A1%E7%89%87),及时完善模型卡片内容。ModelScope平台将在模型卡片完善后展示。谢谢您的理解。
9
+ #### Clone with HTTP
10
+ ```bash
11
+ git clone https://www.modelscope.cn/Cherrytest/rot_bgr.git
12
+ ```
hub/Cherrytest/rot_bgr/rot_bgr.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:45f2f021efe2311afb49db0d919795659884db97bbf6dcaf3ac69cbaed7a6464
3
+ size 44699637
hub/Cherrytest/zjz_mj_jiyi_small_addtxt_fromleo/.mdl ADDED
Binary file (66 Bytes). View file
 
hub/Cherrytest/zjz_mj_jiyi_small_addtxt_fromleo/.msc ADDED
Binary file (191 Bytes). View file
 
hub/Cherrytest/zjz_mj_jiyi_small_addtxt_fromleo/README.md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ #以下为文本生成的 "tasks"示例,您可以从此网页中了解更多相关信息:https://modelscope.cn/docs/%E4%BB%BB%E5%8A%A1%E7%9A%84%E4%BB%8B%E7%BB%8D
3
+ #tasks:
4
+ #- text-generation
5
+ license: Apache License 2.0
6
+ ---
7
+ ###### 该模型当前使用的是默认介绍模版,处于“预发布”阶段,页面仅限所有者可见。
8
+ ###### 请根据[模型贡献文档说明](https://www.modelscope.cn/docs/%E5%A6%82%E4%BD%95%E6%92%B0%E5%86%99%E5%A5%BD%E7%94%A8%E7%9A%84%E6%A8%A1%E5%9E%8B%E5%8D%A1%E7%89%87),及时完善模型卡片内容。ModelScope平台将在模型卡片完善后展示。谢谢您的理解。
9
+ #### Clone with HTTP
10
+ ```bash
11
+ git clone https://www.modelscope.cn/Cherrytest/zjz_mj_jiyi_small_addtxt_fromleo.git
12
+ ```
hub/Cherrytest/zjz_mj_jiyi_small_addtxt_fromleo/zjz_mj_jiyi_small_addtxt_fromleo.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0c221b9db02c2fba619def80fcea06b7c1fd4613658b351a1f3840870fe5926d
3
+ size 37865201
hub/damo/cv_ddsar_face-detection_iclr23-damofd/.mdl ADDED
Binary file (65 Bytes). View file
 
hub/damo/cv_ddsar_face-detection_iclr23-damofd/.msc ADDED
Binary file (302 Bytes). View file
 
hub/damo/cv_ddsar_face-detection_iclr23-damofd/DamoFD_lms.py ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0005)
2
+ optimizer_config = dict(grad_clip=None)
3
+ lr_mult = 8
4
+ lr_config = dict(
5
+ policy='step',
6
+ warmup='linear',
7
+ warmup_iters=5000,
8
+ warmup_ratio=0.001,
9
+ step=[55*lr_mult, 68*lr_mult])
10
+ total_epochs = 80*lr_mult
11
+ checkpoint_config = dict(interval=10)
12
+ log_config = dict(interval=100, hooks=[dict(type='TextLoggerHook')])
13
+ dist_params = dict(backend='nccl')
14
+ log_level = 'INFO'
15
+ load_from = None #'work_dirs/scrfd_500m_zennas/epoch_640.pth_0.5_hard65_pp1024'
16
+ resume_from = None #"work_dirs/scrfd_500m_zennas/epoch_230.pth"
17
+ workflow = [('train', 1)]
18
+ dataset_type = 'RetinaFaceDataset'
19
+ data_root = 'data/retinaface/'
20
+ train_root = 'data/retinaface/train/'
21
+ val_root = 'data/retinaface/val/'
22
+ img_norm_cfg = dict(
23
+ mean=[127.5, 127.5, 127.5], std=[128.0, 128.0, 128.0], to_rgb=True)
24
+ data = dict(
25
+ samples_per_gpu=8,
26
+ workers_per_gpu=3,
27
+ train=dict(
28
+ type='RetinaFaceDataset',
29
+ ann_file='data/retinaface/train/labelv2.txt',
30
+ img_prefix='data/retinaface/train/images/',
31
+ pipeline=[
32
+ dict(type='LoadImageFromFile', to_float32=True),
33
+ dict(type='LoadAnnotationsV2', with_bbox=True, with_keypoints=True),
34
+ dict(type='RandomSquareCrop',crop_choice=[1.0, 1.2, 1.4, 1.6, 1.8, 2.0]),
35
+ dict(type='Resize', img_scale=(640, 640), keep_ratio=False),
36
+ dict(type='RandomFlip', flip_ratio=0.5),
37
+ dict(
38
+ type='PhotoMetricDistortion',
39
+ brightness_delta=32,
40
+ contrast_range=(0.5, 1.5),
41
+ saturation_range=(0.5, 1.5),
42
+ hue_delta=18),
43
+ dict(
44
+ type='Normalize',
45
+ mean=[127.5, 127.5, 127.5],
46
+ std=[128.0, 128.0, 128.0],
47
+ to_rgb=True),
48
+ dict(type='DefaultFormatBundleV2'),
49
+ dict(
50
+ type='Collect',
51
+ keys=[
52
+ 'img', 'gt_bboxes', 'gt_labels', 'gt_bboxes_ignore',
53
+ 'gt_keypointss'
54
+ ])
55
+ ]),
56
+ val=dict(
57
+ type='RetinaFaceDataset',
58
+ ann_file='data/retinaface/val/labelv2.txt',
59
+ img_prefix='data/retinaface/val/images/',
60
+ pipeline=[
61
+ dict(type='LoadImageFromFile'),
62
+ dict(
63
+ type='MultiScaleFlipAug',
64
+ img_scale=(640, 640),
65
+ flip=False,
66
+ transforms=[
67
+ dict(type='ResizeV2', keep_ratio=True),
68
+ dict(type='RandomFlipV2', flip_ratio=0.0),
69
+ dict(
70
+ type='Normalize',
71
+ mean=[127.5, 127.5, 127.5],
72
+ std=[128.0, 128.0, 128.0],
73
+ to_rgb=True),
74
+ dict(type='Pad', size=(640, 640), pad_val=0),
75
+ dict(type='ImageToTensor', keys=['img']),
76
+ dict(type='Collect', keys=['img'])
77
+ ])
78
+ ]),
79
+ test=dict(
80
+ type='RetinaFaceDataset',
81
+ ann_file='data/retinaface/val/labelv2.txt',
82
+ img_prefix='data/retinaface/val/images/',
83
+ pipeline=[
84
+ dict(type='LoadImageFromFile'),
85
+ dict(
86
+ type='MultiScaleFlipAug',
87
+ img_scale=(640, 640),
88
+ flip=False,
89
+ transforms=[
90
+ dict(type='ResizeV2', keep_ratio=True),
91
+ dict(type='RandomFlipV2', flip_ratio=0.0),
92
+ dict(
93
+ type='Normalize',
94
+ mean=[127.5, 127.5, 127.5],
95
+ std=[128.0, 128.0, 128.0],
96
+ to_rgb=True),
97
+ dict(type='Pad', size=(640, 640), pad_val=0),
98
+ dict(type='ImageToTensor', keys=['img']),
99
+ dict(type='Collect', keys=['img'])
100
+ ])
101
+ ]))
102
+ model = dict(
103
+ type='SCRFD',
104
+ backbone=dict(
105
+ type='MasterNet',
106
+ plainnet_struct='SuperConvK3BNRELU(3,32,2,1)SuperResIDWE1K3(32,32,2,8,1)SuperResIDWE1K7(32,64,2,40,1)SuperResIDWE1K7(64,120,2,40,2)SuperResIDWE1K5(120,160,2,120,1)'),
107
+ neck=dict(
108
+ type='PAFPN',
109
+ in_channels=[32, 64, 120, 160],
110
+ out_channels=16,
111
+ start_level=1,
112
+ add_extra_convs='on_output',
113
+ num_outs=3),
114
+ bbox_head=dict(
115
+ type='SCRFDHead',
116
+ num_classes=1,
117
+ in_channels=16,
118
+ stacked_convs=2,
119
+ feat_channels=64,
120
+ #norm_cfg=dict(type='BN', requires_grad=True),
121
+ norm_cfg=dict(type='GN', num_groups=16, requires_grad=True),
122
+ cls_reg_share=True,
123
+ strides_share=True,
124
+ dw_conv=True,
125
+ scale_mode=2,
126
+ anchor_generator=dict(
127
+ type='AnchorGenerator',
128
+ ratios=[1.0],
129
+ scales=[1, 2],
130
+ base_sizes=[16, 64, 256],
131
+ strides=[8, 16, 32]),
132
+ loss_cls=dict(
133
+ type='QualityFocalLoss',
134
+ use_sigmoid=True,
135
+ beta=2.0,
136
+ loss_weight=1.0),
137
+ loss_dfl=False,
138
+ reg_max=8,
139
+ loss_bbox=dict(type='DIoULoss', loss_weight=2.0),
140
+ use_kps=True,
141
+ loss_kps=dict(
142
+ type='SmoothL1Loss', beta=0.1111111111111111, loss_weight=0.1),
143
+ train_cfg=dict(
144
+ assigner=dict(type='ATSSAssigner', topk=9),
145
+ allowed_border=-1,
146
+ pos_weight=-1,
147
+ debug=False),
148
+ test_cfg=dict(
149
+ nms_pre=-1,
150
+ min_bbox_size=0,
151
+ score_thr=0.02,
152
+ nms=dict(type='nms', iou_threshold=0.45),
153
+ max_per_img=-1)),
154
+ train_cfg = dict(
155
+ assigner=dict(type='ATSSAssigner', topk=9),
156
+ allowed_border=-1,
157
+ pos_weight=-1,
158
+ debug=False),
159
+ test_cfg = dict(
160
+ nms_pre=-1,
161
+ min_bbox_size=0,
162
+ score_thr=0.02,
163
+ nms=dict(type='nms', iou_threshold=0.45),
164
+ max_per_img=-1))
165
+ epoch_multi = 1
166
+ evaluation = dict(interval=80, metric='mAP')
hub/damo/cv_ddsar_face-detection_iclr23-damofd/README.md ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ integrating: false
3
+ tasks:
4
+ - face-detection
5
+ widgets:
6
+ - task: face-detection
7
+ model_revision: v0.4
8
+ inputs:
9
+ - type: image
10
+ examples:
11
+ - name: 1
12
+ inputs:
13
+ - data: https://modelscope.oss-cn-beijing.aliyuncs.com/test/images/mog_face_detection.jpg
14
+ name: image
15
+ inferencespec:
16
+ cpu: 4
17
+ gpu: 1
18
+ gpu_memory: 16000
19
+ memory: 43000
20
+ domain:
21
+ - cv
22
+ tags:
23
+ - DamoFD
24
+ - ICLR23
25
+ frameworks:
26
+ - pytorch
27
+ backbone:
28
+ - Manual
29
+ metrics:
30
+ - AP
31
+ license: MIT License
32
+ datasets:
33
+ train:
34
+ - shaoxuan/WIDER_FACE
35
+ evaluation:
36
+ - shaoxuan/WIDER_FACE
37
+
38
+ ---
39
+
40
+ # DamoFD-0.5G 模型介绍
41
+ 轻量级人脸检测模型DamoFD-0.5G。
42
+
43
+ ## 模型描述
44
+ Motivation: 目前的Nas方法主要由两个模块组成,网络生成器和精度预测器。其中网络生成器用于生成候选的backbone结构,精度预测器用来对采样的backbone结构预测精度。由于检测和分类的任务目标不一致,前者更重视backbone stage-level (c2-c5)的表征,而后者更重视high-level(c5)的表征,这就导致了用于分类任务上的精度预测器擅长预测high-level的表征能力而无法预测stage-level的表征能力。因此,在人脸检测任务上,我们需要一个可以预测stage-level表征能力的精度预测器来更好的搜索face detection-friendly backbone。DamoFD: 针对如何设计可以预测stage-level表征能力的精度预测器,我们从刻画network expressivity的角度出发,创新性地提出了SAR-score来无偏的刻画stage-wise network expressivity,同时基于数据集gt的先验分布,来确定不同stage的重要性,进一步提出了DDSAR-score 来刻画detection backbone的精度。论文已被ICLR2023接收,更多代码细节以及modelscope应用可以前往[EasyFace_DamoFD](https://github.com/ly19965/FaceMaas/tree/master/face_project/face_detection/DamoFD)。
45
+
46
+ ## 模型使用方式和使用范围
47
+ 本模型可以检测输入图片中人脸的位置。
48
+
49
+ ### 安装
50
+ ```
51
+ conda create -n EasyFace python=3.7
52
+ conda activate EasyFace
53
+ # pytorch >= 1.3.0
54
+ pip install torch==1.8.1+cu102 torchvision==0.9.1+cu102 torchaudio==0.8.1 --extra-index-url https://download.pytorch.org/whl/cu102
55
+ git clone https://github.com/ly19965/FaceMaas
56
+ cd FaceMaas
57
+ pip install -r requirements/tests.txt
58
+ pip install -r requirements/framework.txt
59
+ pip install -r requirements/cv.txt
60
+ ```
61
+ ### 代码范例
62
+ #### 推理
63
+ ```python
64
+ import cv2
65
+ from modelscope.pipelines import pipeline
66
+ from modelscope.utils.constant import Tasks
67
+
68
+ face_detection = pipeline(task=Tasks.face_detection, model='damo/cv_ddsar_face-detection_iclr23-damofd')
69
+ # 支持 url image and abs dir image path
70
+ img_path = 'https://modelscope.oss-cn-beijing.aliyuncs.com/test/images/face_detection2.jpeg'
71
+ result = face_detection(img_path)
72
+
73
+ # 提供可视化结果
74
+ from modelscope.utils.cv.image_utils import draw_face_detection_result
75
+ from modelscope.preprocessors.image import LoadImage
76
+ img = LoadImage.convert_to_ndarray(img_path)
77
+ cv2.imwrite('srcImg.jpg', img)
78
+ img_draw = draw_face_detection_result('srcImg.jpg', result)
79
+ import matplotlib.pyplot as plt
80
+ plt.imshow(img_draw)
81
+ ```
82
+
83
+ #### 训练
84
+ ```python
85
+ import os
86
+ import tempfile
87
+ from modelscope.msdatasets import MsDataset
88
+ from modelscope.metainfo import Trainers
89
+ from modelscope.trainers import build_trainer
90
+ from modelscope.hub.snapshot_download import snapshot_download
91
+
92
+ model_id = 'damo/cv_ddsar_face-detection_iclr23-damofd'
93
+ ms_ds_widerface = MsDataset.load('WIDER_FACE_mini', namespace='shaoxuan') # remove '_mini' for full dataset
94
+
95
+ data_path = ms_ds_widerface.config_kwargs['split_config']
96
+ train_dir = data_path['train']
97
+ val_dir = data_path['validation']
98
+
99
+ def get_name(dir_name):
100
+ names = [i for i in os.listdir(dir_name) if not i.startswith('_')]
101
+ return names[0]
102
+
103
+ train_root = train_dir + '/' + get_name(train_dir) + '/'
104
+ val_root = val_dir + '/' + get_name(val_dir) + '/'
105
+ cache_path = snapshot_download(model_id)
106
+ tmp_dir = tempfile.TemporaryDirectory().name
107
+ if not os.path.exists(tmp_dir):
108
+ os.makedirs(tmp_dir)
109
+
110
+ def _cfg_modify_fn(cfg):
111
+ cfg.checkpoint_config.interval = 1
112
+ cfg.log_config.interval = 10
113
+ cfg.evaluation.interval = 1
114
+ cfg.data.workers_per_gpu = 1
115
+ cfg.data.samples_per_gpu = 4
116
+ return cfg
117
+
118
+ kwargs = dict(
119
+ cfg_file=os.path.join(cache_path, 'DamoFD_lms.py'),
120
+ work_dir=tmp_dir,
121
+ train_root=train_root,
122
+ val_root=val_root,
123
+ total_epochs=1, # run #epochs
124
+ cfg_modify_fn=_cfg_modify_fn)
125
+
126
+ trainer = build_trainer(name=Trainers.face_detection_scrfd, default_args=kwargs)
127
+ trainer.train()
128
+ ```
129
+
130
+
131
+ ### 目标场景
132
+ - 人脸相关的基础能力,可应用于人像美颜/互动娱乐/人脸比对等场景, 尤其适应于端上人脸应用场景
133
+
134
+
135
+ ### 模型局限性及可能偏差
136
+ - 模型size较小,模型鲁棒性可能有所欠缺。
137
+ - 当前版本在python 3.7环境测试通过,其他环境下可用性待测试
138
+
139
+ ### 预处理
140
+ 测试时主要的预处理如下:
141
+ - Normalize:图像归一化,减均值除以标准差
142
+ - Pad:图像高宽补零至32的倍数
143
+
144
+ ### 模型训练流程
145
+ - 本模型使用8卡v100,使用SGD优化器,lr=0.02,在440/544epoch时降低10倍学习率,并在640epoch时产出模型,详见mmcv_tinymog.py
146
+
147
+
148
+ ### 测试集
149
+ - WIDERFACE: 测试集已上传至ModelScope的DatasetHub,详情请见[WIDER_FACE](https://modelscope.cn/datasets/shaoxuan/WIDER_FACE)。
150
+
151
+ ## 数据评估及结果
152
+ 模型在WiderFace的验证集上客观指标如下:
153
+ | Method | Easy | Medium | Hard |
154
+ | ------------ | ------------ | ------------ | ------------ |
155
+ | Scrfd-0.5G | 90.57 | 88.12 | 68.51 |
156
+ | DamoFD-0.5G | 90.32 | 88.36 | 71.03 |
157
+
158
+ ## 人脸相关模型
159
+
160
+ 以下是ModelScope上人脸相关模型:
161
+
162
+ - 人脸检测
163
+
164
+ | 序号 | 模型名称 |
165
+ | ------------ | ------------ |
166
+ | 1 | [RetinaFace人脸检测模型](https://modelscope.cn/models/damo/cv_resnet50_face-detection_retinaface/summary) |
167
+ | 2 | [MogFace人脸检测模型-large](https://modelscope.cn/models/damo/cv_resnet101_face-detection_cvpr22papermogface/summary) |
168
+ | 3 | [TinyMog人脸检测器-tiny](https://modelscope.cn/models/damo/cv_manual_face-detection_tinymog/summary) |
169
+ | 4 | [ULFD人脸检测模型-tiny](https://modelscope.cn/models/damo/cv_manual_face-detection_ulfd/summary) |
170
+ | 5 | [Mtcnn人脸检测关键点模型](https://modelscope.cn/models/damo/cv_manual_face-detection_mtcnn/summary) |
171
+ | 6 | [ULFD人脸检测模型-tiny](https://modelscope.cn/models/damo/cv_manual_face-detection_ulfd/summary) |
172
+
173
+
174
+ - 人脸识别
175
+
176
+ | 序号 | 模型名称 |
177
+ | ------------ | ------------ |
178
+ | 1 | [口罩人脸识别模型FaceMask](https://modelscope.cn/models/damo/cv_resnet_face-recognition_facemask/summary) |
179
+ | 2 | [口罩人脸识别模型FRFM-large](https://modelscope.cn/models/damo/cv_manual_face-recognition_frfm/summary) |
180
+ | 3 | [IR人脸识别模型FRIR](https://modelscope.cn/models/damo/cv_manual_face-recognition_frir/summary) |
181
+ | 4 | [ArcFace人脸识别模型](https://modelscope.cn/models/damo/cv_ir50_face-recognition_arcface/summary) |
182
+ | 5 | [IR人脸识别模型FRIR](https://modelscope.cn/models/damo/cv_manual_face-recognition_frir/summary) |
183
+
184
+ - 人脸活体识别
185
+
186
+ | 序号 | 模型名称 |
187
+ | ------------ | ------------ |
188
+ | 1 | [人脸活体检测模型-IR](https://modelscope.cn/models/damo/cv_manual_face-liveness_flir/summary) |
189
+ | 2 | [人脸活体检测模型-RGB](https://modelscope.cn/models/damo/cv_manual_face-liveness_flrgb/summary) |
190
+ | 3 | [静默人脸活体检测模型-炫彩](https://modelscope.cn/models/damo/cv_manual_face-liveness_flxc/summary) |
191
+
192
+ - 人脸关键点
193
+
194
+ | 序号 | 模型名称 |
195
+ | ------------ | ------------ |
196
+ | 1 | [FLCM人脸关键点置信度模型](https://modelscope.cn/models/damo/cv_manual_facial-landmark-confidence_flcm/summary) |
197
+
198
+ - 人脸属性 & 表情
199
+
200
+
201
+ | 序号 | 模型名称 |
202
+ | ------------ | ------------ |
203
+ | 1 | [人脸表情识别模型FER](https://modelscope.cn/models/damo/cv_vgg19_facial-expression-recognition_fer/summary) |
204
+ | 2 | [人脸属性识别模型FairFace](https://modelscope.cn/models/damo/cv_resnet34_face-attribute-recognition_fairface/summary) |
205
+
206
+ ## 来源说明
207
+ 本模型及代码来自达摩院自研技术
208
+
209
+ ## 引用
210
+ 如果你觉得这个该模型对有所帮助,请考虑引用下面的相关的论文:
211
+
212
+ ```BibTeX
213
+ ```
214
+
hub/damo/cv_ddsar_face-detection_iclr23-damofd/configuration.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "framework": "pytorch",
3
+ "task": "face-detection",
4
+ "pipeline": {
5
+ "type": "resnet-face-detection-scrfd10gkps"
6
+
7
+ },
8
+ "preprocessor":{
9
+ "type":"object-detection-scrfd"
10
+ },
11
+ "model":{
12
+ "type": "damofd"
13
+ }
14
+ }
hub/damo/cv_ddsar_face-detection_iclr23-damofd/pytorch_model.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3210500b987703020d3516609b204d2736f986d3f59d30707aefeaa8c41bad39
3
+ size 2270215
hub/damo/cv_ir101_facerecognition_cfglint/.mdl ADDED
Binary file (60 Bytes). View file
 
hub/damo/cv_ir101_facerecognition_cfglint/.msc ADDED
Binary file (316 Bytes). View file
 
hub/damo/cv_ir101_facerecognition_cfglint/README.md ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tasks:
3
+ - face-recognition
4
+ domain:
5
+ - cv
6
+ frameworks:
7
+ - pytorch
8
+ backbone:
9
+ - IR_101
10
+ metrics:
11
+ - TPR@FAR
12
+ license: Apache License 2.0
13
+ tags:
14
+ - TFace
15
+ datasets:
16
+ train:
17
+ - glint360k
18
+ test:
19
+ - IJBC
20
+ evaluation:
21
+ - LFW
22
+
23
+ indexing:
24
+ results:
25
+ - task:
26
+ name: Face Recognition
27
+ dataset:
28
+ name: IJBC
29
+ type: Images
30
+ args: default
31
+ metrics:
32
+ - type: TPR@FPR=1e-4
33
+ value: 97.47
34
+ args: N0D0F0
35
+ ---
36
+
37
+ # CurricularFace 模型介绍
38
+
39
+
40
+ ## 模型描述
41
+
42
+ CurricularFace为目前人脸识别的SOTA方法之一,其主要思想是采用课程学习的思想动态关注训练数据中的难例样本。此前的方法在训练中对于错分类的样本,要么未充分挖掘难例导致性能问题,要么在训练初期关注难例导致收敛问题。基于此,CurricularFace提出Adaptive Curriculum Learning Loss, 在训练过程中动态调整easy和hard样本的重要性,使训练初期关注简单样本,训练后期关注难例样本,而对难易样本分配不同重要性是通过设计一个代表收敛进度的指示函数来自适应调整的。论文已发表至CVPR-2020([论文地址](https://arxiv.org/abs/2004.00288), [代码地址](https://github.com/Tencent/TFace/tree/master/recognition))。
43
+
44
+ ## 训练数据
45
+
46
+ 本模型的训练数据来自开源社区规模最大的数据集之一Glint360K,包含36万ID,1700万图片(详见:[论文地址](https://arxiv.org/abs/2203.15565)), 因此该模型在学界的多个benchmark中处于SOTA水平。
47
+
48
+
49
+ ## 使用方式和范围
50
+
51
+ 使用方式:
52
+ - 推理:输入经过对齐的人脸图片(112x112),返回人脸特征向量(512维),为便于体验,集成了人脸检测和关键点模型[SCRFD](https://modelscope.cn/models/damo/cv_resnet_facedetection_scrfd10gkps),输入两张图片,各自进行人脸检测选择最大脸并对齐后提取特征,然后返回相似度比分
53
+
54
+ 目标场景:
55
+ - 人脸识别应用广泛,如考勤,通行,人身核验,智慧安防等场景
56
+
57
+ #### 代码范例
58
+ ```python
59
+ import cv2
60
+ import numpy as np
61
+ from modelscope.pipelines import pipeline
62
+ from modelscope.utils.constant import Tasks
63
+ from modelscope.outputs import OutputKeys
64
+
65
+ img1 = 'https://modelscope.oss-cn-beijing.aliyuncs.com/test/images/face_recognition_1.png'
66
+ img2 = 'https://modelscope.oss-cn-beijing.aliyuncs.com/test/images/face_recognition_2.png'
67
+
68
+ face_recognition = pipeline(Tasks.face_recognition, model='damo/cv_ir101_facerecognition_cfglint')
69
+ emb1 = face_recognition(img1)[OutputKeys.IMG_EMBEDDING]
70
+ emb2 = face_recognition(img2)[OutputKeys.IMG_EMBEDDING]
71
+ sim = np.dot(emb1[0], emb2[0])
72
+ print(f'Face cosine similarity={sim:.3f}, img1:{img1} img2:{img2}')
73
+ ```
74
+
75
+ ## 模型性能指标
76
+
77
+ 在IJBC数据集中,模型在不同FPR下的TPR指标(注:使用不同的检测及关键点模型会对识别指标有细微影响):
78
+
79
+ | Name | 1e-6 | 1e-5 | 1e-4 |
80
+ | ------------ | ------------ | ------------ |------------ |
81
+ | CF_IR101_Glint | 92.01 | 96.17 | 97.47 |
82
+
83
+ ## 来源说明
84
+ 本模型及代码来自开源社区([地址](https://github.com/Tencent/TFace/tree/master/recognition)),请遵守相关许可。
hub/damo/cv_ir101_facerecognition_cfglint/configuration.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "framework": "pytorch",
3
+ "task": "face-recognition",
4
+ "pipeline": {
5
+ "type": "ir101-face-recognition-cfglint"
6
+ }
7
+ }
hub/damo/cv_ir101_facerecognition_cfglint/description/SCRFD-sota.jpg ADDED
hub/damo/cv_ir101_facerecognition_cfglint/pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aa54ae6dc9f7ac6e262809f1a81d6108e221952bf836aee4cb677ef19246c6ec
3
+ size 261202954
hub/damo/cv_ir_face-recognition-ood_rts/.mdl ADDED
Binary file (58 Bytes). View file
 
hub/damo/cv_ir_face-recognition-ood_rts/.msc ADDED
Binary file (296 Bytes). View file
 
hub/damo/cv_ir_face-recognition-ood_rts/README.md ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tasks:
3
+ - face-recognition
4
+ widgets:
5
+ - task: face-recognition-ood
6
+ inputs:
7
+ - type: image
8
+ examples:
9
+ - name: 1
10
+ inputs:
11
+ - data: https://modelscope.oss-cn-beijing.aliyuncs.com/test/images/mog_face_detection.jpg
12
+ name: image
13
+ inferencespec:
14
+ cpu: 4
15
+ gpu: 1
16
+ gpu_memory: 16000
17
+ memory: 43000
18
+ domain:
19
+ - cv
20
+ tags:
21
+ - RTS
22
+ - AAAI2023
23
+ frameworks:
24
+ - pytorch
25
+ backbone:
26
+ - Resnet
27
+ metrics:
28
+ - AP
29
+ license: MIT License
30
+ #datasets:
31
+ # train:
32
+ # - shaoxuan/WIDER_FACE
33
+ # evaluation:
34
+ # - shaoxuan/WIDER_FACE
35
+
36
+ ---
37
+
38
+ # RTS模型介绍
39
+ 人脸识别OOD模型RTS
40
+
41
+
42
+ ## 模型描述
43
+ 针对人脸识别系统中经常遇到的低质量、噪声、甚至不同数据分布(out of distribution, OOD)的数据带来的问题,用基于概率的视角分析损失函数中温度调节参数和分类不确定度的内在关系,同时该不确定度服从一个先验分布。从而可以稳定训练,以及在部署时提供一个对不确定度的度量分值,帮助建立更鲁棒的人脸识别系统。
44
+ 主要贡献点如下:
45
+ (1)基于概率视角,揭示了损失函数中温度调节参数和分类不确定度的内在关系,通过提出的Random Temperature Scaling (RTS) 来训练更可靠的人脸识别模型。
46
+ (2)在训练阶段,RTS可以调节干净数据和噪声数据对训练的影响以得到更稳定的训练过程和更好的识别效果。
47
+ (3)在测试阶段,RTS可以提供一个不需要通过额外数据训练的不确定度分值,来分辨出不确定的、低质量的以及不同数据分布(out of distribution, OOD)的样本,以建立更鲁棒的人脸识别系统。
48
+
49
+
50
+ ## 模型效果
51
+ ![模型效果](rts.png)
52
+
53
+ ## 模型使用方式和使用范围
54
+ 本模型可以检测输入图片中人脸的512维特征和对应的质量分。
55
+
56
+ ### 代码范例
57
+ ```python
58
+ from modelscope.pipelines import pipeline
59
+ from modelscope.utils.constant import Tasks
60
+ from modelscope.outputs import OutputKeys
61
+ import numpy as np
62
+
63
+ rts_face_recognition_func = pipeline(Tasks.face_recognition, 'damo/cv_ir_face-recognition-ood_rts')
64
+
65
+ img1 = 'https://modelscope.oss-cn-beijing.aliyuncs.com/test/images/face_recognition_1.png'
66
+ img2 = 'https://modelscope.oss-cn-beijing.aliyuncs.com/test/images/face_recognition_2.png'
67
+
68
+ result1 = rts_face_recognition_func(img1)
69
+ result2 = rts_face_recognition_func(img2)
70
+
71
+ emb1 = result1[OutputKeys.IMG_EMBEDDING]
72
+ score1 = result1[OutputKeys.SCORES][0][0]
73
+
74
+ emb2 = result2[OutputKeys.IMG_EMBEDDING]
75
+ score2 = result2[OutputKeys.SCORES][0][0]
76
+
77
+ sim = np.dot(emb1[0], emb2[0])
78
+ print(f'Cos similarity={sim:.3f}, img1:{img1} img2:{img2}')
79
+ print(f'OOD score: img1:{score1:.3f} img2:{score2:.3f}')
80
+
81
+ ```
82
+
83
+ ### 使用方式
84
+ - 推理:输入经过对齐的人脸图片(112x112),返回人脸特征向量(512维),为便于体验,集成了人脸检测和关键点模型RetinaFace,输入两张图片,各自进行人脸检测选择最大脸并对齐后提取特征,然后返回相似度比分以及每个人脸的质量分。
85
+
86
+ ### 目标场景
87
+ - 人脸识别应用广泛,如考勤,通行,人身核验,智慧安防等场景
88
+
89
+ ### 模型局限性及可能偏差
90
+ - 当前版本在python 3.7环境测试通过,其他环境下可用性待测试
91
+
92
+ ### 预处理
93
+ 测试时主要的预处理如下:
94
+ - Resize:图像resize到112x112
95
+ - Normalize:图像归一化,减均值除以标准差
96
+
97
+ ## 人脸相关模型
98
+
99
+ 以下是ModelScope上人脸相关模型:
100
+
101
+ - 人脸检测
102
+
103
+ | 序号 | 模型名称 |
104
+ | ------------ | ------------ |
105
+ | 1 | [RetinaFace人脸检测模型](https://modelscope.cn/models/damo/cv_resnet50_face-detection_retinaface/summary) |
106
+ | 2 | [MogFace人脸检测模型-large](https://modelscope.cn/models/damo/cv_resnet101_face-detection_cvpr22papermogface/summary) |
107
+ | 3 | [TinyMog人脸检测器-tiny](https://modelscope.cn/models/damo/cv_manual_face-detection_tinymog/summary) |
108
+ | 4 | [ULFD人脸检测模型-tiny](https://modelscope.cn/models/damo/cv_manual_face-detection_ulfd/summary) |
109
+ | 5 | [Mtcnn人脸检测关键点模型](https://modelscope.cn/models/damo/cv_manual_face-detection_mtcnn/summary) |
110
+ | 6 | [ULFD人脸检测模型-tiny](https://modelscope.cn/models/damo/cv_manual_face-detection_ulfd/summary) |
111
+
112
+
113
+ - 人脸识别
114
+
115
+ | 序号 | 模型名称 |
116
+ | ------------ | ------------ |
117
+ | 1 | [口罩人脸识别模型FaceMask](https://modelscope.cn/models/damo/cv_resnet_face-recognition_facemask/summary) |
118
+ | 2 | [口罩人脸识别模型FRFM-large](https://modelscope.cn/models/damo/cv_manual_face-recognition_frfm/summary) |
119
+ | 3 | [IR人脸识别模型FRIR](https://modelscope.cn/models/damo/cv_manual_face-recognition_frir/summary) |
120
+ | 4 | [ArcFace人脸识别模型](https://modelscope.cn/models/damo/cv_ir50_face-recognition_arcface/summary) |
121
+ | 5 | [IR人脸识别模型FRIR](https://modelscope.cn/models/damo/cv_manual_face-recognition_frir/summary) |
122
+
123
+ - 人脸活体识别
124
+
125
+ | 序号 | 模型名称 |
126
+ | ------------ | ------------ |
127
+ | 1 | [人脸活体检测模型-IR](https://modelscope.cn/models/damo/cv_manual_face-liveness_flir/summary) |
128
+ | 2 | [人脸活体检测模型-RGB](https://modelscope.cn/models/damo/cv_manual_face-liveness_flrgb/summary) |
129
+ | 3 | [静默人脸活体检测模型-炫彩](https://modelscope.cn/models/damo/cv_manual_face-liveness_flxc/summary) |
130
+
131
+ - 人脸关键点
132
+
133
+ | 序号 | 模型名称 |
134
+ | ------------ | ------------ |
135
+ | 1 | [FLCM人脸关键点置信度模型](https://modelscope.cn/models/damo/cv_manual_facial-landmark-confidence_flcm/summary) |
136
+
137
+ - 人脸属性 & 表情
138
+
139
+
140
+ | 序号 | 模型名称 |
141
+ | ------------ | ------------ |
142
+ | 1 | [人脸表情识别模型FER](https://modelscope.cn/models/damo/cv_vgg19_facial-expression-recognition_fer/summary) |
143
+ | 2 | [人脸属性识别模型FairFace](https://modelscope.cn/models/damo/cv_resnet34_face-attribute-recognition_fairface/summary) |
144
+
145
+ ## 来源说明
146
+ 本模型及代码来自达摩院自研技术
147
+
148
+ ## 引用
149
+ 如果你觉得这个该模型对有所帮助,请考虑引用下面的相关的论文:
150
+
151
+ ```BibTeX
152
+ ```
153
+
hub/damo/cv_ir_face-recognition-ood_rts/configuration.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "framework": "pytorch",
3
+ "task": "face-recognition",
4
+ "pipeline": {
5
+ "type": "ir-face-recognition-rts"
6
+ },
7
+ "model": {
8
+ "type": "rts-backbone",
9
+ "am_model_name": "pytorch_model.pt",
10
+ "alpha": 16,
11
+ "rts_plus": false
12
+
13
+ }
14
+ }
hub/damo/cv_ir_face-recognition-ood_rts/pytorch_model.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:43a978d63c1d797bc676fea14e5d170bce8030cdde299a5552422369455347db
3
+ size 191488844
hub/damo/cv_ir_face-recognition-ood_rts/rts.png ADDED
hub/damo/cv_manual_face-quality-assessment_fqa/.mdl ADDED
Binary file (65 Bytes). View file
 
hub/damo/cv_manual_face-quality-assessment_fqa/.msc ADDED
Binary file (559 Bytes). View file
 
hub/damo/cv_manual_face-quality-assessment_fqa/README.md ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tasks:
3
+ - face-quality-assessment
4
+ widgets:
5
+ - task: face-quality-assessment
6
+ inputs:
7
+ - type: image
8
+ examples:
9
+ - name: 1
10
+ inputs:
11
+ - data: https://modelscope.oss-cn-beijing.aliyuncs.com/test/images/mog_face_detection.jpg
12
+ name: image
13
+ inferencespec:
14
+ cpu: 4
15
+ gpu: 1
16
+ gpu_memory: 16000
17
+ memory: 43000
18
+ domain:
19
+ - cv
20
+ metrics:
21
+ - AP
22
+ license: MIT License
23
+ datasets:
24
+ evaluation:
25
+ - shaoxuan/WIDER_FACE
26
+
27
+ ---
28
+
29
+ # FQA人脸质量评估模型介绍
30
+ FQA人脸质量评估模型
31
+
32
+
33
+ ## 模型描述
34
+ FQA模型包含3个方面的创新, rank映射, Ordinal Regression和multi-labelloss:
35
+ - Rank映射:建立质量等级
36
+ - 有序回归:考虑不同rank间的排序关系
37
+ - Multi-lable loss: 解决数据不平衡问题、增强模块可扩展性
38
+
39
+
40
+ ## 模型结构
41
+ ![模型结构](arch.jpg)
42
+
43
+ ## 质量等级划分
44
+ ![模型结构](quality_rank.jpg)
45
+
46
+ ## 模型效果
47
+ ![模型效果](result.png)
48
+
49
+ ## 模型使用方式和使用范围
50
+ 本模型可以评估输入图片中人脸的质量
51
+
52
+ ### 代码范例
53
+ ```python
54
+ from modelscope.pipelines import pipeline
55
+ from modelscope.utils.constant import Tasks
56
+ from modelscope.outputs import OutputKeys
57
+ import numpy as np
58
+
59
+ face_quality_assessment_func = pipeline(Tasks.face_quality_assessment, 'damo/cv_manual_face-quality-assessment_fqa')
60
+ img = 'https://modelscope.oss-cn-beijing.aliyuncs.com/test/images/face_recognition_1.png'
61
+ face_aulity_score = face_quality_assessment_func(img)[OutputKeys.SCORES]
62
+ print(f'Face quality score={face_aulity_score:.3f}')
63
+ ```
64
+
65
+ ### 使用方式
66
+ - 推理:输入经过对齐的人脸图片(112x112),返回人脸的质量分(0-1, 分数越高质量越高),为便于体验,集成了人脸检测和关键点模型RetinaFace。
67
+
68
+
69
+ ### 目标场景
70
+ - 人脸系统基础模块,可用于人像美颜/互动娱乐/人脸比对等场景.
71
+
72
+
73
+ ### 模型局限性及可能偏差
74
+ - 当前版本在python 3.7环境测试通过,其他环境下可用性待测试
75
+
76
+ ### 模型性能指标
77
+ ![模型性能曲线](performance.jpg)
78
+
79
+ ## 来源说明
80
+ 本模型及代码来自达摩院自研技术
hub/damo/cv_manual_face-quality-assessment_fqa/arcface.jpg ADDED
hub/damo/cv_manual_face-quality-assessment_fqa/arch.jpg ADDED
hub/damo/cv_manual_face-quality-assessment_fqa/configuration.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "framework": "pytorch",
3
+ "task": "face-quality-assessment",
4
+ "pipeline": {
5
+ "type": "manual-face-quality-assessment-fqa"
6
+ }
7
+ }
hub/damo/cv_manual_face-quality-assessment_fqa/model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4d0e02b72f987989b5fe0447745521e16067b10777b66a1fb89362fb1ca08183
3
+ size 406114
hub/damo/cv_manual_face-quality-assessment_fqa/performance.jpg ADDED
hub/damo/cv_manual_face-quality-assessment_fqa/quality_rank.jpg ADDED
hub/damo/cv_manual_face-quality-assessment_fqa/result.png ADDED
hub/damo/cv_manual_facial-landmark-confidence_flcm/.mdl ADDED
Binary file (69 Bytes). View file
 
hub/damo/cv_manual_facial-landmark-confidence_flcm/.msc ADDED
Binary file (430 Bytes). View file
 
hub/damo/cv_manual_facial-landmark-confidence_flcm/FLC.png ADDED
hub/damo/cv_manual_facial-landmark-confidence_flcm/README.md ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tasks:
3
+ - face-2d-keypoints
4
+ widgets:
5
+ - task: facial-landmark-confidence
6
+ inputs:
7
+ - type: image
8
+ examples:
9
+ - name: 1
10
+ inputs:
11
+ - data: https://modelscope.oss-cn-beijing.aliyuncs.com/test/images/face_recognition_1.png
12
+ name: image
13
+ inferencespec:
14
+ cpu: 4
15
+ gpu: 1
16
+ gpu_memory: 16000
17
+ memory: 43000
18
+ domain:
19
+ - cv
20
+ tags:
21
+ - FLC
22
+ frameworks:
23
+ - pytorch
24
+ backbone:
25
+ - Manual
26
+ metrics:
27
+ - AP
28
+ license: MIT License
29
+ #datasets:
30
+ # train:
31
+ # - shaoxuan/WIDER_FACE
32
+ # evaluation:
33
+ # - shaoxuan/WIDER_FACE
34
+
35
+ ---
36
+
37
+ # FLCM 模型介绍
38
+ 人脸关键点置信度模型FLCM
39
+
40
+
41
+ ## 模型描述
42
+
43
+ FLCM为达摩院自研的关键点置信度算法,基于关键点的好坏来判断输入图片的质量,可以作为人脸识别系统中的拒识模块, 该方法的主要贡献是在目前的人脸关键点模型上引入了额外的Face Quality Estimator: 可以根据关键点的质量来生成对应的得分。
44
+
45
+ ## 模型结构
46
+ ![模型结构](FLC.png)
47
+
48
+ ## 模型效果
49
+ ![模型效果](flc_demo_1.jpg)
50
+
51
+ ## 模型使用方式和使用范围
52
+ 本模型可以检测输入图片中人脸的5点关键点和对应的人脸质量质量分
53
+
54
+ ### 代码范例
55
+ ```python
56
+ from modelscope.pipelines import pipeline
57
+ from modelscope.utils.constant import Tasks
58
+
59
+ facial_landmark_confidence_func = pipeline(Tasks.facial_landmark_confidence, 'damo/cv_manual_facial-landmark-confidence_flcm')
60
+ src_img_path = 'https://modelscope.oss-cn-beijing.aliyuncs.com/test/images/face_recognition_1.png'
61
+ raw_result = facial_landmark_confidence_func(src_img_path)
62
+ print('facial landmark confidence output: {}.'.format(raw_result))
63
+
64
+ # if you want to show the result, you can run
65
+ from modelscope.utils.cv.image_utils import draw_face_detection_result
66
+ from modelscope.preprocessors.image import LoadImage
67
+ import cv2
68
+ import numpy as np
69
+
70
+ # load image from url as rgb order
71
+ src_img = LoadImage.convert_to_ndarray(src_img_path)
72
+ # save src image as bgr order to local
73
+ src_img = cv2.cvtColor(np.asarray(src_img), cv2.COLOR_RGB2BGR)
74
+ cv2.imwrite('src_img.jpg', src_img)
75
+ # draw dst image from local src image as bgr order
76
+ dst_img = draw_face_detection_result('src_img.jpg', raw_result)
77
+ # save dst image as bgr order to local
78
+ cv2.imwrite('dst_img.jpg', dst_img)
79
+ # show dst image by rgb order
80
+ import matplotlib.pyplot as plt
81
+ dst_img = cv2.cvtColor(np.asarray(dst_img), cv2.COLOR_BGR2RGB)
82
+ plt.imshow(dst_img)
83
+ ```
84
+ ### 使用方式
85
+ - 推理:输入图片,如存在人脸则返回人脸的五点关键点和对应的质量分。
86
+
87
+
88
+ ### 目标场景
89
+ - 人脸相关的基础能力,可应用于视频监控/人像美颜/互动娱乐/人脸比对等场景
90
+
91
+
92
+ ### 模型局限性及可能偏差
93
+ - 模型使用公开集训练,可能在某些具体的业务场景效果一般,
94
+ - 目前只支持单人的人脸关键点置信度识别。
95
+ - 当前版本在python 3.7环境测试通过,其他环境下可用性待测试
96
+
97
+ ### 预处理
98
+ 测试时主要的预处理如下:
99
+ - Resize:图像resize到120x120
100
+
101
+ ## 人脸相关模型
102
+
103
+ 以下是ModelScope上人脸相关模型:
104
+
105
+ - 人脸检测
106
+
107
+ | 序号 | 模型名称 |
108
+ | ------------ | ------------ |
109
+ | 1 | [RetinaFace人脸检测模型](https://modelscope.cn/models/damo/cv_resnet50_face-detection_retinaface/summary) |
110
+ | 2 | [MogFace人脸检测模型-large](https://modelscope.cn/models/damo/cv_resnet101_face-detection_cvpr22papermogface/summary) |
111
+ | 3 | [TinyMog人脸检测器-tiny](https://modelscope.cn/models/damo/cv_manual_face-detection_tinymog/summary) |
112
+ | 4 | [ULFD人脸检测模型-tiny](https://modelscope.cn/models/damo/cv_manual_face-detection_ulfd/summary) |
113
+ | 5 | [Mtcnn人脸检测关键点模型](https://modelscope.cn/models/damo/cv_manual_face-detection_mtcnn/summary) |
114
+ | 6 | [ULFD人脸检测模型-tiny](https://modelscope.cn/models/damo/cv_manual_face-detection_ulfd/summary) |
115
+
116
+
117
+ - 人脸识别
118
+
119
+ | 序号 | 模型名称 |
120
+ | ------------ | ------------ |
121
+ | 1 | [口罩人脸识别模型FaceMask](https://modelscope.cn/models/damo/cv_resnet_face-recognition_facemask/summary) |
122
+ | 2 | [口罩人脸识别模型FRFM-large](https://modelscope.cn/models/damo/cv_manual_face-recognition_frfm/summary) |
123
+ | 3 | [IR人脸识别模型FRIR](https://modelscope.cn/models/damo/cv_manual_face-recognition_frir/summary) |
124
+ | 4 | [ArcFace人脸识别模型](https://modelscope.cn/models/damo/cv_ir50_face-recognition_arcface/summary) |
125
+ | 5 | [IR人脸识别模型FRIR](https://modelscope.cn/models/damo/cv_manual_face-recognition_frir/summary) |
126
+
127
+ - 人脸活体识别
128
+
129
+ | 序号 | 模型名称 |
130
+ | ------------ | ------------ |
131
+ | 1 | [人脸活体检测模型-IR](https://modelscope.cn/models/damo/cv_manual_face-liveness_flir/summary) |
132
+ | 2 | [人脸活体检测模型-RGB](https://modelscope.cn/models/damo/cv_manual_face-liveness_flrgb/summary) |
133
+ | 3 | [静默人脸活体检测模型-炫彩](https://modelscope.cn/models/damo/cv_manual_face-liveness_flxc/summary) |
134
+
135
+ - 人脸关键点
136
+
137
+ | 序号 | 模型名称 |
138
+ | ------------ | ------------ |
139
+ | 1 | [FLCM人脸关键点置信度模型](https://modelscope.cn/models/damo/cv_manual_facial-landmark-confidence_flcm/summary) |
140
+
141
+ - 人脸属性 & 表情
142
+
143
+
144
+ | 序号 | 模型名称 |
145
+ | ------------ | ------------ |
146
+ | 1 | [人脸表情识别模型FER](https://modelscope.cn/models/damo/cv_vgg19_facial-expression-recognition_fer/summary) |
147
+ | 2 | [人脸属性识别模型FairFace](https://modelscope.cn/models/damo/cv_resnet34_face-attribute-recognition_fairface/summary) |
148
+
149
+ ## 来源说明
150
+ 本模型及代码来自达摩院自研技术。
151
+
hub/damo/cv_manual_facial-landmark-confidence_flcm/configuration.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "framework": "pytorch",
3
+ "task": "face-2d-keypoints",
4
+ "pipeline": {
5
+ "type": "manual-facial-landmark-confidence-flcm"
6
+ }
7
+ }
hub/damo/cv_manual_facial-landmark-confidence_flcm/flc_demo.png ADDED
hub/damo/cv_manual_facial-landmark-confidence_flcm/flc_demo_1.jpg ADDED
hub/damo/cv_manual_facial-landmark-confidence_flcm/pytorch_model.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c2ca22a1fb9c9826664b152bbbc778e53b709562390ff60892ddfae6f043bfe3
3
+ size 1562035
hub/damo/cv_resnet101_image-multiple-human-parsing/.mdl ADDED
Binary file (69 Bytes). View file
 
hub/damo/cv_resnet101_image-multiple-human-parsing/.msc ADDED
Binary file (544 Bytes). View file
 
hub/damo/cv_resnet101_image-multiple-human-parsing/README.md ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tasks:
3
+ - image-segmentation
4
+ widgets:
5
+ - task: image-segmentation
6
+ inputs:
7
+ - type: image
8
+ examples:
9
+ - name: 1
10
+ title: 示例1
11
+ inputs:
12
+ - data: git://description/demo.jpg
13
+ - name: 2
14
+ title: 示例2
15
+ inputs:
16
+ - data: git://description/demo2.jpg
17
+ inferencespec:
18
+ cpu: 4
19
+ memory: 8000
20
+ gpu: 1
21
+ gpu_memory: 16000
22
+ model-type:
23
+ - m2fp
24
+ domain:
25
+ - cv
26
+ frameworks:
27
+ - pytorch
28
+ backbone:
29
+ - ResNet-101
30
+ metrics:
31
+ - mIoU
32
+ - APr
33
+ customized-quickstart: True
34
+ finetune-support: False
35
+ license: Other
36
+ tags:
37
+ - Alibaba
38
+ - multiple human parsing
39
+ - M2FP
40
+ datasets:
41
+ train:
42
+ - modelscope/CIHP
43
+ evaluation:
44
+ - modelscope/CIHP
45
+ ---
46
+
47
+ # M2FP多人人体解析模型介绍
48
+
49
+ ## 模型描述
50
+
51
+ M2FP(Mask2Former for Parsing,[官方代码](https://github.com/soeaver/M2FP))基于 Mask2Former 架构,并进行了一些改进以适应人体解析。 M2FP 可以适应几乎所有人体解析任务并产生惊人的性能。
52
+
53
+ 模型整体架构图如下:
54
+
55
+ ![M2FP模型结构](description/m2fp_arch.png)
56
+
57
+ ## 期望模型使用方式以及适用范围
58
+
59
+ 本模型适用于包含多个人体的图像,对图片中的人体各组件进行解析、分割。
60
+
61
+ ### 如何使用
62
+
63
+ 在ModelScope框架上,提供输入图片,即可通过简单的Pipeline调用来使用。
64
+
65
+ #### 代码范例
66
+ ```python
67
+ from modelscope.outputs import OutputKeys
68
+ from modelscope.pipelines import pipeline
69
+ from modelscope.utils.constant import Tasks
70
+
71
+ input_img = 'https://modelscope.oss-cn-beijing.aliyuncs.com/test/images/mog_face_detection.jpg'
72
+ segmentation_pipeline = pipeline(Tasks.image_segmentation, 'damo/cv_resnet101_image-multiple-human-parsing')
73
+ result = segmentation_pipeline(input_img)
74
+ print(result[OutputKeys.LABELS])
75
+ ```
76
+
77
+ ### 模型局限性以及可能的偏差
78
+
79
+ - 部分非常规图片或人体占比太小或遮挡严重可能会影响分割结果
80
+ - 本模型依赖mmcv-full,需用户在机器上正确安装[mmcv-full](https://mmcv.readthedocs.io/en/latest/get_started/installation.html)
81
+ - 部分代码依赖CC BY-NC 4.0 license,不支持商用
82
+
83
+ ## 训练数据介绍
84
+
85
+ - CIHP,大规模多人人体解析数据集,[官方地址](https://lip.sysuhcp.com/overview.php)。
86
+
87
+ ## 模型训练流程
88
+
89
+ - 请参考原论文
90
+
91
+ ## 数据评估及结果
92
+
93
+ 模型在CIHP验证集上进行评估,结果如下:
94
+
95
+ | Backbone | Pretrain | Epochs | mIoU | APr | #params | FLOPs |
96
+ |:----------:|:-----------:|:------:|:-----:|:-----:|:-------:|:------:|
97
+ | ResNet-101 | ImageNet-1k | 150 | 69.15 | 60.47 | 63.0M | 206.2G |
98
+
99
+ 注:测试时使用了 TTA(Test Time Augmentation)数据增强
100
+
101
+ 可视化结果:
102
+
103
+ ![source](description/demo.jpg) ![result](description/demo_result.jpg)
104
+
105
+ ## 引用
106
+ 如果你觉得该模型对你有所帮助,请考虑引用下面的相关论文:
107
+
108
+ ```BibTeX
109
+ @article{yang2023humanparsing,
110
+ title={Deep Learning Technique for Human Parsing: A Survey and Outlook},
111
+ author={Lu Yang and Wenhe Jia and Shan Li and Qing Song},
112
+ journal={arXiv preprint arXiv:2301.00394},
113
+ year={2023}
114
+ }
115
+ ```
116
+ ```BibTeX
117
+ @inproceedings{cheng2021mask2former,
118
+ title={Masked-attention Mask Transformer for Universal Image Segmentation},
119
+ author={Bowen Cheng and Ishan Misra and Alexander G. Schwing and Alexander Kirillov and Rohit Girdhar},
120
+ journal={CVPR},
121
+ year={2021}
122
+ }
123
+ ```
124
+ ```BibTeX
125
+ @inproceedings{cheng2021maskformer,
126
+ title={Per-Pixel Classification is Not All You Need for Semantic Segmentation},
127
+ author={Bowen Cheng and Alexander G. Schwing and Alexander Kirillov},
128
+ journal={NeurIPS},
129
+ year={2021}
130
+ }
131
+ ```
hub/damo/cv_resnet101_image-multiple-human-parsing/configuration.json ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "framework": "pytorch",
3
+
4
+ "task": "image-segmentation",
5
+
6
+ "pipeline": {
7
+ "type": "m2fp-image-human-parsing"
8
+ },
9
+
10
+ "model": {
11
+ "type": "m2fp",
12
+ "pretrained": true,
13
+ "parsing_ins_score_thr": 0.3,
14
+ "parsing_on": true,
15
+ "semantic_on": false,
16
+ "sem_seg_postprocess_before_inference": false,
17
+ "single_human": false,
18
+ "with_human_instance": true,
19
+ "num_parsing": 20,
20
+ "backbone": {
21
+ "depth": 101,
22
+ "norm": "BN",
23
+ "num_groups": 1,
24
+ "out_features": [
25
+ "res2",
26
+ "res3",
27
+ "res4",
28
+ "res5"
29
+ ],
30
+ "res2_out_channels": 256,
31
+ "res4_dilation": 1,
32
+ "res5_dilation": 1,
33
+ "res5_multi_grid": [
34
+ 1,
35
+ 1,
36
+ 1
37
+ ],
38
+ "stem_out_channels": 128,
39
+ "stride_in_1x1": false,
40
+ "width_per_group": 64
41
+ },
42
+ "encoder": {
43
+ "common_stride": 4,
44
+ "conv_dim": 256,
45
+ "in_features": [
46
+ "res2",
47
+ "res3",
48
+ "res4",
49
+ "res5"
50
+ ],
51
+ "transformer_in_features": [
52
+ "res3",
53
+ "res4",
54
+ "res5"
55
+ ],
56
+ "transformer_dim_feedforward": 1024,
57
+ "mask_dim": 256,
58
+ "transformer_enc_layers": 6,
59
+ "transformer_nheads": 8,
60
+ "transformer_dropout": 0
61
+ },
62
+ "decoder": {
63
+ "num_classes": 21,
64
+ "hidden_dim": 256,
65
+ "num_queries": 100,
66
+ "nheads": 8,
67
+ "dim_feedforward": 2048,
68
+ "dec_layers": 9,
69
+ "pre_norm": false,
70
+ "enforce_input_project": false,
71
+ "mask_dim": 256
72
+ },
73
+ "classes": [
74
+ "Background",
75
+ "Hat",
76
+ "Hair",
77
+ "Gloves",
78
+ "Sunglasses",
79
+ "UpperClothes",
80
+ "Dress",
81
+ "Coat",
82
+ "Socks",
83
+ "Pants",
84
+ "Torso-skin",
85
+ "Scarf",
86
+ "Skirt",
87
+ "Face",
88
+ "Left-arm",
89
+ "Right-arm",
90
+ "Left-leg",
91
+ "Right-leg",
92
+ "Left-shoe",
93
+ "Right-shoe",
94
+ "Human"
95
+ ]
96
+ }
97
+ }