Spaces:
Runtime error
Runtime error
Hanxiao Xiang
commited on
Commit
·
b328990
1
Parent(s):
0521061
upload
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .idea/.gitignore +8 -0
- .idea/Forecast4Muses.iml +14 -0
- .idea/deployment.xml +21 -0
- .idea/inspectionProfiles/Project_Default.xml +75 -0
- .idea/inspectionProfiles/profiles_settings.xml +6 -0
- .idea/misc.xml +4 -0
- .idea/modules.xml +8 -0
- .idea/vcs.xml +6 -0
- Model/Model6/Model6_0_ClothesDetection/__init__.py +0 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/__init__.py +0 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/_base_/__init__.py +0 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/_base_/default_runtime.py +34 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/_base_/det_p5_tta.py +57 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/custom_dataset/.ipynb_checkpoints/__init__.py +0 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/custom_dataset/.ipynb_checkpoints/yolov5_s-v61_syncbn_fast_1xb32-100e_cat-checkpoint.py +135 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/custom_dataset/.ipynb_checkpoints/yolov6_s_fast-checkpoint.py +124 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/custom_dataset/[A]dataset_split.sh +5 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/custom_dataset/__init__.py +0 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/custom_dataset/yolov5_s-v61_syncbn_fast_1xb32-100e_cat.py +135 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/custom_dataset/yolov6_s_fast.py +124 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/custom_dataset/yolov7_l_syncbn_fast_6x16b-100e_coco.py +489 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/custom_dataset/yolov7_l_syncbn_fast_6x32b-100e_coco.py +554 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/custom_dataset/yolov7_l_syncbn_fast_8x16b-300e_coco.py +472 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/README.md +118 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/__init__.py +0 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/crowdhuman/__init__.py +0 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/crowdhuman/yolov5_s-v61_8xb16-300e_ignore_crowdhuman.py +63 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/crowdhuman/yolov5_s-v61_fast_8xb16-300e_crowdhuman.py +47 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/metafile.yml +178 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/voc/__init__.py +0 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/voc/yolov5_l-v61_fast_1xb32-50e_voc.py +25 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/voc/yolov5_m-v61_fast_1xb64-50e_voc.py +17 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/voc/yolov5_n-v61_fast_1xb64-50e_voc.py +17 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/voc/yolov5_s-v61_fast_1xb64-50e_voc.py +270 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/voc/yolov5_x-v61_fast_1xb32-50e_voc.py +26 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_l-p6-v62_syncbn_fast_8xb16-300e_coco.py +15 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_l-v61_syncbn_fast_8xb16-300e_coco.py +15 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_m-p6-v62_syncbn_fast_8xb16-300e_coco.py +79 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_m-v61_syncbn_fast_8xb16-300e_coco.py +79 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_n-p6-v62_syncbn_fast_8xb16-300e_coco.py +15 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_n-v61_syncbn_fast_8xb16-300e_coco.py +15 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_s-p6-v62_syncbn_fast_8xb16-300e_coco.py +138 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_s-v61_fast_1xb12-40e_608x352_cat.py +70 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_s-v61_fast_1xb12-40e_cat.py +56 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_s-v61_syncbn-detect_8xb16-300e_coco.py +23 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_s-v61_syncbn_8xb16-300e_coco.py +292 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py +42 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py +12 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_x-p6-v62_syncbn_fast_8xb16-300e_coco.py +14 -0
- Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_x-v61_syncbn_fast_8xb16-300e_coco.py +14 -0
.idea/.gitignore
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Default ignored files
|
2 |
+
/shelf/
|
3 |
+
/workspace.xml
|
4 |
+
# Editor-based HTTP Client requests
|
5 |
+
/httpRequests/
|
6 |
+
# Datasource local storage ignored files
|
7 |
+
/dataSources/
|
8 |
+
/dataSources.local.xml
|
.idea/Forecast4Muses.iml
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<module type="PYTHON_MODULE" version="4">
|
3 |
+
<component name="NewModuleRootManager">
|
4 |
+
<content url="file://$MODULE_DIR$">
|
5 |
+
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
6 |
+
</content>
|
7 |
+
<orderEntry type="inheritedJdk" />
|
8 |
+
<orderEntry type="sourceFolder" forTests="false" />
|
9 |
+
</component>
|
10 |
+
<component name="PyDocumentationSettings">
|
11 |
+
<option name="format" value="GOOGLE" />
|
12 |
+
<option name="myDocStringFormat" value="Google" />
|
13 |
+
</component>
|
14 |
+
</module>
|
.idea/deployment.xml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project version="4">
|
3 |
+
<component name="PublishConfigData" remoteFilesAllowedToDisappearOnAutoupload="false">
|
4 |
+
<serverData>
|
5 |
+
<paths name="Forecast4Muses">
|
6 |
+
<serverdata>
|
7 |
+
<mappings>
|
8 |
+
<mapping local="$PROJECT_DIR$" web="/" />
|
9 |
+
</mappings>
|
10 |
+
</serverdata>
|
11 |
+
</paths>
|
12 |
+
<paths name="root@connect.beijinga.seetacloud.com:21383 password">
|
13 |
+
<serverdata>
|
14 |
+
<mappings>
|
15 |
+
<mapping local="$PROJECT_DIR$" web="/" />
|
16 |
+
</mappings>
|
17 |
+
</serverdata>
|
18 |
+
</paths>
|
19 |
+
</serverData>
|
20 |
+
</component>
|
21 |
+
</project>
|
.idea/inspectionProfiles/Project_Default.xml
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<component name="InspectionProjectProfileManager">
|
2 |
+
<profile version="1.0">
|
3 |
+
<option name="myName" value="Project Default" />
|
4 |
+
<inspection_tool class="DuplicatedCode" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
5 |
+
<Languages>
|
6 |
+
<language minSize="74" name="Python" />
|
7 |
+
</Languages>
|
8 |
+
</inspection_tool>
|
9 |
+
<inspection_tool class="HtmlUnknownAttribute" enabled="true" level="WARNING" enabled_by_default="true">
|
10 |
+
<option name="myValues">
|
11 |
+
<value>
|
12 |
+
<list size="1">
|
13 |
+
<item index="0" class="java.lang.String" itemvalue="length" />
|
14 |
+
</list>
|
15 |
+
</value>
|
16 |
+
</option>
|
17 |
+
<option name="myCustomValuesEnabled" value="true" />
|
18 |
+
</inspection_tool>
|
19 |
+
<inspection_tool class="HtmlUnknownTag" enabled="true" level="WARNING" enabled_by_default="true">
|
20 |
+
<option name="myValues">
|
21 |
+
<value>
|
22 |
+
<list size="7">
|
23 |
+
<item index="0" class="java.lang.String" itemvalue="nobr" />
|
24 |
+
<item index="1" class="java.lang.String" itemvalue="noembed" />
|
25 |
+
<item index="2" class="java.lang.String" itemvalue="comment" />
|
26 |
+
<item index="3" class="java.lang.String" itemvalue="noscript" />
|
27 |
+
<item index="4" class="java.lang.String" itemvalue="embed" />
|
28 |
+
<item index="5" class="java.lang.String" itemvalue="script" />
|
29 |
+
<item index="6" class="java.lang.String" itemvalue="li" />
|
30 |
+
</list>
|
31 |
+
</value>
|
32 |
+
</option>
|
33 |
+
<option name="myCustomValuesEnabled" value="true" />
|
34 |
+
</inspection_tool>
|
35 |
+
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
36 |
+
<option name="ignoredPackages">
|
37 |
+
<value>
|
38 |
+
<list size="15">
|
39 |
+
<item index="0" class="java.lang.String" itemvalue="json_tricks" />
|
40 |
+
<item index="1" class="java.lang.String" itemvalue="coverage" />
|
41 |
+
<item index="2" class="java.lang.String" itemvalue="scipy" />
|
42 |
+
<item index="3" class="java.lang.String" itemvalue="pytest" />
|
43 |
+
<item index="4" class="java.lang.String" itemvalue="chumpy" />
|
44 |
+
<item index="5" class="java.lang.String" itemvalue="flake8" />
|
45 |
+
<item index="6" class="java.lang.String" itemvalue="pytest-runner" />
|
46 |
+
<item index="7" class="java.lang.String" itemvalue="interrogate" />
|
47 |
+
<item index="8" class="java.lang.String" itemvalue="munkres" />
|
48 |
+
<item index="9" class="java.lang.String" itemvalue="parameterized" />
|
49 |
+
<item index="10" class="java.lang.String" itemvalue="xtcocotools" />
|
50 |
+
<item index="11" class="java.lang.String" itemvalue="isort" />
|
51 |
+
<item index="12" class="java.lang.String" itemvalue="xdoctest" />
|
52 |
+
<item index="13" class="java.lang.String" itemvalue="pandas" />
|
53 |
+
<item index="14" class="java.lang.String" itemvalue="xlwings" />
|
54 |
+
</list>
|
55 |
+
</value>
|
56 |
+
</option>
|
57 |
+
</inspection_tool>
|
58 |
+
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
59 |
+
<option name="ignoredErrors">
|
60 |
+
<list>
|
61 |
+
<option value="N806" />
|
62 |
+
<option value="N802" />
|
63 |
+
<option value="N803" />
|
64 |
+
</list>
|
65 |
+
</option>
|
66 |
+
</inspection_tool>
|
67 |
+
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
68 |
+
<option name="ignoredIdentifiers">
|
69 |
+
<list>
|
70 |
+
<option value="IndexError.__add__" />
|
71 |
+
</list>
|
72 |
+
</option>
|
73 |
+
</inspection_tool>
|
74 |
+
</profile>
|
75 |
+
</component>
|
.idea/inspectionProfiles/profiles_settings.xml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<component name="InspectionProjectProfileManager">
|
2 |
+
<settings>
|
3 |
+
<option name="USE_PROJECT_PROFILE" value="false" />
|
4 |
+
<version value="1.0" />
|
5 |
+
</settings>
|
6 |
+
</component>
|
.idea/misc.xml
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project version="4">
|
3 |
+
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (Forecast4Muses)" project-jdk-type="Python SDK" />
|
4 |
+
</project>
|
.idea/modules.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project version="4">
|
3 |
+
<component name="ProjectModuleManager">
|
4 |
+
<modules>
|
5 |
+
<module fileurl="file://$PROJECT_DIR$/.idea/Forecast4Muses.iml" filepath="$PROJECT_DIR$/.idea/Forecast4Muses.iml" />
|
6 |
+
</modules>
|
7 |
+
</component>
|
8 |
+
</project>
|
.idea/vcs.xml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project version="4">
|
3 |
+
<component name="VcsDirectoryMappings">
|
4 |
+
<mapping directory="" vcs="Git" />
|
5 |
+
</component>
|
6 |
+
</project>
|
Model/Model6/Model6_0_ClothesDetection/__init__.py
ADDED
File without changes
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/__init__.py
ADDED
File without changes
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/_base_/__init__.py
ADDED
File without changes
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/_base_/default_runtime.py
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
default_scope = 'mmyolo'
|
2 |
+
|
3 |
+
default_hooks = dict(
|
4 |
+
timer=dict(type='IterTimerHook'),
|
5 |
+
logger=dict(type='LoggerHook', interval=50),
|
6 |
+
param_scheduler=dict(type='ParamSchedulerHook'),
|
7 |
+
checkpoint=dict(type='CheckpointHook', interval=1),
|
8 |
+
sampler_seed=dict(type='DistSamplerSeedHook'),
|
9 |
+
visualization=dict(type='mmdet.DetVisualizationHook'))
|
10 |
+
|
11 |
+
env_cfg = dict(
|
12 |
+
cudnn_benchmark=False,
|
13 |
+
mp_cfg=dict(mp_start_method='fork', opencv_num_threads=0),
|
14 |
+
dist_cfg=dict(backend='nccl'),
|
15 |
+
)
|
16 |
+
|
17 |
+
vis_backends = [dict(type='LocalVisBackend')]
|
18 |
+
visualizer = dict(
|
19 |
+
type='mmdet.DetLocalVisualizer',
|
20 |
+
vis_backends=vis_backends,
|
21 |
+
name='visualizer')
|
22 |
+
log_processor = dict(type='LogProcessor', window_size=50, by_epoch=True)
|
23 |
+
|
24 |
+
log_level = 'INFO'
|
25 |
+
load_from = None
|
26 |
+
resume = False
|
27 |
+
|
28 |
+
# file_client_args = dict(
|
29 |
+
# backend='petrel',
|
30 |
+
# path_mapping=dict({
|
31 |
+
# './data/': 's3://openmmlab/datasets/detection/',
|
32 |
+
# 'data/': 's3://openmmlab/datasets/detection/'
|
33 |
+
# }))
|
34 |
+
file_client_args = dict(backend='disk')
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/_base_/det_p5_tta.py
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# TODO: Need to solve the problem of multiple file_client_args parameters
|
2 |
+
# _file_client_args = dict(
|
3 |
+
# backend='petrel',
|
4 |
+
# path_mapping=dict({
|
5 |
+
# './data/': 's3://openmmlab/datasets/detection/',
|
6 |
+
# 'data/': 's3://openmmlab/datasets/detection/'
|
7 |
+
# }))
|
8 |
+
_file_client_args = dict(backend='disk')
|
9 |
+
|
10 |
+
tta_model = dict(
|
11 |
+
type='mmdet.DetTTAModel',
|
12 |
+
tta_cfg=dict(nms=dict(type='nms', iou_threshold=0.65), max_per_img=300))
|
13 |
+
|
14 |
+
img_scales = [(640, 640), (320, 320), (960, 960)]
|
15 |
+
|
16 |
+
# LoadImageFromFile
|
17 |
+
# / | \
|
18 |
+
# (RatioResize,LetterResize) (RatioResize,LetterResize) (RatioResize,LetterResize) # noqa
|
19 |
+
# / \ / \ / \
|
20 |
+
# RandomFlip RandomFlip RandomFlip RandomFlip RandomFlip RandomFlip # noqa
|
21 |
+
# | | | | | |
|
22 |
+
# LoadAnn LoadAnn LoadAnn LoadAnn LoadAnn LoadAnn
|
23 |
+
# | | | | | |
|
24 |
+
# PackDetIn PackDetIn PackDetIn PackDetIn PackDetIn PackDetIn # noqa
|
25 |
+
|
26 |
+
_multiscale_resize_transforms = [
|
27 |
+
dict(
|
28 |
+
type='Compose',
|
29 |
+
transforms=[
|
30 |
+
dict(type='YOLOv5KeepRatioResize', scale=s),
|
31 |
+
dict(
|
32 |
+
type='LetterResize',
|
33 |
+
scale=s,
|
34 |
+
allow_scale_up=False,
|
35 |
+
pad_val=dict(img=114))
|
36 |
+
]) for s in img_scales
|
37 |
+
]
|
38 |
+
|
39 |
+
tta_pipeline = [
|
40 |
+
dict(type='LoadImageFromFile', file_client_args=_file_client_args),
|
41 |
+
dict(
|
42 |
+
type='TestTimeAug',
|
43 |
+
transforms=[
|
44 |
+
_multiscale_resize_transforms,
|
45 |
+
[
|
46 |
+
dict(type='mmdet.RandomFlip', prob=1.),
|
47 |
+
dict(type='mmdet.RandomFlip', prob=0.)
|
48 |
+
], [dict(type='mmdet.LoadAnnotations', with_bbox=True)],
|
49 |
+
[
|
50 |
+
dict(
|
51 |
+
type='mmdet.PackDetInputs',
|
52 |
+
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
|
53 |
+
'scale_factor', 'pad_param', 'flip',
|
54 |
+
'flip_direction'))
|
55 |
+
]
|
56 |
+
])
|
57 |
+
]
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/custom_dataset/.ipynb_checkpoints/__init__.py
ADDED
File without changes
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/custom_dataset/.ipynb_checkpoints/yolov5_s-v61_syncbn_fast_1xb32-100e_cat-checkpoint.py
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = '../yolov5/yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py'
|
2 |
+
|
3 |
+
max_epochs = 100 # 训练的最大 epoch
|
4 |
+
data_root = './data-df2/' # 数据集目录的绝对路径
|
5 |
+
# data_root = '/root/workspace/mmyolo/data/cat/' # Docker 容器里面数据集目录的绝对路径
|
6 |
+
|
7 |
+
# 结果保存的路径,可以省略,省略保存的文件名位于 work_dirs 下 config 同名的文件夹中
|
8 |
+
# 如果某个 config 只是修改了部分参数,修改这个变量就可以将新的训练文件保存到其他地方
|
9 |
+
work_dir = './work_dirs/yolov5_s_df2'
|
10 |
+
|
11 |
+
# load_from 可以指定本地路径或者 URL,设置了 URL 会自动进行下载,因为上面已经下载过,我们这里设置本地路径
|
12 |
+
# 因为本教程是在 cat 数据集上微调,故这里需要使用 `load_from` 来加载 MMYOLO 中的预训练模型,这样可以在加快收敛速度的同时保证精度
|
13 |
+
# load_from = './work_dirs/yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700-86e02187.pth' # noqa
|
14 |
+
|
15 |
+
# 根据自己的 GPU 情况,修改 batch size,YOLOv5-s 默认为 8卡 x 16bs
|
16 |
+
train_batch_size_per_gpu = 32
|
17 |
+
train_num_workers = 4 # 推荐使用 train_num_workers = nGPU x 4
|
18 |
+
|
19 |
+
save_epoch_intervals = 2 # 每 interval 轮迭代进行一次保存一次权重
|
20 |
+
|
21 |
+
# 根据自己的 GPU 情况,修改 base_lr,修改的比例是 base_lr_default * (your_bs / default_bs)
|
22 |
+
base_lr = _base_.base_lr / 4
|
23 |
+
|
24 |
+
anchors = [ # 此处已经根据数据集特点更新了 anchor,关于 anchor 的生成,后面小节会讲解
|
25 |
+
[(68, 69), (154, 91), (143, 162)], # P3/8
|
26 |
+
[(242, 160), (189, 287), (391, 207)], # P4/16
|
27 |
+
[(353, 337), (539, 341), (443, 432)] # P5/32
|
28 |
+
]
|
29 |
+
|
30 |
+
class_name = ('short_sleeved_shirt',
|
31 |
+
'long_sleeved_shirt',
|
32 |
+
'short_sleeved_outwear',
|
33 |
+
'long_sleeved_outwear',
|
34 |
+
'vest',
|
35 |
+
'sling',
|
36 |
+
'shorts',
|
37 |
+
'trousers',
|
38 |
+
'skirt',
|
39 |
+
'short_sleeved_dress',
|
40 |
+
'long_sleeved_dress',
|
41 |
+
'vest_dress',
|
42 |
+
'sling_dress') # 根据 class_with_id.txt 类别信息,设置 class_name
|
43 |
+
|
44 |
+
num_classes = len(class_name)
|
45 |
+
metainfo = dict(
|
46 |
+
classes=class_name,
|
47 |
+
palette=[(255, 0, 0),
|
48 |
+
(255, 128, 0),
|
49 |
+
(255, 255, 0),
|
50 |
+
(128, 255, 0),
|
51 |
+
(0, 255, 0),
|
52 |
+
(0, 255, 128),
|
53 |
+
(0, 255, 255),
|
54 |
+
(0, 128, 255),
|
55 |
+
(0, 0, 255),
|
56 |
+
(127, 0, 255),
|
57 |
+
(255, 0, 255),
|
58 |
+
(255, 0, 127),
|
59 |
+
(128, 128, 128)] # 画图时候的颜色,随便设置即可
|
60 |
+
)
|
61 |
+
|
62 |
+
train_cfg = dict(
|
63 |
+
max_epochs=max_epochs,
|
64 |
+
val_begin=20, # 第几个 epoch 后验证,这里设置 20 是因为前 20 个 epoch 精度不高,测试意义不大,故跳过
|
65 |
+
val_interval=save_epoch_intervals # 每 val_interval 轮迭代进行一次测试评估
|
66 |
+
# dynamic_intervals=[(max_epochs-_base_.num_last_epochs, 1)]
|
67 |
+
)
|
68 |
+
|
69 |
+
model = dict(
|
70 |
+
bbox_head=dict(
|
71 |
+
head_module=dict(num_classes=num_classes),
|
72 |
+
prior_generator=dict(base_sizes=anchors),
|
73 |
+
|
74 |
+
# loss_cls 会根据 num_classes 动态调整,但是 num_classes = 1 的时候,loss_cls 恒为 0
|
75 |
+
loss_cls=dict(loss_weight=0.5 *
|
76 |
+
(num_classes / 80 * 3 / _base_.num_det_layers))))
|
77 |
+
|
78 |
+
train_dataloader = dict(
|
79 |
+
batch_size=train_batch_size_per_gpu,
|
80 |
+
num_workers=train_num_workers,
|
81 |
+
dataset=dict(
|
82 |
+
_delete_=True,
|
83 |
+
type='RepeatDataset',
|
84 |
+
# 数据量太少的话,可以使用 RepeatDataset ,在每个 epoch 内重复当前数据集 n 次,这里设置 5 是重复 5 次
|
85 |
+
times=2,
|
86 |
+
dataset=dict(
|
87 |
+
type=_base_.dataset_type,
|
88 |
+
data_root=data_root,
|
89 |
+
metainfo=metainfo,
|
90 |
+
ann_file='annotations/trainval.json',
|
91 |
+
data_prefix=dict(img='smaller-dataset/'),
|
92 |
+
filter_cfg=dict(filter_empty_gt=False, min_size=32),
|
93 |
+
pipeline=_base_.train_pipeline)))
|
94 |
+
|
95 |
+
val_dataloader = dict(
|
96 |
+
dataset=dict(
|
97 |
+
metainfo=metainfo,
|
98 |
+
data_root=data_root,
|
99 |
+
ann_file='annotations/trainval.json',
|
100 |
+
data_prefix=dict(img='smaller-dataset/')))
|
101 |
+
|
102 |
+
test_dataloader = val_dataloader
|
103 |
+
|
104 |
+
val_evaluator = dict(ann_file=data_root + 'annotations/trainval.json')
|
105 |
+
test_evaluator = val_evaluator
|
106 |
+
|
107 |
+
optim_wrapper = dict(optimizer=dict(lr=base_lr))
|
108 |
+
|
109 |
+
default_hooks = dict(
|
110 |
+
# 设置间隔多少个 epoch 保存模型,以及保存模型最多几个,`save_best` 是另外保存最佳模型(推荐)
|
111 |
+
checkpoint=dict(
|
112 |
+
type='CheckpointHook',
|
113 |
+
interval=save_epoch_intervals,
|
114 |
+
max_keep_ckpts=5,
|
115 |
+
save_best='auto'),
|
116 |
+
param_scheduler=dict(max_epochs=max_epochs, warmup_mim_iter=10),
|
117 |
+
# logger 输出的间隔
|
118 |
+
logger=dict(type='LoggerHook', interval=10))
|
119 |
+
|
120 |
+
# custom_hooks = [
|
121 |
+
# dict(
|
122 |
+
# type="EMAHook",
|
123 |
+
# ema_type="ExpMomentumEMA",
|
124 |
+
# momentum=0.0001,
|
125 |
+
# update_buffers=True,
|
126 |
+
# strict_load=False,
|
127 |
+
# priority=49),
|
128 |
+
# dict(
|
129 |
+
# type="mmdet.PipelineSwitchHook",
|
130 |
+
# switch_epoch=max_epochs-max_epochs-_base_.num_last_epochs,
|
131 |
+
# switch_pipeline=_base_.train_pipeline_stage2
|
132 |
+
# )
|
133 |
+
# ]
|
134 |
+
|
135 |
+
visualizer = dict(vis_backends=[dict(type='LocalVisBackend'), dict(type='WandbVisBackend')])
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/custom_dataset/.ipynb_checkpoints/yolov6_s_fast-checkpoint.py
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = '../yolov6/yolov6_s_syncbn_fast_8xb32-400e_coco.py'
|
2 |
+
|
3 |
+
max_epochs = 100 # 训练的最大 epoch
|
4 |
+
data_root = './data-df2/' # 数据集目录的绝对路径
|
5 |
+
|
6 |
+
# 结果保存的路径,可以省略,省略保存的文件名位于 work_dirs 下 config 同名的文件夹中
|
7 |
+
# 如果某个 config 只是修改了部分参数,修改这个变量就可以将新的训练文件保存到其他地方
|
8 |
+
work_dir = './work_dirs/yolov6_s_df2'
|
9 |
+
|
10 |
+
# 根据自己的 GPU 情况,修改 batch size,YOLOv5-s 默认为 8卡 x 16bs
|
11 |
+
train_batch_size_per_gpu = 32
|
12 |
+
train_num_workers = 4 # 推荐使用 train_num_workers = nGPU x 4
|
13 |
+
|
14 |
+
save_epoch_intervals = 2 # 每 interval 轮迭代进行一次保存一次权重
|
15 |
+
|
16 |
+
# 根据自己的 GPU 情况,修改 base_lr,修改的比例是 base_lr_default * (your_bs / default_bs)
|
17 |
+
base_lr = _base_.base_lr / 4
|
18 |
+
|
19 |
+
class_name = ('short_sleeved_shirt',
|
20 |
+
'long_sleeved_shirt',
|
21 |
+
'short_sleeved_outwear',
|
22 |
+
'long_sleeved_outwear',
|
23 |
+
'vest',
|
24 |
+
'sling',
|
25 |
+
'shorts',
|
26 |
+
'trousers',
|
27 |
+
'skirt',
|
28 |
+
'short_sleeved_dress',
|
29 |
+
'long_sleeved_dress',
|
30 |
+
'vest_dress',
|
31 |
+
'sling_dress') # 根据 class_with_id.txt 类别信息,设置 class_name
|
32 |
+
|
33 |
+
num_classes = len(class_name)
|
34 |
+
metainfo = dict(
|
35 |
+
classes=class_name,
|
36 |
+
palette=[(255, 0, 0),
|
37 |
+
(255, 128, 0),
|
38 |
+
(255, 255, 0),
|
39 |
+
(128, 255, 0),
|
40 |
+
(0, 255, 0),
|
41 |
+
(0, 255, 128),
|
42 |
+
(0, 255, 255),
|
43 |
+
(0, 128, 255),
|
44 |
+
(0, 0, 255),
|
45 |
+
(127, 0, 255),
|
46 |
+
(255, 0, 255),
|
47 |
+
(255, 0, 127),
|
48 |
+
(128, 128, 128)] # 画图时候的颜色,随便设置即可
|
49 |
+
)
|
50 |
+
|
51 |
+
train_cfg = dict(
|
52 |
+
max_epochs=max_epochs,
|
53 |
+
val_begin=20, # 第几个 epoch 后验证,这里设置 20 是因为前 20 个 epoch 精度不高,测试意义不大,故跳过
|
54 |
+
val_interval=save_epoch_intervals, # 每 val_interval 轮迭代进行一次测试评估
|
55 |
+
dynamic_intervals=[(max_epochs-_base_.num_last_epochs, 1)]
|
56 |
+
)
|
57 |
+
|
58 |
+
model = dict(
|
59 |
+
bbox_head=dict(
|
60 |
+
head_module=dict(num_classes=num_classes)),
|
61 |
+
train_cfg=dict(
|
62 |
+
initial_assigner=dict(num_classes=num_classes),
|
63 |
+
assigner=dict(num_classes=num_classes)
|
64 |
+
)
|
65 |
+
)
|
66 |
+
|
67 |
+
train_dataloader = dict(
|
68 |
+
batch_size=train_batch_size_per_gpu,
|
69 |
+
num_workers=train_num_workers,
|
70 |
+
dataset=dict(
|
71 |
+
_delete_=True,
|
72 |
+
type='RepeatDataset',
|
73 |
+
# 数据量太少的话,可以使用 RepeatDataset ,在每个 epoch 内重复当前数据集 n 次,这里设置 5 是重复 5 次
|
74 |
+
times=2,
|
75 |
+
dataset=dict(
|
76 |
+
type=_base_.dataset_type,
|
77 |
+
data_root=data_root,
|
78 |
+
metainfo=metainfo,
|
79 |
+
ann_file='annotations/trainval.json',
|
80 |
+
data_prefix=dict(img='smaller-dataset/'),
|
81 |
+
filter_cfg=dict(filter_empty_gt=False, min_size=32),
|
82 |
+
pipeline=_base_.train_pipeline)))
|
83 |
+
|
84 |
+
val_dataloader = dict(
|
85 |
+
dataset=dict(
|
86 |
+
metainfo=metainfo,
|
87 |
+
data_root=data_root,
|
88 |
+
ann_file='annotations/trainval.json',
|
89 |
+
data_prefix=dict(img='smaller-dataset/')))
|
90 |
+
|
91 |
+
test_dataloader = val_dataloader
|
92 |
+
|
93 |
+
val_evaluator = dict(ann_file=data_root + 'annotations/trainval.json')
|
94 |
+
test_evaluator = val_evaluator
|
95 |
+
|
96 |
+
optim_wrapper = dict(optimizer=dict(lr=base_lr))
|
97 |
+
|
98 |
+
default_hooks = dict(
|
99 |
+
# 设置间隔多少个 epoch 保存模型,以及保存模型最多几个,`save_best` 是另外保存最佳模型(推荐)
|
100 |
+
checkpoint=dict(
|
101 |
+
type='CheckpointHook',
|
102 |
+
interval=save_epoch_intervals,
|
103 |
+
max_keep_ckpts=5,
|
104 |
+
save_best='auto'),
|
105 |
+
param_scheduler=dict(max_epochs=max_epochs),
|
106 |
+
# logger 输出的间隔
|
107 |
+
logger=dict(type='LoggerHook', interval=10))
|
108 |
+
|
109 |
+
custom_hooks = [
|
110 |
+
dict(
|
111 |
+
type="EMAHook",
|
112 |
+
ema_type="ExpMomentumEMA",
|
113 |
+
momentum=0.0001,
|
114 |
+
update_buffers=True,
|
115 |
+
strict_load=False,
|
116 |
+
priority=49),
|
117 |
+
dict(
|
118 |
+
type="mmdet.PipelineSwitchHook",
|
119 |
+
switch_epoch=max_epochs-max_epochs-_base_.num_last_epochs,
|
120 |
+
switch_pipeline=_base_.train_pipeline_stage2
|
121 |
+
)
|
122 |
+
]
|
123 |
+
|
124 |
+
visualizer = dict(vis_backends=[dict(type='LocalVisBackend'), dict(type='WandbVisBackend')])
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/custom_dataset/[A]dataset_split.sh
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
cd ..
|
2 |
+
python tools/misc/coco_split.py --json data-df2/deepfashion2-smaller-dataset.json \
|
3 |
+
--out-dir data-df2/annotations/ \
|
4 |
+
--ratios 8 2 \
|
5 |
+
--shuffle --seed 10
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/custom_dataset/__init__.py
ADDED
File without changes
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/custom_dataset/yolov5_s-v61_syncbn_fast_1xb32-100e_cat.py
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = '../yolov5/yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py'
|
2 |
+
|
3 |
+
max_epochs = 100 # 训练的最大 epoch
|
4 |
+
data_root = './data-df2/' # 数据集目录的绝对路径
|
5 |
+
# data_root = '/root/workspace/mmyolo/data/cat/' # Docker 容器里面数据集目录的绝对路径
|
6 |
+
|
7 |
+
# 结果保存的路径,可以省略,省略保存的文件名位于 work_dirs 下 config 同名的文件夹中
|
8 |
+
# 如果某个 config 只是修改了部分参数,修改这个变量就可以将新的训练文件保存到其他地方
|
9 |
+
work_dir = './work_dirs/yolov5_s_df2'
|
10 |
+
|
11 |
+
# load_from 可以指定本地路径或者 URL,设置了 URL 会自动进行下载,因为上面已经下载过,我们这里设置本地路径
|
12 |
+
# 因为本教程是在 cat 数据集上微调,故这里需要使用 `load_from` 来加载 MMYOLO 中的预训练模型,这样可以在加快收敛速度的同时保证精度
|
13 |
+
# load_from = './work_dirs/yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700-86e02187.pth' # noqa
|
14 |
+
|
15 |
+
# 根据自己的 GPU 情况,修改 batch size,YOLOv5-s 默认为 8卡 x 16bs
|
16 |
+
train_batch_size_per_gpu = 32
|
17 |
+
train_num_workers = 4 # 推荐使用 train_num_workers = nGPU x 4
|
18 |
+
|
19 |
+
save_epoch_intervals = 2 # 每 interval 轮迭代进行一次保存一次权重
|
20 |
+
|
21 |
+
# 根据自己的 GPU 情况,修改 base_lr,修改的比例是 base_lr_default * (your_bs / default_bs)
|
22 |
+
base_lr = _base_.base_lr / 4
|
23 |
+
|
24 |
+
anchors = [ # 此处已经根据数据集特点更新了 anchor,关于 anchor 的生成,后面小节会讲解
|
25 |
+
[(68, 69), (154, 91), (143, 162)], # P3/8
|
26 |
+
[(242, 160), (189, 287), (391, 207)], # P4/16
|
27 |
+
[(353, 337), (539, 341), (443, 432)] # P5/32
|
28 |
+
]
|
29 |
+
|
30 |
+
class_name = ('short_sleeved_shirt',
|
31 |
+
'long_sleeved_shirt',
|
32 |
+
'short_sleeved_outwear',
|
33 |
+
'long_sleeved_outwear',
|
34 |
+
'vest',
|
35 |
+
'sling',
|
36 |
+
'shorts',
|
37 |
+
'trousers',
|
38 |
+
'skirt',
|
39 |
+
'short_sleeved_dress',
|
40 |
+
'long_sleeved_dress',
|
41 |
+
'vest_dress',
|
42 |
+
'sling_dress') # 根据 class_with_id.txt 类别信息,设置 class_name
|
43 |
+
|
44 |
+
num_classes = len(class_name)
|
45 |
+
metainfo = dict(
|
46 |
+
classes=class_name,
|
47 |
+
palette=[(255, 0, 0),
|
48 |
+
(255, 128, 0),
|
49 |
+
(255, 255, 0),
|
50 |
+
(128, 255, 0),
|
51 |
+
(0, 255, 0),
|
52 |
+
(0, 255, 128),
|
53 |
+
(0, 255, 255),
|
54 |
+
(0, 128, 255),
|
55 |
+
(0, 0, 255),
|
56 |
+
(127, 0, 255),
|
57 |
+
(255, 0, 255),
|
58 |
+
(255, 0, 127),
|
59 |
+
(128, 128, 128)] # 画图时候的颜色,随便设置即可
|
60 |
+
)
|
61 |
+
|
62 |
+
train_cfg = dict(
|
63 |
+
max_epochs=max_epochs,
|
64 |
+
val_begin=20, # 第几个 epoch 后验证,这里设置 20 是因为前 20 个 epoch 精度不高,测试意义不大,故跳过
|
65 |
+
val_interval=save_epoch_intervals # 每 val_interval 轮迭代进行一次测试评估
|
66 |
+
# dynamic_intervals=[(max_epochs-_base_.num_last_epochs, 1)]
|
67 |
+
)
|
68 |
+
|
69 |
+
model = dict(
|
70 |
+
bbox_head=dict(
|
71 |
+
head_module=dict(num_classes=num_classes),
|
72 |
+
prior_generator=dict(base_sizes=anchors),
|
73 |
+
|
74 |
+
# loss_cls 会根据 num_classes 动态调整,但是 num_classes = 1 的时候,loss_cls 恒为 0
|
75 |
+
loss_cls=dict(loss_weight=0.5 *
|
76 |
+
(num_classes / 80 * 3 / _base_.num_det_layers))))
|
77 |
+
|
78 |
+
train_dataloader = dict(
|
79 |
+
batch_size=train_batch_size_per_gpu,
|
80 |
+
num_workers=train_num_workers,
|
81 |
+
dataset=dict(
|
82 |
+
_delete_=True,
|
83 |
+
type='RepeatDataset',
|
84 |
+
# 数据量太少的话,可以使用 RepeatDataset ,在每个 epoch 内重复当前数据集 n 次,这里设置 5 是重复 5 次
|
85 |
+
times=2,
|
86 |
+
dataset=dict(
|
87 |
+
type=_base_.dataset_type,
|
88 |
+
data_root=data_root,
|
89 |
+
metainfo=metainfo,
|
90 |
+
ann_file='annotations/trainval.json',
|
91 |
+
data_prefix=dict(img='smaller-dataset/'),
|
92 |
+
filter_cfg=dict(filter_empty_gt=False, min_size=32),
|
93 |
+
pipeline=_base_.train_pipeline)))
|
94 |
+
|
95 |
+
val_dataloader = dict(
|
96 |
+
dataset=dict(
|
97 |
+
metainfo=metainfo,
|
98 |
+
data_root=data_root,
|
99 |
+
ann_file='annotations/trainval.json',
|
100 |
+
data_prefix=dict(img='smaller-dataset/')))
|
101 |
+
|
102 |
+
test_dataloader = val_dataloader
|
103 |
+
|
104 |
+
val_evaluator = dict(ann_file=data_root + 'annotations/trainval.json')
|
105 |
+
test_evaluator = val_evaluator
|
106 |
+
|
107 |
+
optim_wrapper = dict(optimizer=dict(lr=base_lr))
|
108 |
+
|
109 |
+
default_hooks = dict(
|
110 |
+
# 设置间隔多少个 epoch 保存模型,以及保存模型最多几个,`save_best` 是另外保存最佳模型(推荐)
|
111 |
+
checkpoint=dict(
|
112 |
+
type='CheckpointHook',
|
113 |
+
interval=save_epoch_intervals,
|
114 |
+
max_keep_ckpts=5,
|
115 |
+
save_best='auto'),
|
116 |
+
param_scheduler=dict(max_epochs=max_epochs, warmup_mim_iter=10),
|
117 |
+
# logger 输出的间隔
|
118 |
+
logger=dict(type='LoggerHook', interval=10))
|
119 |
+
|
120 |
+
# custom_hooks = [
|
121 |
+
# dict(
|
122 |
+
# type="EMAHook",
|
123 |
+
# ema_type="ExpMomentumEMA",
|
124 |
+
# momentum=0.0001,
|
125 |
+
# update_buffers=True,
|
126 |
+
# strict_load=False,
|
127 |
+
# priority=49),
|
128 |
+
# dict(
|
129 |
+
# type="mmdet.PipelineSwitchHook",
|
130 |
+
# switch_epoch=max_epochs-max_epochs-_base_.num_last_epochs,
|
131 |
+
# switch_pipeline=_base_.train_pipeline_stage2
|
132 |
+
# )
|
133 |
+
# ]
|
134 |
+
|
135 |
+
visualizer = dict(vis_backends=[dict(type='LocalVisBackend'), dict(type='WandbVisBackend')])
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/custom_dataset/yolov6_s_fast.py
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = '../yolov6/yolov6_s_syncbn_fast_8xb32-400e_coco.py'
|
2 |
+
|
3 |
+
max_epochs = 100 # 训练的最大 epoch
|
4 |
+
data_root = './data-df2/' # 数据集目录的绝对路径
|
5 |
+
|
6 |
+
# 结果保存的路径,可以省略,省略保存的文件名位于 work_dirs 下 config 同名的文件夹中
|
7 |
+
# 如果某个 config 只是修改了部分参数,修改这个变量就可以将新的训练文件保存到其他地方
|
8 |
+
work_dir = './work_dirs/yolov6_s_df2'
|
9 |
+
|
10 |
+
# 根据自己的 GPU 情况,修改 batch size,YOLOv5-s 默认为 8卡 x 16bs
|
11 |
+
train_batch_size_per_gpu = 32
|
12 |
+
train_num_workers = 4 # 推荐使用 train_num_workers = nGPU x 4
|
13 |
+
|
14 |
+
save_epoch_intervals = 2
|
15 |
+
|
16 |
+
# 根据自己的 GPU 情况,修改 base_lr,修改的比例是 base_lr_default * (your_bs / default_bs)
|
17 |
+
base_lr = _base_.base_lr / 4
|
18 |
+
|
19 |
+
class_name = ('short_sleeved_shirt',
|
20 |
+
'long_sleeved_shirt',
|
21 |
+
'short_sleeved_outwear',
|
22 |
+
'long_sleeved_outwear',
|
23 |
+
'vest',
|
24 |
+
'sling',
|
25 |
+
'shorts',
|
26 |
+
'trousers',
|
27 |
+
'skirt',
|
28 |
+
'short_sleeved_dress',
|
29 |
+
'long_sleeved_dress',
|
30 |
+
'vest_dress',
|
31 |
+
'sling_dress') # 根据 class_with_id.txt 类别信息,设置 class_name
|
32 |
+
|
33 |
+
num_classes = len(class_name)
|
34 |
+
metainfo = dict(
|
35 |
+
classes=class_name,
|
36 |
+
palette=[(255, 0, 0),
|
37 |
+
(255, 128, 0),
|
38 |
+
(255, 255, 0),
|
39 |
+
(128, 255, 0),
|
40 |
+
(0, 255, 0),
|
41 |
+
(0, 255, 128),
|
42 |
+
(0, 255, 255),
|
43 |
+
(0, 128, 255),
|
44 |
+
(0, 0, 255),
|
45 |
+
(127, 0, 255),
|
46 |
+
(255, 0, 255),
|
47 |
+
(255, 0, 127),
|
48 |
+
(128, 128, 128)] # 画图时候的颜色,随便设置即可
|
49 |
+
)
|
50 |
+
|
51 |
+
train_cfg = dict(
|
52 |
+
max_epochs=max_epochs,
|
53 |
+
val_begin=20, # 第几个 epoch 后验证,这里设置 20 是因为前 20 个 epoch 精度不高,测试意义不大,故跳过
|
54 |
+
val_interval=save_epoch_intervals, # 每 val_interval 轮迭代进行一次测试评估
|
55 |
+
dynamic_intervals=[(max_epochs-_base_.num_last_epochs, 1)]
|
56 |
+
)
|
57 |
+
|
58 |
+
model = dict(
|
59 |
+
bbox_head=dict(
|
60 |
+
head_module=dict(num_classes=num_classes)),
|
61 |
+
train_cfg=dict(
|
62 |
+
initial_assigner=dict(num_classes=num_classes),
|
63 |
+
assigner=dict(num_classes=num_classes)
|
64 |
+
)
|
65 |
+
)
|
66 |
+
|
67 |
+
train_dataloader = dict(
|
68 |
+
batch_size=train_batch_size_per_gpu,
|
69 |
+
num_workers=train_num_workers,
|
70 |
+
dataset=dict(
|
71 |
+
_delete_=True,
|
72 |
+
type='RepeatDataset',
|
73 |
+
# 数据量太少的话,可以使用 RepeatDataset ,在每个 epoch 内重复当前数据集 n 次,这里设置 5 是重复 5 次
|
74 |
+
times=2,
|
75 |
+
dataset=dict(
|
76 |
+
type=_base_.dataset_type,
|
77 |
+
data_root=data_root,
|
78 |
+
metainfo=metainfo,
|
79 |
+
ann_file='annotations/trainval.json',
|
80 |
+
data_prefix=dict(img='smaller-dataset/'),
|
81 |
+
filter_cfg=dict(filter_empty_gt=False, min_size=32),
|
82 |
+
pipeline=_base_.train_pipeline)))
|
83 |
+
|
84 |
+
val_dataloader = dict(
|
85 |
+
dataset=dict(
|
86 |
+
metainfo=metainfo,
|
87 |
+
data_root=data_root,
|
88 |
+
ann_file='annotations/trainval.json',
|
89 |
+
data_prefix=dict(img='smaller-dataset/')))
|
90 |
+
|
91 |
+
test_dataloader = val_dataloader
|
92 |
+
|
93 |
+
val_evaluator = dict(ann_file=data_root + 'annotations/trainval.json')
|
94 |
+
test_evaluator = val_evaluator
|
95 |
+
|
96 |
+
optim_wrapper = dict(optimizer=dict(lr=base_lr))
|
97 |
+
|
98 |
+
default_hooks = dict(
|
99 |
+
# 设置间隔多少个 epoch 保存模型,以及保存模型最多几个,`save_best` 是另外保存最佳模型(推荐)
|
100 |
+
checkpoint=dict(
|
101 |
+
type='CheckpointHook',
|
102 |
+
interval=save_epoch_intervals,
|
103 |
+
max_keep_ckpts=5,
|
104 |
+
save_best='auto'),
|
105 |
+
param_scheduler=dict(max_epochs=max_epochs),
|
106 |
+
# logger 输出的间隔
|
107 |
+
logger=dict(type='LoggerHook', interval=10))
|
108 |
+
|
109 |
+
custom_hooks = [
|
110 |
+
dict(
|
111 |
+
type="EMAHook",
|
112 |
+
ema_type="ExpMomentumEMA",
|
113 |
+
momentum=0.0001,
|
114 |
+
update_buffers=True,
|
115 |
+
strict_load=False,
|
116 |
+
priority=49),
|
117 |
+
dict(
|
118 |
+
type="mmdet.PipelineSwitchHook",
|
119 |
+
switch_epoch=max_epochs-max_epochs-_base_.num_last_epochs,
|
120 |
+
switch_pipeline=_base_.train_pipeline_stage2
|
121 |
+
)
|
122 |
+
]
|
123 |
+
|
124 |
+
visualizer = dict(vis_backends=[dict(type='LocalVisBackend'), dict(type='WandbVisBackend')])
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/custom_dataset/yolov7_l_syncbn_fast_6x16b-100e_coco.py
ADDED
@@ -0,0 +1,489 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = ['../_base_/default_runtime.py', '../_base_/det_p5_tta.py']
|
2 |
+
|
3 |
+
data_root = './data-df2/'
|
4 |
+
train_ann_file = 'annotations/train.json'
|
5 |
+
train_data_prefix = 'smaller-dataset/'
|
6 |
+
val_ann_file = 'annotations/val.json'
|
7 |
+
val_data_prefix = 'smaller-dataset/'
|
8 |
+
test_ann_file = 'annotations/test.json'
|
9 |
+
test_data_prefix = 'smaller-dataset/'
|
10 |
+
# num_classes = 13
|
11 |
+
train_batch_size_per_gpu = 32
|
12 |
+
train_num_workers = 4
|
13 |
+
persistent_workers = True
|
14 |
+
|
15 |
+
vis_backends = [
|
16 |
+
dict(type='LocalVisBackend'),
|
17 |
+
]
|
18 |
+
visualizer = dict(
|
19 |
+
type='mmdet.DetLocalVisualizer',
|
20 |
+
vis_backends=[
|
21 |
+
dict(type='LocalVisBackend'),
|
22 |
+
# dict(type='WandbVisBackend'),
|
23 |
+
dict(type='TensorboardVisBackend')
|
24 |
+
],
|
25 |
+
name='visualizer')
|
26 |
+
log_processor = dict(type='LogProcessor', window_size=50, by_epoch=True)
|
27 |
+
log_level = 'INFO'
|
28 |
+
load_from = None
|
29 |
+
resume = False
|
30 |
+
|
31 |
+
anchors = [
|
32 |
+
[(12, 16), (19, 36), (40, 28)], # P3/8
|
33 |
+
[(36, 75), (76, 55), (72, 146)], # P4/16
|
34 |
+
[(142, 110), (192, 243), (459, 401)] # P5/32
|
35 |
+
]
|
36 |
+
|
37 |
+
base_lr = 0.01
|
38 |
+
max_epochs = 100
|
39 |
+
|
40 |
+
num_epoch_stage2 = 10 # The last 10 epochs switch evaluation interval
|
41 |
+
val_interval_stage2 = 1
|
42 |
+
|
43 |
+
model_test_cfg = dict(
|
44 |
+
multi_label=True,
|
45 |
+
nms_pre=30000,
|
46 |
+
score_thr=0.001,
|
47 |
+
nms=dict(type='nms', iou_threshold=0.65),
|
48 |
+
max_per_img=300)
|
49 |
+
|
50 |
+
img_scale = (640, 640)
|
51 |
+
dataset_type = 'YOLOv5CocoDataset'
|
52 |
+
classes=('short_sleeved_shirt', 'long_sleeved_shirt',
|
53 |
+
'short_sleeved_outwear', 'long_sleeved_outwear',
|
54 |
+
'vest', 'sling', 'shorts', 'trousers', 'skirt',
|
55 |
+
'short_sleeved_dress', 'long_sleeved_dress',
|
56 |
+
'vest_dress', 'sling_dress')
|
57 |
+
num_classes = len(classes)
|
58 |
+
palette=[(255, 0, 0), (255, 128, 0), (255, 255, 0),
|
59 |
+
(128, 255, 0), (0, 255, 0), (0, 255, 128),
|
60 |
+
(0, 255, 255), (0, 128, 255), (0, 0, 255),
|
61 |
+
(127, 0, 255), (255, 0, 255), (255, 0, 127),
|
62 |
+
(128, 128, 128)]
|
63 |
+
metainfo = dict(
|
64 |
+
classes=classes,
|
65 |
+
palette=palette
|
66 |
+
)
|
67 |
+
val_batch_size_per_gpu = 1
|
68 |
+
val_num_workers = 2
|
69 |
+
batch_shapes_cfg = dict(
|
70 |
+
type='BatchShapePolicy',
|
71 |
+
batch_size=val_batch_size_per_gpu,
|
72 |
+
img_size=img_scale[0],
|
73 |
+
size_divisor=32,
|
74 |
+
extra_pad_ratio=0.5)
|
75 |
+
strides = [8, 16, 32] # Strides of multi-scale prior box
|
76 |
+
num_det_layers = 3
|
77 |
+
norm_cfg = dict(type='BN', momentum=0.03, eps=0.001)
|
78 |
+
|
79 |
+
# Data augmentation
|
80 |
+
max_translate_ratio = 0.2 # YOLOv5RandomAffine
|
81 |
+
scaling_ratio_range = (0.1, 2.0) # YOLOv5RandomAffine
|
82 |
+
mixup_prob = 0.15 # YOLOv5MixUp
|
83 |
+
randchoice_mosaic_prob = [0.8, 0.2]
|
84 |
+
mixup_alpha = 8.0 # YOLOv5MixUp
|
85 |
+
mixup_beta = 8.0 # YOLOv5MixUp
|
86 |
+
|
87 |
+
# -----train val related-----
|
88 |
+
loss_cls_weight = 0.3
|
89 |
+
loss_bbox_weight = 0.05
|
90 |
+
loss_obj_weight = 0.7
|
91 |
+
# BatchYOLOv7Assigner params
|
92 |
+
simota_candidate_topk = 10
|
93 |
+
simota_iou_weight = 3.0
|
94 |
+
simota_cls_weight = 1.0
|
95 |
+
prior_match_thr = 4. # Priori box matching threshold
|
96 |
+
obj_level_weights = [4., 1.,
|
97 |
+
0.4] # The obj loss weights of the three output layers
|
98 |
+
|
99 |
+
lr_factor = 0.1 # Learning rate scaling factor
|
100 |
+
weight_decay = 0.0005
|
101 |
+
save_epoch_intervals = 1
|
102 |
+
max_keep_ckpts = 5
|
103 |
+
|
104 |
+
env_cfg = dict(
|
105 |
+
cudnn_benchmark=True,
|
106 |
+
mp_cfg=dict(mp_start_method='fork', opencv_num_threads=0),
|
107 |
+
dist_cfg=dict(backend='nccl'))
|
108 |
+
|
109 |
+
# ===============================Unmodified in most cases====================
|
110 |
+
model = dict(
|
111 |
+
type='YOLODetector',
|
112 |
+
data_preprocessor=dict(
|
113 |
+
type='YOLOv5DetDataPreprocessor',
|
114 |
+
mean=[0., 0., 0.],
|
115 |
+
std=[255., 255., 255.],
|
116 |
+
bgr_to_rgb=True),
|
117 |
+
backbone=dict(
|
118 |
+
type='YOLOv7Backbone',
|
119 |
+
arch='L',
|
120 |
+
norm_cfg=norm_cfg,
|
121 |
+
act_cfg=dict(type='SiLU', inplace=True)),
|
122 |
+
neck=dict(
|
123 |
+
type='YOLOv7PAFPN',
|
124 |
+
block_cfg=dict(
|
125 |
+
type='ELANBlock',
|
126 |
+
middle_ratio=0.5,
|
127 |
+
block_ratio=0.25,
|
128 |
+
num_blocks=4,
|
129 |
+
num_convs_in_block=1),
|
130 |
+
upsample_feats_cat_first=False,
|
131 |
+
in_channels=[512, 1024, 1024],
|
132 |
+
# The real output channel will be multiplied by 2
|
133 |
+
out_channels=[128, 256, 512],
|
134 |
+
norm_cfg=norm_cfg,
|
135 |
+
act_cfg=dict(type='SiLU', inplace=True)),
|
136 |
+
bbox_head=dict(
|
137 |
+
type='YOLOv7Head',
|
138 |
+
head_module=dict(
|
139 |
+
type='YOLOv7HeadModule',
|
140 |
+
num_classes=num_classes,
|
141 |
+
in_channels=[256, 512, 1024],
|
142 |
+
featmap_strides=strides,
|
143 |
+
num_base_priors=3),
|
144 |
+
prior_generator=dict(
|
145 |
+
type='mmdet.YOLOAnchorGenerator',
|
146 |
+
base_sizes=anchors,
|
147 |
+
strides=strides),
|
148 |
+
# scaled based on number of detection layers
|
149 |
+
loss_cls=dict(
|
150 |
+
type='mmdet.CrossEntropyLoss',
|
151 |
+
use_sigmoid=True,
|
152 |
+
reduction='mean',
|
153 |
+
loss_weight=loss_cls_weight *
|
154 |
+
(num_classes / 80 * 3 / num_det_layers)),
|
155 |
+
loss_bbox=dict(
|
156 |
+
type='IoULoss',
|
157 |
+
iou_mode='ciou',
|
158 |
+
bbox_format='xyxy',
|
159 |
+
reduction='mean',
|
160 |
+
loss_weight=loss_bbox_weight * (3 / num_det_layers),
|
161 |
+
return_iou=True),
|
162 |
+
loss_obj=dict(
|
163 |
+
type='mmdet.CrossEntropyLoss',
|
164 |
+
use_sigmoid=True,
|
165 |
+
reduction='mean',
|
166 |
+
loss_weight=loss_obj_weight *
|
167 |
+
((img_scale[0] / 640)**2 * 3 / num_det_layers)),
|
168 |
+
prior_match_thr=prior_match_thr,
|
169 |
+
obj_level_weights=obj_level_weights,
|
170 |
+
# BatchYOLOv7Assigner params
|
171 |
+
simota_candidate_topk=simota_candidate_topk,
|
172 |
+
simota_iou_weight=simota_iou_weight,
|
173 |
+
simota_cls_weight=simota_cls_weight),
|
174 |
+
test_cfg=model_test_cfg)
|
175 |
+
|
176 |
+
pre_transform = [
|
177 |
+
dict(type='LoadImageFromFile', file_client_args=_base_.file_client_args),
|
178 |
+
dict(type='LoadAnnotations', with_bbox=True)
|
179 |
+
]
|
180 |
+
|
181 |
+
mosiac4_pipeline = [
|
182 |
+
dict(
|
183 |
+
type='Mosaic',
|
184 |
+
img_scale=img_scale,
|
185 |
+
pad_val=114.0,
|
186 |
+
pre_transform=pre_transform),
|
187 |
+
dict(
|
188 |
+
type='YOLOv5RandomAffine',
|
189 |
+
max_rotate_degree=0.0,
|
190 |
+
max_shear_degree=0.0,
|
191 |
+
max_translate_ratio=max_translate_ratio, # note
|
192 |
+
scaling_ratio_range=scaling_ratio_range, # note
|
193 |
+
# img_scale is (width, height)
|
194 |
+
border=(-img_scale[0] // 2, -img_scale[1] // 2),
|
195 |
+
border_val=(114, 114, 114)),
|
196 |
+
]
|
197 |
+
|
198 |
+
mosiac9_pipeline = [
|
199 |
+
dict(
|
200 |
+
type='Mosaic9',
|
201 |
+
img_scale=img_scale,
|
202 |
+
pad_val=114.0,
|
203 |
+
pre_transform=pre_transform),
|
204 |
+
dict(
|
205 |
+
type='YOLOv5RandomAffine',
|
206 |
+
max_rotate_degree=0.0,
|
207 |
+
max_shear_degree=0.0,
|
208 |
+
max_translate_ratio=max_translate_ratio, # note
|
209 |
+
scaling_ratio_range=scaling_ratio_range, # note
|
210 |
+
# img_scale is (width, height)
|
211 |
+
border=(-img_scale[0] // 2, -img_scale[1] // 2),
|
212 |
+
border_val=(114, 114, 114)),
|
213 |
+
]
|
214 |
+
|
215 |
+
randchoice_mosaic_pipeline = dict(
|
216 |
+
type='RandomChoice',
|
217 |
+
transforms=[mosiac4_pipeline, mosiac9_pipeline],
|
218 |
+
prob=randchoice_mosaic_prob)
|
219 |
+
|
220 |
+
train_pipeline = [
|
221 |
+
*pre_transform,
|
222 |
+
randchoice_mosaic_pipeline,
|
223 |
+
dict(
|
224 |
+
type='YOLOv5MixUp',
|
225 |
+
alpha=mixup_alpha, # note
|
226 |
+
beta=mixup_beta, # note
|
227 |
+
prob=mixup_prob,
|
228 |
+
pre_transform=[*pre_transform, randchoice_mosaic_pipeline]),
|
229 |
+
dict(type='YOLOv5HSVRandomAug'),
|
230 |
+
dict(type='mmdet.RandomFlip', prob=0.5),
|
231 |
+
dict(
|
232 |
+
type='mmdet.PackDetInputs',
|
233 |
+
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'flip',
|
234 |
+
'flip_direction'))
|
235 |
+
]
|
236 |
+
|
237 |
+
test_pipeline = [
|
238 |
+
dict(type='LoadImageFromFile', file_client_args=_base_.file_client_args),
|
239 |
+
dict(type='YOLOv5KeepRatioResize', scale=img_scale),
|
240 |
+
dict(
|
241 |
+
type='LetterResize',
|
242 |
+
scale=img_scale,
|
243 |
+
allow_scale_up=False,
|
244 |
+
pad_val=dict(img=114)),
|
245 |
+
dict(type='LoadAnnotations', with_bbox=True, _scope_='mmdet'),
|
246 |
+
dict(
|
247 |
+
type='mmdet.PackDetInputs',
|
248 |
+
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
|
249 |
+
'scale_factor', 'pad_param'))
|
250 |
+
]
|
251 |
+
|
252 |
+
train_dataloader = dict(
|
253 |
+
batch_size=train_batch_size_per_gpu,
|
254 |
+
num_workers=train_num_workers,
|
255 |
+
persistent_workers=persistent_workers,
|
256 |
+
pin_memory=True,
|
257 |
+
sampler=dict(type='DefaultSampler', shuffle=True),
|
258 |
+
collate_fn=dict(type='yolov5_collate'), # FASTER
|
259 |
+
dataset=dict(
|
260 |
+
type='RepeatDataset',
|
261 |
+
times=2,
|
262 |
+
dataset=dict(
|
263 |
+
type=dataset_type,
|
264 |
+
data_root=data_root,
|
265 |
+
metainfo=metainfo,
|
266 |
+
ann_file=val_ann_file,
|
267 |
+
data_prefix=dict(img=train_data_prefix),
|
268 |
+
filter_cfg=dict(filter_empty_gt=False, min_size=32),
|
269 |
+
pipeline=train_pipeline)
|
270 |
+
)
|
271 |
+
)
|
272 |
+
|
273 |
+
val_dataloader = dict(
|
274 |
+
dataset=dict(
|
275 |
+
metainfo=metainfo,
|
276 |
+
data_root=data_root,
|
277 |
+
ann_file=val_ann_file,
|
278 |
+
data_prefix=dict(img=val_data_prefix)))
|
279 |
+
|
280 |
+
val_evaluator = dict(ann_file=data_root + val_ann_file)
|
281 |
+
|
282 |
+
test_dataloader = dict(
|
283 |
+
dataset=dict(
|
284 |
+
metainfo=metainfo,
|
285 |
+
data_root=data_root,
|
286 |
+
ann_file=test_ann_file,
|
287 |
+
data_prefix=dict(img=test_data_prefix)))
|
288 |
+
test_evaluator = dict(ann_file=data_root + test_ann_file)
|
289 |
+
|
290 |
+
train_cfg = dict(
|
291 |
+
type='EpochBasedTrainLoop',
|
292 |
+
max_epochs=max_epochs,
|
293 |
+
val_interval=save_epoch_intervals,
|
294 |
+
dynamic_intervals=[(max_epochs - num_epoch_stage2, val_interval_stage2)])
|
295 |
+
val_cfg = dict(type='ValLoop')
|
296 |
+
test_cfg = dict(type='TestLoop')
|
297 |
+
|
298 |
+
param_scheduler = None
|
299 |
+
optim_wrapper = dict(
|
300 |
+
type='OptimWrapper',
|
301 |
+
optimizer=dict(
|
302 |
+
type='SGD',
|
303 |
+
lr=base_lr,
|
304 |
+
momentum=0.937,
|
305 |
+
weight_decay=weight_decay,
|
306 |
+
nesterov=True,
|
307 |
+
batch_size_per_gpu=train_batch_size_per_gpu),
|
308 |
+
constructor='YOLOv7OptimWrapperConstructor')
|
309 |
+
|
310 |
+
# TO DO: change param_scheduler type to StepLR, refer to mobilenet
|
311 |
+
default_scope = 'mmyolo'
|
312 |
+
default_hooks = dict(
|
313 |
+
timer=dict(type='IterTimerHook'),
|
314 |
+
logger=dict(type='LoggerHook', interval=10),
|
315 |
+
param_scheduler=dict(
|
316 |
+
type='YOLOv5ParamSchedulerHook',
|
317 |
+
scheduler_type='cosine',
|
318 |
+
lr_factor=lr_factor, # note
|
319 |
+
max_epochs=max_epochs),
|
320 |
+
checkpoint=dict(
|
321 |
+
type='CheckpointHook',
|
322 |
+
save_param_scheduler=False,
|
323 |
+
interval=save_epoch_intervals,
|
324 |
+
save_best='auto',
|
325 |
+
max_keep_ckpts=max_keep_ckpts),
|
326 |
+
sampler_seed=dict(type='DistSamplerSeedHook'),
|
327 |
+
visualization=dict(type='mmdet.DetVisualizationHook'))
|
328 |
+
|
329 |
+
custom_hooks = [
|
330 |
+
dict(
|
331 |
+
type='EMAHook',
|
332 |
+
ema_type='ExpMomentumEMA',
|
333 |
+
momentum=0.001,
|
334 |
+
update_buffers=True,
|
335 |
+
strict_load=False,
|
336 |
+
priority=49)
|
337 |
+
]
|
338 |
+
|
339 |
+
# ============================
|
340 |
+
|
341 |
+
file_client_args = dict(backend='disk')
|
342 |
+
_file_client_args = dict(backend='disk')
|
343 |
+
tta_model = dict(
|
344 |
+
type='mmdet.DetTTAModel',
|
345 |
+
tta_cfg=dict(nms=dict(type='nms', iou_threshold=0.65), max_per_img=300))
|
346 |
+
img_scales = [
|
347 |
+
(
|
348 |
+
640,
|
349 |
+
640,
|
350 |
+
),
|
351 |
+
(
|
352 |
+
320,
|
353 |
+
320,
|
354 |
+
),
|
355 |
+
(
|
356 |
+
960,
|
357 |
+
960,
|
358 |
+
),
|
359 |
+
]
|
360 |
+
_multiscale_resize_transforms = [
|
361 |
+
dict(
|
362 |
+
type='Compose',
|
363 |
+
transforms=[
|
364 |
+
dict(type='YOLOv5KeepRatioResize', scale=(
|
365 |
+
640,
|
366 |
+
640,
|
367 |
+
)),
|
368 |
+
dict(
|
369 |
+
type='LetterResize',
|
370 |
+
scale=(
|
371 |
+
640,
|
372 |
+
640,
|
373 |
+
),
|
374 |
+
allow_scale_up=False,
|
375 |
+
pad_val=dict(img=114)),
|
376 |
+
]),
|
377 |
+
dict(
|
378 |
+
type='Compose',
|
379 |
+
transforms=[
|
380 |
+
dict(type='YOLOv5KeepRatioResize', scale=(
|
381 |
+
320,
|
382 |
+
320,
|
383 |
+
)),
|
384 |
+
dict(
|
385 |
+
type='LetterResize',
|
386 |
+
scale=(
|
387 |
+
320,
|
388 |
+
320,
|
389 |
+
),
|
390 |
+
allow_scale_up=False,
|
391 |
+
pad_val=dict(img=114)),
|
392 |
+
]),
|
393 |
+
dict(
|
394 |
+
type='Compose',
|
395 |
+
transforms=[
|
396 |
+
dict(type='YOLOv5KeepRatioResize', scale=(
|
397 |
+
960,
|
398 |
+
960,
|
399 |
+
)),
|
400 |
+
dict(
|
401 |
+
type='LetterResize',
|
402 |
+
scale=(
|
403 |
+
960,
|
404 |
+
960,
|
405 |
+
),
|
406 |
+
allow_scale_up=False,
|
407 |
+
pad_val=dict(img=114)),
|
408 |
+
]),
|
409 |
+
]
|
410 |
+
tta_pipeline = [
|
411 |
+
dict(type='LoadImageFromFile', file_client_args=dict(backend='disk')),
|
412 |
+
dict(
|
413 |
+
type='TestTimeAug',
|
414 |
+
transforms=[
|
415 |
+
[
|
416 |
+
dict(
|
417 |
+
type='Compose',
|
418 |
+
transforms=[
|
419 |
+
dict(type='YOLOv5KeepRatioResize', scale=(
|
420 |
+
640,
|
421 |
+
640,
|
422 |
+
)),
|
423 |
+
dict(
|
424 |
+
type='LetterResize',
|
425 |
+
scale=(
|
426 |
+
640,
|
427 |
+
640,
|
428 |
+
),
|
429 |
+
allow_scale_up=False,
|
430 |
+
pad_val=dict(img=114)),
|
431 |
+
]),
|
432 |
+
dict(
|
433 |
+
type='Compose',
|
434 |
+
transforms=[
|
435 |
+
dict(type='YOLOv5KeepRatioResize', scale=(
|
436 |
+
320,
|
437 |
+
320,
|
438 |
+
)),
|
439 |
+
dict(
|
440 |
+
type='LetterResize',
|
441 |
+
scale=(
|
442 |
+
320,
|
443 |
+
320,
|
444 |
+
),
|
445 |
+
allow_scale_up=False,
|
446 |
+
pad_val=dict(img=114)),
|
447 |
+
]),
|
448 |
+
dict(
|
449 |
+
type='Compose',
|
450 |
+
transforms=[
|
451 |
+
dict(type='YOLOv5KeepRatioResize', scale=(
|
452 |
+
960,
|
453 |
+
960,
|
454 |
+
)),
|
455 |
+
dict(
|
456 |
+
type='LetterResize',
|
457 |
+
scale=(
|
458 |
+
960,
|
459 |
+
960,
|
460 |
+
),
|
461 |
+
allow_scale_up=False,
|
462 |
+
pad_val=dict(img=114)),
|
463 |
+
]),
|
464 |
+
],
|
465 |
+
[
|
466 |
+
dict(type='mmdet.RandomFlip', prob=1.0),
|
467 |
+
dict(type='mmdet.RandomFlip', prob=0.0),
|
468 |
+
],
|
469 |
+
[
|
470 |
+
dict(type='mmdet.LoadAnnotations', with_bbox=True),
|
471 |
+
],
|
472 |
+
[
|
473 |
+
dict(
|
474 |
+
type='mmdet.PackDetInputs',
|
475 |
+
meta_keys=(
|
476 |
+
'img_id',
|
477 |
+
'img_path',
|
478 |
+
'ori_shape',
|
479 |
+
'img_shape',
|
480 |
+
'scale_factor',
|
481 |
+
'pad_param',
|
482 |
+
'flip',
|
483 |
+
'flip_direction',
|
484 |
+
)),
|
485 |
+
],
|
486 |
+
]),
|
487 |
+
]
|
488 |
+
|
489 |
+
launcher = 'none'
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/custom_dataset/yolov7_l_syncbn_fast_6x32b-100e_coco.py
ADDED
@@ -0,0 +1,554 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = ['../_base_/default_runtime.py', '../_base_/det_p5_tta.py']
|
2 |
+
|
3 |
+
data_root = './data-df2/'
|
4 |
+
train_ann_file = 'annotations/train.json'
|
5 |
+
train_data_prefix = 'smaller-dataset/'
|
6 |
+
val_ann_file = 'annotations/val.json'
|
7 |
+
val_data_prefix = 'smaller-dataset/'
|
8 |
+
test_ann_file = 'annotations/test.json'
|
9 |
+
test_data_prefix = 'smaller-dataset/'
|
10 |
+
num_classes = 13
|
11 |
+
train_batch_size_per_gpu = 32
|
12 |
+
train_num_workers = 24
|
13 |
+
persistent_workers = True
|
14 |
+
|
15 |
+
vis_backends = [
|
16 |
+
dict(type='LocalVisBackend'),
|
17 |
+
]
|
18 |
+
visualizer = dict(
|
19 |
+
type='mmdet.DetLocalVisualizer',
|
20 |
+
vis_backends=[
|
21 |
+
dict(type='LocalVisBackend'),
|
22 |
+
dict(type='WandbVisBackend'),
|
23 |
+
# dict(type='TensorboardVisBackend')
|
24 |
+
],
|
25 |
+
name='visualizer')
|
26 |
+
log_processor = dict(type='LogProcessor', window_size=50, by_epoch=True)
|
27 |
+
log_level = 'INFO'
|
28 |
+
load_from = None
|
29 |
+
resume = False
|
30 |
+
|
31 |
+
anchors = [
|
32 |
+
[(12, 16), (19, 36), (40, 28)], # P3/8
|
33 |
+
[(36, 75), (76, 55), (72, 146)], # P4/16
|
34 |
+
[(142, 110), (192, 243), (459, 401)] # P5/32
|
35 |
+
]
|
36 |
+
|
37 |
+
base_lr = 0.01
|
38 |
+
max_epochs = 100
|
39 |
+
|
40 |
+
num_epoch_stage2 = 10 # The last 10 epochs switch evaluation interval
|
41 |
+
val_interval_stage2 = 1
|
42 |
+
|
43 |
+
model_test_cfg = dict(
|
44 |
+
multi_label=True,
|
45 |
+
nms_pre=30000,
|
46 |
+
score_thr=0.001,
|
47 |
+
nms=dict(type='nms', iou_threshold=0.65),
|
48 |
+
max_per_img=300)
|
49 |
+
|
50 |
+
img_scale = (640, 640)
|
51 |
+
dataset_type = 'YOLOv5CocoDataset'
|
52 |
+
metainfo = dict(
|
53 |
+
classes=(
|
54 |
+
'short_sleeved_shirt', 'long_sleeved_shirt',
|
55 |
+
'short_sleeved_outwear', 'long_sleeved_outwear',
|
56 |
+
'vest', 'sling', 'shorts', 'trousers', 'skirt',
|
57 |
+
'short_sleeved_dress', 'long_sleeved_dress',
|
58 |
+
'vest_dress', 'sling_dress'),
|
59 |
+
palette=[
|
60 |
+
(255, 0, 0),
|
61 |
+
(
|
62 |
+
255,
|
63 |
+
128,
|
64 |
+
0,
|
65 |
+
),
|
66 |
+
(
|
67 |
+
255,
|
68 |
+
255,
|
69 |
+
0,
|
70 |
+
),
|
71 |
+
(
|
72 |
+
128,
|
73 |
+
255,
|
74 |
+
0,
|
75 |
+
),
|
76 |
+
(
|
77 |
+
0,
|
78 |
+
255,
|
79 |
+
0,
|
80 |
+
),
|
81 |
+
(
|
82 |
+
0,
|
83 |
+
255,
|
84 |
+
128,
|
85 |
+
),
|
86 |
+
(
|
87 |
+
0,
|
88 |
+
255,
|
89 |
+
255,
|
90 |
+
),
|
91 |
+
(
|
92 |
+
0,
|
93 |
+
128,
|
94 |
+
255,
|
95 |
+
),
|
96 |
+
(
|
97 |
+
0,
|
98 |
+
0,
|
99 |
+
255,
|
100 |
+
),
|
101 |
+
(
|
102 |
+
127,
|
103 |
+
0,
|
104 |
+
255,
|
105 |
+
),
|
106 |
+
(
|
107 |
+
255,
|
108 |
+
0,
|
109 |
+
255,
|
110 |
+
),
|
111 |
+
(
|
112 |
+
255,
|
113 |
+
0,
|
114 |
+
127,
|
115 |
+
),
|
116 |
+
(
|
117 |
+
128,
|
118 |
+
128,
|
119 |
+
128,
|
120 |
+
),
|
121 |
+
])
|
122 |
+
|
123 |
+
val_batch_size_per_gpu = 1
|
124 |
+
val_num_workers = 2
|
125 |
+
batch_shapes_cfg = dict(
|
126 |
+
type='BatchShapePolicy',
|
127 |
+
batch_size=val_batch_size_per_gpu,
|
128 |
+
img_size=img_scale[0],
|
129 |
+
size_divisor=32,
|
130 |
+
extra_pad_ratio=0.5)
|
131 |
+
strides = [8, 16, 32] # Strides of multi-scale prior box
|
132 |
+
num_det_layers = 3
|
133 |
+
norm_cfg = dict(type='BN', momentum=0.03, eps=0.001)
|
134 |
+
|
135 |
+
# Data augmentation
|
136 |
+
max_translate_ratio = 0.2 # YOLOv5RandomAffine
|
137 |
+
scaling_ratio_range = (0.1, 2.0) # YOLOv5RandomAffine
|
138 |
+
mixup_prob = 0.15 # YOLOv5MixUp
|
139 |
+
randchoice_mosaic_prob = [0.8, 0.2]
|
140 |
+
mixup_alpha = 8.0 # YOLOv5MixUp
|
141 |
+
mixup_beta = 8.0 # YOLOv5MixUp
|
142 |
+
|
143 |
+
# -----train val related-----
|
144 |
+
loss_cls_weight = 0.3
|
145 |
+
loss_bbox_weight = 0.05
|
146 |
+
loss_obj_weight = 0.7
|
147 |
+
# BatchYOLOv7Assigner params
|
148 |
+
simota_candidate_topk = 10
|
149 |
+
simota_iou_weight = 3.0
|
150 |
+
simota_cls_weight = 1.0
|
151 |
+
prior_match_thr = 4. # Priori box matching threshold
|
152 |
+
obj_level_weights = [4., 1.,
|
153 |
+
0.4] # The obj loss weights of the three output layers
|
154 |
+
|
155 |
+
lr_factor = 0.1 # Learning rate scaling factor
|
156 |
+
weight_decay = 0.0005
|
157 |
+
save_epoch_intervals = 1
|
158 |
+
max_keep_ckpts = 5
|
159 |
+
|
160 |
+
env_cfg = dict(
|
161 |
+
cudnn_benchmark=True,
|
162 |
+
mp_cfg=dict(mp_start_method='fork', opencv_num_threads=0),
|
163 |
+
dist_cfg=dict(backend='nccl'))
|
164 |
+
|
165 |
+
# ===============================Unmodified in most cases====================
|
166 |
+
model = dict(
|
167 |
+
type='YOLODetector',
|
168 |
+
data_preprocessor=dict(
|
169 |
+
type='YOLOv5DetDataPreprocessor',
|
170 |
+
mean=[0., 0., 0.],
|
171 |
+
std=[255., 255., 255.],
|
172 |
+
bgr_to_rgb=True),
|
173 |
+
backbone=dict(
|
174 |
+
type='YOLOv7Backbone',
|
175 |
+
arch='L',
|
176 |
+
norm_cfg=norm_cfg,
|
177 |
+
act_cfg=dict(type='SiLU', inplace=True)),
|
178 |
+
neck=dict(
|
179 |
+
type='YOLOv7PAFPN',
|
180 |
+
block_cfg=dict(
|
181 |
+
type='ELANBlock',
|
182 |
+
middle_ratio=0.5,
|
183 |
+
block_ratio=0.25,
|
184 |
+
num_blocks=4,
|
185 |
+
num_convs_in_block=1),
|
186 |
+
upsample_feats_cat_first=False,
|
187 |
+
in_channels=[512, 1024, 1024],
|
188 |
+
# The real output channel will be multiplied by 2
|
189 |
+
out_channels=[128, 256, 512],
|
190 |
+
norm_cfg=norm_cfg,
|
191 |
+
act_cfg=dict(type='SiLU', inplace=True)),
|
192 |
+
bbox_head=dict(
|
193 |
+
type='YOLOv7Head',
|
194 |
+
head_module=dict(
|
195 |
+
type='YOLOv7HeadModule',
|
196 |
+
num_classes=num_classes,
|
197 |
+
in_channels=[256, 512, 1024],
|
198 |
+
featmap_strides=strides,
|
199 |
+
num_base_priors=3),
|
200 |
+
prior_generator=dict(
|
201 |
+
type='mmdet.YOLOAnchorGenerator',
|
202 |
+
base_sizes=anchors,
|
203 |
+
strides=strides),
|
204 |
+
# scaled based on number of detection layers
|
205 |
+
loss_cls=dict(
|
206 |
+
type='mmdet.CrossEntropyLoss',
|
207 |
+
use_sigmoid=True,
|
208 |
+
reduction='mean',
|
209 |
+
loss_weight=loss_cls_weight *
|
210 |
+
(num_classes / 80 * 3 / num_det_layers)),
|
211 |
+
loss_bbox=dict(
|
212 |
+
type='IoULoss',
|
213 |
+
iou_mode='ciou',
|
214 |
+
bbox_format='xyxy',
|
215 |
+
reduction='mean',
|
216 |
+
loss_weight=loss_bbox_weight * (3 / num_det_layers),
|
217 |
+
return_iou=True),
|
218 |
+
loss_obj=dict(
|
219 |
+
type='mmdet.CrossEntropyLoss',
|
220 |
+
use_sigmoid=True,
|
221 |
+
reduction='mean',
|
222 |
+
loss_weight=loss_obj_weight *
|
223 |
+
((img_scale[0] / 640)**2 * 3 / num_det_layers)),
|
224 |
+
prior_match_thr=prior_match_thr,
|
225 |
+
obj_level_weights=obj_level_weights,
|
226 |
+
# BatchYOLOv7Assigner params
|
227 |
+
simota_candidate_topk=simota_candidate_topk,
|
228 |
+
simota_iou_weight=simota_iou_weight,
|
229 |
+
simota_cls_weight=simota_cls_weight),
|
230 |
+
test_cfg=model_test_cfg)
|
231 |
+
|
232 |
+
pre_transform = [
|
233 |
+
dict(type='LoadImageFromFile', file_client_args=_base_.file_client_args),
|
234 |
+
dict(type='LoadAnnotations', with_bbox=True)
|
235 |
+
]
|
236 |
+
|
237 |
+
mosiac4_pipeline = [
|
238 |
+
dict(
|
239 |
+
type='Mosaic',
|
240 |
+
img_scale=img_scale,
|
241 |
+
pad_val=114.0,
|
242 |
+
pre_transform=pre_transform),
|
243 |
+
dict(
|
244 |
+
type='YOLOv5RandomAffine',
|
245 |
+
max_rotate_degree=0.0,
|
246 |
+
max_shear_degree=0.0,
|
247 |
+
max_translate_ratio=max_translate_ratio, # note
|
248 |
+
scaling_ratio_range=scaling_ratio_range, # note
|
249 |
+
# img_scale is (width, height)
|
250 |
+
border=(-img_scale[0] // 2, -img_scale[1] // 2),
|
251 |
+
border_val=(114, 114, 114)),
|
252 |
+
]
|
253 |
+
|
254 |
+
mosiac9_pipeline = [
|
255 |
+
dict(
|
256 |
+
type='Mosaic9',
|
257 |
+
img_scale=img_scale,
|
258 |
+
pad_val=114.0,
|
259 |
+
pre_transform=pre_transform),
|
260 |
+
dict(
|
261 |
+
type='YOLOv5RandomAffine',
|
262 |
+
max_rotate_degree=0.0,
|
263 |
+
max_shear_degree=0.0,
|
264 |
+
max_translate_ratio=max_translate_ratio, # note
|
265 |
+
scaling_ratio_range=scaling_ratio_range, # note
|
266 |
+
# img_scale is (width, height)
|
267 |
+
border=(-img_scale[0] // 2, -img_scale[1] // 2),
|
268 |
+
border_val=(114, 114, 114)),
|
269 |
+
]
|
270 |
+
|
271 |
+
randchoice_mosaic_pipeline = dict(
|
272 |
+
type='RandomChoice',
|
273 |
+
transforms=[mosiac4_pipeline, mosiac9_pipeline],
|
274 |
+
prob=randchoice_mosaic_prob)
|
275 |
+
|
276 |
+
train_pipeline = [
|
277 |
+
*pre_transform,
|
278 |
+
randchoice_mosaic_pipeline,
|
279 |
+
dict(
|
280 |
+
type='YOLOv5MixUp',
|
281 |
+
alpha=mixup_alpha, # note
|
282 |
+
beta=mixup_beta, # note
|
283 |
+
prob=mixup_prob,
|
284 |
+
pre_transform=[*pre_transform, randchoice_mosaic_pipeline]),
|
285 |
+
dict(type='YOLOv5HSVRandomAug'),
|
286 |
+
dict(type='mmdet.RandomFlip', prob=0.5),
|
287 |
+
dict(
|
288 |
+
type='mmdet.PackDetInputs',
|
289 |
+
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'flip',
|
290 |
+
'flip_direction'))
|
291 |
+
]
|
292 |
+
|
293 |
+
test_pipeline = [
|
294 |
+
dict(type='LoadImageFromFile', file_client_args=_base_.file_client_args),
|
295 |
+
dict(type='YOLOv5KeepRatioResize', scale=img_scale),
|
296 |
+
dict(
|
297 |
+
type='LetterResize',
|
298 |
+
scale=img_scale,
|
299 |
+
allow_scale_up=False,
|
300 |
+
pad_val=dict(img=114)),
|
301 |
+
dict(type='LoadAnnotations', with_bbox=True, _scope_='mmdet'),
|
302 |
+
dict(
|
303 |
+
type='mmdet.PackDetInputs',
|
304 |
+
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
|
305 |
+
'scale_factor', 'pad_param'))
|
306 |
+
]
|
307 |
+
|
308 |
+
train_dataloader = dict(
|
309 |
+
batch_size=train_batch_size_per_gpu,
|
310 |
+
num_workers=train_num_workers,
|
311 |
+
persistent_workers=persistent_workers,
|
312 |
+
pin_memory=True,
|
313 |
+
sampler=dict(type='DefaultSampler', shuffle=True),
|
314 |
+
collate_fn=dict(type='yolov5_collate'), # FASTER
|
315 |
+
dataset=dict(
|
316 |
+
type='RepeatDataset',
|
317 |
+
times=2,
|
318 |
+
dataset=dict(
|
319 |
+
type=dataset_type,
|
320 |
+
metainfo=metainfo,
|
321 |
+
data_root=data_root,
|
322 |
+
ann_file=val_ann_file,
|
323 |
+
data_prefix=dict(img=train_data_prefix),
|
324 |
+
filter_cfg=dict(filter_empty_gt=False, min_size=32),
|
325 |
+
pipeline=train_pipeline
|
326 |
+
)
|
327 |
+
)
|
328 |
+
)
|
329 |
+
val_dataloader = dict(
|
330 |
+
dataset=dict(
|
331 |
+
type=dataset_type,
|
332 |
+
metainfo=metainfo,
|
333 |
+
data_root=data_root,
|
334 |
+
ann_file=val_ann_file,
|
335 |
+
data_prefix=dict(img=val_data_prefix)))
|
336 |
+
|
337 |
+
val_evaluator = dict(
|
338 |
+
type='mmdet.CocoMetric',
|
339 |
+
proposal_nums=(100, 1, 10),
|
340 |
+
ann_file=data_root + val_ann_file,
|
341 |
+
metric='bbox')
|
342 |
+
|
343 |
+
test_dataloader = dict(
|
344 |
+
dataset=dict(
|
345 |
+
metainfo=metainfo,
|
346 |
+
data_root=data_root,
|
347 |
+
ann_file=test_ann_file,
|
348 |
+
data_prefix=dict(img=test_data_prefix)))
|
349 |
+
test_evaluator = dict(
|
350 |
+
type='mmdet.CocoMetric',
|
351 |
+
proposal_nums=(100, 1, 10),
|
352 |
+
ann_file=data_root + test_ann_file,
|
353 |
+
metric='bbox')
|
354 |
+
|
355 |
+
train_cfg = dict(
|
356 |
+
type='EpochBasedTrainLoop',
|
357 |
+
max_epochs=max_epochs,
|
358 |
+
val_interval=save_epoch_intervals,
|
359 |
+
dynamic_intervals=[(max_epochs - num_epoch_stage2, val_interval_stage2)])
|
360 |
+
val_cfg = dict(type='ValLoop')
|
361 |
+
test_cfg = dict(type='TestLoop')
|
362 |
+
|
363 |
+
param_scheduler = None
|
364 |
+
optim_wrapper = dict(
|
365 |
+
type='OptimWrapper',
|
366 |
+
optimizer=dict(
|
367 |
+
type='SGD',
|
368 |
+
lr=base_lr,
|
369 |
+
momentum=0.937,
|
370 |
+
weight_decay=weight_decay,
|
371 |
+
nesterov=True,
|
372 |
+
batch_size_per_gpu=train_batch_size_per_gpu),
|
373 |
+
constructor='YOLOv7OptimWrapperConstructor')
|
374 |
+
|
375 |
+
# TO DO: change param_scheduler type to StepLR, refer to mobilenet
|
376 |
+
default_scope = 'mmyolo'
|
377 |
+
default_hooks = dict(
|
378 |
+
timer=dict(type='IterTimerHook'),
|
379 |
+
logger=dict(type='LoggerHook', interval=10),
|
380 |
+
param_scheduler=dict(
|
381 |
+
type='YOLOv5ParamSchedulerHook',
|
382 |
+
scheduler_type='cosine',
|
383 |
+
lr_factor=lr_factor, # note
|
384 |
+
max_epochs=max_epochs),
|
385 |
+
checkpoint=dict(
|
386 |
+
type='CheckpointHook',
|
387 |
+
save_param_scheduler=False,
|
388 |
+
interval=save_epoch_intervals,
|
389 |
+
save_best='auto',
|
390 |
+
max_keep_ckpts=max_keep_ckpts),
|
391 |
+
sampler_seed=dict(type='DistSamplerSeedHook'),
|
392 |
+
visualization=dict(type='mmdet.DetVisualizationHook'))
|
393 |
+
|
394 |
+
custom_hooks = [
|
395 |
+
dict(
|
396 |
+
type='EMAHook',
|
397 |
+
ema_type='ExpMomentumEMA',
|
398 |
+
momentum=0.001,
|
399 |
+
update_buffers=True,
|
400 |
+
strict_load=False,
|
401 |
+
priority=49)
|
402 |
+
]
|
403 |
+
|
404 |
+
# ============================
|
405 |
+
|
406 |
+
file_client_args = dict(backend='disk')
|
407 |
+
_file_client_args = dict(backend='disk')
|
408 |
+
tta_model = dict(
|
409 |
+
type='mmdet.DetTTAModel',
|
410 |
+
tta_cfg=dict(nms=dict(type='nms', iou_threshold=0.65), max_per_img=300))
|
411 |
+
img_scales = [
|
412 |
+
(
|
413 |
+
640,
|
414 |
+
640,
|
415 |
+
),
|
416 |
+
(
|
417 |
+
320,
|
418 |
+
320,
|
419 |
+
),
|
420 |
+
(
|
421 |
+
960,
|
422 |
+
960,
|
423 |
+
),
|
424 |
+
]
|
425 |
+
_multiscale_resize_transforms = [
|
426 |
+
dict(
|
427 |
+
type='Compose',
|
428 |
+
transforms=[
|
429 |
+
dict(type='YOLOv5KeepRatioResize', scale=(
|
430 |
+
640,
|
431 |
+
640,
|
432 |
+
)),
|
433 |
+
dict(
|
434 |
+
type='LetterResize',
|
435 |
+
scale=(
|
436 |
+
640,
|
437 |
+
640,
|
438 |
+
),
|
439 |
+
allow_scale_up=False,
|
440 |
+
pad_val=dict(img=114)),
|
441 |
+
]),
|
442 |
+
dict(
|
443 |
+
type='Compose',
|
444 |
+
transforms=[
|
445 |
+
dict(type='YOLOv5KeepRatioResize', scale=(
|
446 |
+
320,
|
447 |
+
320,
|
448 |
+
)),
|
449 |
+
dict(
|
450 |
+
type='LetterResize',
|
451 |
+
scale=(
|
452 |
+
320,
|
453 |
+
320,
|
454 |
+
),
|
455 |
+
allow_scale_up=False,
|
456 |
+
pad_val=dict(img=114)),
|
457 |
+
]),
|
458 |
+
dict(
|
459 |
+
type='Compose',
|
460 |
+
transforms=[
|
461 |
+
dict(type='YOLOv5KeepRatioResize', scale=(
|
462 |
+
960,
|
463 |
+
960,
|
464 |
+
)),
|
465 |
+
dict(
|
466 |
+
type='LetterResize',
|
467 |
+
scale=(
|
468 |
+
960,
|
469 |
+
960,
|
470 |
+
),
|
471 |
+
allow_scale_up=False,
|
472 |
+
pad_val=dict(img=114)),
|
473 |
+
]),
|
474 |
+
]
|
475 |
+
tta_pipeline = [
|
476 |
+
dict(type='LoadImageFromFile', file_client_args=dict(backend='disk')),
|
477 |
+
dict(
|
478 |
+
type='TestTimeAug',
|
479 |
+
transforms=[
|
480 |
+
[
|
481 |
+
dict(
|
482 |
+
type='Compose',
|
483 |
+
transforms=[
|
484 |
+
dict(type='YOLOv5KeepRatioResize', scale=(
|
485 |
+
640,
|
486 |
+
640,
|
487 |
+
)),
|
488 |
+
dict(
|
489 |
+
type='LetterResize',
|
490 |
+
scale=(
|
491 |
+
640,
|
492 |
+
640,
|
493 |
+
),
|
494 |
+
allow_scale_up=False,
|
495 |
+
pad_val=dict(img=114)),
|
496 |
+
]),
|
497 |
+
dict(
|
498 |
+
type='Compose',
|
499 |
+
transforms=[
|
500 |
+
dict(type='YOLOv5KeepRatioResize', scale=(
|
501 |
+
320,
|
502 |
+
320,
|
503 |
+
)),
|
504 |
+
dict(
|
505 |
+
type='LetterResize',
|
506 |
+
scale=(
|
507 |
+
320,
|
508 |
+
320,
|
509 |
+
),
|
510 |
+
allow_scale_up=False,
|
511 |
+
pad_val=dict(img=114)),
|
512 |
+
]),
|
513 |
+
dict(
|
514 |
+
type='Compose',
|
515 |
+
transforms=[
|
516 |
+
dict(type='YOLOv5KeepRatioResize', scale=(
|
517 |
+
960,
|
518 |
+
960,
|
519 |
+
)),
|
520 |
+
dict(
|
521 |
+
type='LetterResize',
|
522 |
+
scale=(
|
523 |
+
960,
|
524 |
+
960,
|
525 |
+
),
|
526 |
+
allow_scale_up=False,
|
527 |
+
pad_val=dict(img=114)),
|
528 |
+
]),
|
529 |
+
],
|
530 |
+
[
|
531 |
+
dict(type='mmdet.RandomFlip', prob=1.0),
|
532 |
+
dict(type='mmdet.RandomFlip', prob=0.0),
|
533 |
+
],
|
534 |
+
[
|
535 |
+
dict(type='mmdet.LoadAnnotations', with_bbox=True),
|
536 |
+
],
|
537 |
+
[
|
538 |
+
dict(
|
539 |
+
type='mmdet.PackDetInputs',
|
540 |
+
meta_keys=(
|
541 |
+
'img_id',
|
542 |
+
'img_path',
|
543 |
+
'ori_shape',
|
544 |
+
'img_shape',
|
545 |
+
'scale_factor',
|
546 |
+
'pad_param',
|
547 |
+
'flip',
|
548 |
+
'flip_direction',
|
549 |
+
)),
|
550 |
+
],
|
551 |
+
]),
|
552 |
+
]
|
553 |
+
|
554 |
+
launcher = 'none'
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/custom_dataset/yolov7_l_syncbn_fast_8x16b-300e_coco.py
ADDED
@@ -0,0 +1,472 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = ['../_base_/default_runtime.py', '../_base_/det_p5_tta.py']
|
2 |
+
|
3 |
+
data_root = './data-df2/'
|
4 |
+
train_ann_file = 'annotations/instances_train2017.json'
|
5 |
+
train_data_prefix = 'train2017/'
|
6 |
+
val_ann_file = 'annotations/instances_val2017.json'
|
7 |
+
val_data_prefix = 'val2017/'
|
8 |
+
num_classes = 13
|
9 |
+
train_batch_size_per_gpu = 16
|
10 |
+
train_num_workers = 8
|
11 |
+
persistent_workers = True
|
12 |
+
|
13 |
+
vis_backends = [
|
14 |
+
dict(type='LocalVisBackend'),
|
15 |
+
]
|
16 |
+
visualizer = dict(
|
17 |
+
type='mmdet.DetLocalVisualizer',
|
18 |
+
vis_backends=[
|
19 |
+
dict(type='LocalVisBackend'),
|
20 |
+
dict(type='WandbVisBackend')
|
21 |
+
],
|
22 |
+
name='visualizer')
|
23 |
+
log_processor = dict(type='LogProcessor', window_size=50, by_epoch=True)
|
24 |
+
log_level = 'INFO'
|
25 |
+
load_from = None
|
26 |
+
resume = False
|
27 |
+
|
28 |
+
anchors = [
|
29 |
+
[(12, 16), (19, 36), (40, 28)], # P3/8
|
30 |
+
[(36, 75), (76, 55), (72, 146)], # P4/16
|
31 |
+
[(142, 110), (192, 243), (459, 401)] # P5/32
|
32 |
+
]
|
33 |
+
|
34 |
+
base_lr = 0.01
|
35 |
+
max_epochs = 100
|
36 |
+
|
37 |
+
num_epoch_stage2 = 10 # The last 10 epochs switch evaluation interval
|
38 |
+
val_interval_stage2 = 1
|
39 |
+
|
40 |
+
model_test_cfg = dict(
|
41 |
+
multi_label=True,
|
42 |
+
nms_pre=30000,
|
43 |
+
score_thr=0.001,
|
44 |
+
nms=dict(type='nms', iou_threshold=0.65),
|
45 |
+
max_per_img=300)
|
46 |
+
|
47 |
+
img_scale = (640, 640)
|
48 |
+
dataset_type = 'YOLOv5CocoDataset'
|
49 |
+
val_batch_size_per_gpu = 1
|
50 |
+
val_num_workers = 2
|
51 |
+
batch_shapes_cfg = dict(
|
52 |
+
type='BatchShapePolicy',
|
53 |
+
batch_size=val_batch_size_per_gpu,
|
54 |
+
img_size=img_scale[0],
|
55 |
+
size_divisor=32,
|
56 |
+
extra_pad_ratio=0.5)
|
57 |
+
strides = [8, 16, 32] # Strides of multi-scale prior box
|
58 |
+
num_det_layers = 3
|
59 |
+
norm_cfg = dict(type='BN', momentum=0.03, eps=0.001)
|
60 |
+
|
61 |
+
# Data augmentation
|
62 |
+
max_translate_ratio = 0.2 # YOLOv5RandomAffine
|
63 |
+
scaling_ratio_range = (0.1, 2.0) # YOLOv5RandomAffine
|
64 |
+
mixup_prob = 0.15 # YOLOv5MixUp
|
65 |
+
randchoice_mosaic_prob = [0.8, 0.2]
|
66 |
+
mixup_alpha = 8.0 # YOLOv5MixUp
|
67 |
+
mixup_beta = 8.0 # YOLOv5MixUp
|
68 |
+
|
69 |
+
# -----train val related-----
|
70 |
+
loss_cls_weight = 0.3
|
71 |
+
loss_bbox_weight = 0.05
|
72 |
+
loss_obj_weight = 0.7
|
73 |
+
# BatchYOLOv7Assigner params
|
74 |
+
simota_candidate_topk = 10
|
75 |
+
simota_iou_weight = 3.0
|
76 |
+
simota_cls_weight = 1.0
|
77 |
+
prior_match_thr = 4. # Priori box matching threshold
|
78 |
+
obj_level_weights = [4., 1.,
|
79 |
+
0.4] # The obj loss weights of the three output layers
|
80 |
+
|
81 |
+
lr_factor = 0.1 # Learning rate scaling factor
|
82 |
+
weight_decay = 0.0005
|
83 |
+
save_epoch_intervals = 2
|
84 |
+
max_keep_ckpts = 5
|
85 |
+
|
86 |
+
env_cfg = dict(
|
87 |
+
cudnn_benchmark=True,
|
88 |
+
mp_cfg=dict(mp_start_method='fork', opencv_num_threads=0),
|
89 |
+
dist_cfg=dict(backend='nccl'))
|
90 |
+
|
91 |
+
# ===============================Unmodified in most cases====================
|
92 |
+
model = dict(
|
93 |
+
type='YOLODetector',
|
94 |
+
data_preprocessor=dict(
|
95 |
+
type='YOLOv5DetDataPreprocessor',
|
96 |
+
mean=[0., 0., 0.],
|
97 |
+
std=[255., 255., 255.],
|
98 |
+
bgr_to_rgb=True),
|
99 |
+
backbone=dict(
|
100 |
+
type='YOLOv7Backbone',
|
101 |
+
arch='L',
|
102 |
+
norm_cfg=norm_cfg,
|
103 |
+
act_cfg=dict(type='SiLU', inplace=True)),
|
104 |
+
neck=dict(
|
105 |
+
type='YOLOv7PAFPN',
|
106 |
+
block_cfg=dict(
|
107 |
+
type='ELANBlock',
|
108 |
+
middle_ratio=0.5,
|
109 |
+
block_ratio=0.25,
|
110 |
+
num_blocks=4,
|
111 |
+
num_convs_in_block=1),
|
112 |
+
upsample_feats_cat_first=False,
|
113 |
+
in_channels=[512, 1024, 1024],
|
114 |
+
# The real output channel will be multiplied by 2
|
115 |
+
out_channels=[128, 256, 512],
|
116 |
+
norm_cfg=norm_cfg,
|
117 |
+
act_cfg=dict(type='SiLU', inplace=True)),
|
118 |
+
bbox_head=dict(
|
119 |
+
type='YOLOv7Head',
|
120 |
+
head_module=dict(
|
121 |
+
type='YOLOv7HeadModule',
|
122 |
+
num_classes=num_classes,
|
123 |
+
in_channels=[256, 512, 1024],
|
124 |
+
featmap_strides=strides,
|
125 |
+
num_base_priors=3),
|
126 |
+
prior_generator=dict(
|
127 |
+
type='mmdet.YOLOAnchorGenerator',
|
128 |
+
base_sizes=anchors,
|
129 |
+
strides=strides),
|
130 |
+
# scaled based on number of detection layers
|
131 |
+
loss_cls=dict(
|
132 |
+
type='mmdet.CrossEntropyLoss',
|
133 |
+
use_sigmoid=True,
|
134 |
+
reduction='mean',
|
135 |
+
loss_weight=loss_cls_weight *
|
136 |
+
(num_classes / 80 * 3 / num_det_layers)),
|
137 |
+
loss_bbox=dict(
|
138 |
+
type='IoULoss',
|
139 |
+
iou_mode='ciou',
|
140 |
+
bbox_format='xywh',
|
141 |
+
reduction='mean',
|
142 |
+
loss_weight=loss_bbox_weight * (3 / num_det_layers),
|
143 |
+
return_iou=True),
|
144 |
+
loss_obj=dict(
|
145 |
+
type='mmdet.CrossEntropyLoss',
|
146 |
+
use_sigmoid=True,
|
147 |
+
reduction='mean',
|
148 |
+
loss_weight=loss_obj_weight *
|
149 |
+
((img_scale[0] / 640)**2 * 3 / num_det_layers)),
|
150 |
+
prior_match_thr=prior_match_thr,
|
151 |
+
obj_level_weights=obj_level_weights,
|
152 |
+
# BatchYOLOv7Assigner params
|
153 |
+
simota_candidate_topk=simota_candidate_topk,
|
154 |
+
simota_iou_weight=simota_iou_weight,
|
155 |
+
simota_cls_weight=simota_cls_weight),
|
156 |
+
test_cfg=model_test_cfg)
|
157 |
+
|
158 |
+
pre_transform = [
|
159 |
+
dict(type='LoadImageFromFile', file_client_args=_base_.file_client_args),
|
160 |
+
dict(type='LoadAnnotations', with_bbox=True)
|
161 |
+
]
|
162 |
+
|
163 |
+
mosiac4_pipeline = [
|
164 |
+
dict(
|
165 |
+
type='Mosaic',
|
166 |
+
img_scale=img_scale,
|
167 |
+
pad_val=114.0,
|
168 |
+
pre_transform=pre_transform),
|
169 |
+
dict(
|
170 |
+
type='YOLOv5RandomAffine',
|
171 |
+
max_rotate_degree=0.0,
|
172 |
+
max_shear_degree=0.0,
|
173 |
+
max_translate_ratio=max_translate_ratio, # note
|
174 |
+
scaling_ratio_range=scaling_ratio_range, # note
|
175 |
+
# img_scale is (width, height)
|
176 |
+
border=(-img_scale[0] // 2, -img_scale[1] // 2),
|
177 |
+
border_val=(114, 114, 114)),
|
178 |
+
]
|
179 |
+
|
180 |
+
mosiac9_pipeline = [
|
181 |
+
dict(
|
182 |
+
type='Mosaic9',
|
183 |
+
img_scale=img_scale,
|
184 |
+
pad_val=114.0,
|
185 |
+
pre_transform=pre_transform),
|
186 |
+
dict(
|
187 |
+
type='YOLOv5RandomAffine',
|
188 |
+
max_rotate_degree=0.0,
|
189 |
+
max_shear_degree=0.0,
|
190 |
+
max_translate_ratio=max_translate_ratio, # note
|
191 |
+
scaling_ratio_range=scaling_ratio_range, # note
|
192 |
+
# img_scale is (width, height)
|
193 |
+
border=(-img_scale[0] // 2, -img_scale[1] // 2),
|
194 |
+
border_val=(114, 114, 114)),
|
195 |
+
]
|
196 |
+
|
197 |
+
randchoice_mosaic_pipeline = dict(
|
198 |
+
type='RandomChoice',
|
199 |
+
transforms=[mosiac4_pipeline, mosiac9_pipeline],
|
200 |
+
prob=randchoice_mosaic_prob)
|
201 |
+
|
202 |
+
train_pipeline = [
|
203 |
+
*pre_transform,
|
204 |
+
randchoice_mosaic_pipeline,
|
205 |
+
dict(
|
206 |
+
type='YOLOv5MixUp',
|
207 |
+
alpha=mixup_alpha, # note
|
208 |
+
beta=mixup_beta, # note
|
209 |
+
prob=mixup_prob,
|
210 |
+
pre_transform=[*pre_transform, randchoice_mosaic_pipeline]),
|
211 |
+
dict(type='YOLOv5HSVRandomAug'),
|
212 |
+
dict(type='mmdet.RandomFlip', prob=0.5),
|
213 |
+
dict(
|
214 |
+
type='mmdet.PackDetInputs',
|
215 |
+
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'flip',
|
216 |
+
'flip_direction'))
|
217 |
+
]
|
218 |
+
|
219 |
+
train_dataloader = dict(
|
220 |
+
batch_size=train_batch_size_per_gpu,
|
221 |
+
num_workers=train_num_workers,
|
222 |
+
persistent_workers=persistent_workers,
|
223 |
+
pin_memory=True,
|
224 |
+
sampler=dict(type='DefaultSampler', shuffle=True),
|
225 |
+
collate_fn=dict(type='yolov5_collate'), # FASTER
|
226 |
+
dataset=dict(
|
227 |
+
type=dataset_type,
|
228 |
+
data_root=data_root,
|
229 |
+
ann_file=train_ann_file,
|
230 |
+
data_prefix=dict(img=train_data_prefix),
|
231 |
+
filter_cfg=dict(filter_empty_gt=False, min_size=32),
|
232 |
+
pipeline=train_pipeline))
|
233 |
+
|
234 |
+
test_pipeline = [
|
235 |
+
dict(type='LoadImageFromFile', file_client_args=_base_.file_client_args),
|
236 |
+
dict(type='YOLOv5KeepRatioResize', scale=img_scale),
|
237 |
+
dict(
|
238 |
+
type='LetterResize',
|
239 |
+
scale=img_scale,
|
240 |
+
allow_scale_up=False,
|
241 |
+
pad_val=dict(img=114)),
|
242 |
+
dict(type='LoadAnnotations', with_bbox=True, _scope_='mmdet'),
|
243 |
+
dict(
|
244 |
+
type='mmdet.PackDetInputs',
|
245 |
+
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
|
246 |
+
'scale_factor', 'pad_param'))
|
247 |
+
]
|
248 |
+
|
249 |
+
val_dataloader = dict(
|
250 |
+
batch_size=val_batch_size_per_gpu,
|
251 |
+
num_workers=val_num_workers,
|
252 |
+
persistent_workers=persistent_workers,
|
253 |
+
pin_memory=True,
|
254 |
+
drop_last=False,
|
255 |
+
sampler=dict(type='DefaultSampler', shuffle=False),
|
256 |
+
dataset=dict(
|
257 |
+
type=dataset_type,
|
258 |
+
data_root=data_root,
|
259 |
+
test_mode=True,
|
260 |
+
data_prefix=dict(img=val_data_prefix),
|
261 |
+
ann_file=val_ann_file,
|
262 |
+
pipeline=test_pipeline,
|
263 |
+
batch_shapes_cfg=batch_shapes_cfg))
|
264 |
+
|
265 |
+
test_dataloader = val_dataloader
|
266 |
+
|
267 |
+
param_scheduler = None
|
268 |
+
optim_wrapper = dict(
|
269 |
+
type='OptimWrapper',
|
270 |
+
optimizer=dict(
|
271 |
+
type='SGD',
|
272 |
+
lr=base_lr,
|
273 |
+
momentum=0.937,
|
274 |
+
weight_decay=weight_decay,
|
275 |
+
nesterov=True,
|
276 |
+
batch_size_per_gpu=train_batch_size_per_gpu),
|
277 |
+
constructor='YOLOv7OptimWrapperConstructor')
|
278 |
+
|
279 |
+
default_scope = 'mmyolo'
|
280 |
+
default_hooks = dict(
|
281 |
+
timer=dict(type='IterTimerHook'),
|
282 |
+
logger=dict(type='LoggerHook', interval=2),
|
283 |
+
param_scheduler=dict(
|
284 |
+
type='YOLOv5ParamSchedulerHook',
|
285 |
+
scheduler_type='cosine',
|
286 |
+
lr_factor=lr_factor, # note
|
287 |
+
max_epochs=max_epochs),
|
288 |
+
checkpoint=dict(
|
289 |
+
type='CheckpointHook',
|
290 |
+
save_param_scheduler=False,
|
291 |
+
interval=save_epoch_intervals,
|
292 |
+
save_best='auto',
|
293 |
+
max_keep_ckpts=max_keep_ckpts),
|
294 |
+
sampler_seed=dict(type='DistSamplerSeedHook'),
|
295 |
+
visualization=dict(type='mmdet.DetVisualizationHook'))
|
296 |
+
|
297 |
+
custom_hooks = [
|
298 |
+
dict(
|
299 |
+
type='EMAHook',
|
300 |
+
ema_type='ExpMomentumEMA',
|
301 |
+
momentum=0.0001,
|
302 |
+
update_buffers=True,
|
303 |
+
strict_load=False,
|
304 |
+
priority=49)
|
305 |
+
]
|
306 |
+
|
307 |
+
val_evaluator = dict(
|
308 |
+
type='mmdet.CocoMetric',
|
309 |
+
proposal_nums=(100, 1, 10), # Can be accelerated
|
310 |
+
ann_file=data_root + val_ann_file,
|
311 |
+
metric='bbox')
|
312 |
+
test_evaluator = val_evaluator
|
313 |
+
|
314 |
+
train_cfg = dict(
|
315 |
+
type='EpochBasedTrainLoop',
|
316 |
+
max_epochs=max_epochs,
|
317 |
+
val_interval=save_epoch_intervals,
|
318 |
+
dynamic_intervals=[(max_epochs - num_epoch_stage2, val_interval_stage2)])
|
319 |
+
val_cfg = dict(type='ValLoop')
|
320 |
+
test_cfg = dict(type='TestLoop')
|
321 |
+
|
322 |
+
# ============================
|
323 |
+
|
324 |
+
file_client_args = dict(backend='disk')
|
325 |
+
_file_client_args = dict(backend='disk')
|
326 |
+
tta_model = dict(
|
327 |
+
type='mmdet.DetTTAModel',
|
328 |
+
tta_cfg=dict(nms=dict(type='nms', iou_threshold=0.65), max_per_img=300))
|
329 |
+
img_scales = [
|
330 |
+
(
|
331 |
+
640,
|
332 |
+
640,
|
333 |
+
),
|
334 |
+
(
|
335 |
+
320,
|
336 |
+
320,
|
337 |
+
),
|
338 |
+
(
|
339 |
+
960,
|
340 |
+
960,
|
341 |
+
),
|
342 |
+
]
|
343 |
+
_multiscale_resize_transforms = [
|
344 |
+
dict(
|
345 |
+
type='Compose',
|
346 |
+
transforms=[
|
347 |
+
dict(type='YOLOv5KeepRatioResize', scale=(
|
348 |
+
640,
|
349 |
+
640,
|
350 |
+
)),
|
351 |
+
dict(
|
352 |
+
type='LetterResize',
|
353 |
+
scale=(
|
354 |
+
640,
|
355 |
+
640,
|
356 |
+
),
|
357 |
+
allow_scale_up=False,
|
358 |
+
pad_val=dict(img=114)),
|
359 |
+
]),
|
360 |
+
dict(
|
361 |
+
type='Compose',
|
362 |
+
transforms=[
|
363 |
+
dict(type='YOLOv5KeepRatioResize', scale=(
|
364 |
+
320,
|
365 |
+
320,
|
366 |
+
)),
|
367 |
+
dict(
|
368 |
+
type='LetterResize',
|
369 |
+
scale=(
|
370 |
+
320,
|
371 |
+
320,
|
372 |
+
),
|
373 |
+
allow_scale_up=False,
|
374 |
+
pad_val=dict(img=114)),
|
375 |
+
]),
|
376 |
+
dict(
|
377 |
+
type='Compose',
|
378 |
+
transforms=[
|
379 |
+
dict(type='YOLOv5KeepRatioResize', scale=(
|
380 |
+
960,
|
381 |
+
960,
|
382 |
+
)),
|
383 |
+
dict(
|
384 |
+
type='LetterResize',
|
385 |
+
scale=(
|
386 |
+
960,
|
387 |
+
960,
|
388 |
+
),
|
389 |
+
allow_scale_up=False,
|
390 |
+
pad_val=dict(img=114)),
|
391 |
+
]),
|
392 |
+
]
|
393 |
+
tta_pipeline = [
|
394 |
+
dict(type='LoadImageFromFile', file_client_args=dict(backend='disk')),
|
395 |
+
dict(
|
396 |
+
type='TestTimeAug',
|
397 |
+
transforms=[
|
398 |
+
[
|
399 |
+
dict(
|
400 |
+
type='Compose',
|
401 |
+
transforms=[
|
402 |
+
dict(type='YOLOv5KeepRatioResize', scale=(
|
403 |
+
640,
|
404 |
+
640,
|
405 |
+
)),
|
406 |
+
dict(
|
407 |
+
type='LetterResize',
|
408 |
+
scale=(
|
409 |
+
640,
|
410 |
+
640,
|
411 |
+
),
|
412 |
+
allow_scale_up=False,
|
413 |
+
pad_val=dict(img=114)),
|
414 |
+
]),
|
415 |
+
dict(
|
416 |
+
type='Compose',
|
417 |
+
transforms=[
|
418 |
+
dict(type='YOLOv5KeepRatioResize', scale=(
|
419 |
+
320,
|
420 |
+
320,
|
421 |
+
)),
|
422 |
+
dict(
|
423 |
+
type='LetterResize',
|
424 |
+
scale=(
|
425 |
+
320,
|
426 |
+
320,
|
427 |
+
),
|
428 |
+
allow_scale_up=False,
|
429 |
+
pad_val=dict(img=114)),
|
430 |
+
]),
|
431 |
+
dict(
|
432 |
+
type='Compose',
|
433 |
+
transforms=[
|
434 |
+
dict(type='YOLOv5KeepRatioResize', scale=(
|
435 |
+
960,
|
436 |
+
960,
|
437 |
+
)),
|
438 |
+
dict(
|
439 |
+
type='LetterResize',
|
440 |
+
scale=(
|
441 |
+
960,
|
442 |
+
960,
|
443 |
+
),
|
444 |
+
allow_scale_up=False,
|
445 |
+
pad_val=dict(img=114)),
|
446 |
+
]),
|
447 |
+
],
|
448 |
+
[
|
449 |
+
dict(type='mmdet.RandomFlip', prob=1.0),
|
450 |
+
dict(type='mmdet.RandomFlip', prob=0.0),
|
451 |
+
],
|
452 |
+
[
|
453 |
+
dict(type='mmdet.LoadAnnotations', with_bbox=True),
|
454 |
+
],
|
455 |
+
[
|
456 |
+
dict(
|
457 |
+
type='mmdet.PackDetInputs',
|
458 |
+
meta_keys=(
|
459 |
+
'img_id',
|
460 |
+
'img_path',
|
461 |
+
'ori_shape',
|
462 |
+
'img_shape',
|
463 |
+
'scale_factor',
|
464 |
+
'pad_param',
|
465 |
+
'flip',
|
466 |
+
'flip_direction',
|
467 |
+
)),
|
468 |
+
],
|
469 |
+
]),
|
470 |
+
]
|
471 |
+
|
472 |
+
launcher = 'none'
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/README.md
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# YOLOv5
|
2 |
+
|
3 |
+
<!-- [ALGORITHM] -->
|
4 |
+
|
5 |
+
## Abstract
|
6 |
+
|
7 |
+
YOLOv5 is a family of object detection architectures and models pretrained on the COCO dataset, and represents Ultralytics open-source research into future vision AI methods, incorporating lessons learned and best practices evolved over thousands of hours of research and development.
|
8 |
+
|
9 |
+
<div align=center>
|
10 |
+
<img src="https://user-images.githubusercontent.com/27466624/200000324-70ae078f-cea7-4189-8baa-440656797dad.jpg"/>
|
11 |
+
YOLOv5-l-P5 model structure
|
12 |
+
</div>
|
13 |
+
|
14 |
+
<div align=center>
|
15 |
+
<img src="https://user-images.githubusercontent.com/27466624/211143533-1725c1b2-6189-4c3a-a046-ad968e03cb9d.jpg"/>
|
16 |
+
YOLOv5-l-P6 model structure
|
17 |
+
</div>
|
18 |
+
|
19 |
+
## Results and models
|
20 |
+
|
21 |
+
### COCO
|
22 |
+
|
23 |
+
| Backbone | Arch | size | SyncBN | AMP | Mem (GB) | box AP | TTA box AP | Config | Download |
|
24 |
+
| :------: | :--: | :--: | :----: | :-: | :------: | :----: | :--------: | :--------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
|
25 |
+
| YOLOv5-n | P5 | 640 | Yes | Yes | 1.5 | 28.0 | 30.7 | [config](https://github.com/open-mmlab/mmyolo/tree/main/configs/yolov5/yolov5_n-v61_syncbn_fast_8xb16-300e_coco.py) | [model](https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_n-v61_syncbn_fast_8xb16-300e_coco/yolov5_n-v61_syncbn_fast_8xb16-300e_coco_20220919_090739-b804c1ad.pth) \| [log](https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_n-v61_syncbn_fast_8xb16-300e_coco/yolov5_n-v61_syncbn_fast_8xb16-300e_coco_20220919_090739.log.json) |
|
26 |
+
| YOLOv5-s | P5 | 640 | Yes | Yes | 2.7 | 37.7 | 40.2 | [config](https://github.com/open-mmlab/mmyolo/tree/main/configs/yolov5/yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py) | [model](https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_s-v61_syncbn_fast_8xb16-300e_coco/yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700-86e02187.pth) \| [log](https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_s-v61_syncbn_fast_8xb16-300e_coco/yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700.log.json) |
|
27 |
+
| YOLOv5-m | P5 | 640 | Yes | Yes | 5.0 | 45.3 | 46.9 | [config](https://github.com/open-mmlab/mmyolo/tree/main/configs/yolov5/yolov5_m-v61_syncbn_fast_8xb16-300e_coco.py) | [model](https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_m-v61_syncbn_fast_8xb16-300e_coco/yolov5_m-v61_syncbn_fast_8xb16-300e_coco_20220917_204944-516a710f.pth) \| [log](https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_m-v61_syncbn_fast_8xb16-300e_coco/yolov5_m-v61_syncbn_fast_8xb16-300e_coco_20220917_204944.log.json) |
|
28 |
+
| YOLOv5-l | P5 | 640 | Yes | Yes | 8.1 | 48.8 | 49.9 | [config](https://github.com/open-mmlab/mmyolo/tree/main/configs/yolov5/yolov5_l-v61_syncbn_fast_8xb16-300e_coco.py) | [model](https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_l-v61_syncbn_fast_8xb16-300e_coco/yolov5_l-v61_syncbn_fast_8xb16-300e_coco_20220917_031007-096ef0eb.pth) \| [log](https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_l-v61_syncbn_fast_8xb16-300e_coco/yolov5_l-v61_syncbn_fast_8xb16-300e_coco_20220917_031007.log.json) |
|
29 |
+
| YOLOv5-n | P6 | 1280 | Yes | Yes | 5.8 | 35.9 | | [config](https://github.com/open-mmlab/mmyolo/tree/main/configs/yolov5/yolov5_n-p6-v62_syncbn_fast_8xb16-300e_coco.py) | [model](https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_n-p6-v62_syncbn_fast_8xb16-300e_coco/yolov5_n-p6-v62_syncbn_fast_8xb16-300e_coco_20221027_224705-d493c5f3.pth) \| [log](https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_n-p6-v62_syncbn_fast_8xb16-300e_coco/yolov5_n-p6-v62_syncbn_fast_8xb16-300e_coco_20221027_224705.log.json) |
|
30 |
+
| YOLOv5-s | P6 | 1280 | Yes | Yes | 10.5 | 44.4 | | [config](https://github.com/open-mmlab/mmyolo/tree/main/configs/yolov5/yolov5_s-p6-v62_syncbn_fast_8xb16-300e_coco.py) | [model](https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_s-p6-v62_syncbn_fast_8xb16-300e_coco/yolov5_s-p6-v62_syncbn_fast_8xb16-300e_coco_20221027_215044-58865c19.pth) \| [log](https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_s-p6-v62_syncbn_fast_8xb16-300e_coco/yolov5_s-p6-v62_syncbn_fast_8xb16-300e_coco_20221027_215044.log.json) |
|
31 |
+
| YOLOv5-m | P6 | 1280 | Yes | Yes | 19.1 | 51.3 | | [config](https://github.com/open-mmlab/mmyolo/tree/main/configs/yolov5/yolov5_m-p6-v62_syncbn_fast_8xb16-300e_coco.py) | [model](https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_m-p6-v62_syncbn_fast_8xb16-300e_coco/yolov5_m-p6-v62_syncbn_fast_8xb16-300e_coco_20221027_230453-49564d58.pth) \| [log](https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_m-p6-v62_syncbn_fast_8xb16-300e_coco/yolov5_m-p6-v62_syncbn_fast_8xb16-300e_coco_20221027_230453.log.json) |
|
32 |
+
| YOLOv5-l | P6 | 1280 | Yes | Yes | 30.5 | 53.7 | | [config](https://github.com/open-mmlab/mmyolo/tree/main/configs/yolov5/yolov5_l-p6-v62_syncbn_fast_8xb16-300e_coco.py) | [model](https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_l-p6-v62_syncbn_fast_8xb16-300e_coco/yolov5_l-p6-v62_syncbn_fast_8xb16-300e_coco_20221027_234308-7a2ba6bf.pth) \| [log](https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_l-p6-v62_syncbn_fast_8xb16-300e_coco/yolov5_l-p6-v62_syncbn_fast_8xb16-300e_coco_20221027_234308.log.json) |
|
33 |
+
|
34 |
+
**Note**:
|
35 |
+
In the official YOLOv5 code, the `random_perspective` data augmentation in COCO object detection task training uses mask annotation information, which leads to higher performance. Object detection should not use mask annotation, so only box annotation information is used in `MMYOLO`. We will use the mask annotation information in the instance segmentation task. See https://github.com/ultralytics/yolov5/issues/9917 for details.
|
36 |
+
|
37 |
+
1. `fast` means that `YOLOv5DetDataPreprocessor` and `yolov5_collate` are used for data preprocessing, which is faster for training, but less flexible for multitasking. Recommended to use fast version config if you only care about object detection.
|
38 |
+
2. `detect` means that the network input is fixed to `640x640` and the post-processing thresholds is modified.
|
39 |
+
3. `SyncBN` means use SyncBN, `AMP` indicates training with mixed precision.
|
40 |
+
4. We use 8x A100 for training, and the single-GPU batch size is 16. This is different from the official code.
|
41 |
+
5. The performance is unstable and may fluctuate by about 0.4 mAP and the highest performance weight in `COCO` training in `YOLOv5` may not be the last epoch.
|
42 |
+
6. `TTA` means that Test Time Augmentation. It's perform 3 multi-scaling transformations on the image, followed by 2 flipping transformations (flipping and not flipping). You only need to specify `--tta` when testing to enable. see [TTA](https://github.com/open-mmlab/mmyolo/blob/dev/docs/en/common_usage/tta.md) for details.
|
43 |
+
|
44 |
+
### VOC
|
45 |
+
|
46 |
+
| Backbone | size | Batchsize | AMP | Mem (GB) | box AP(COCO metric) | Config | Download |
|
47 |
+
| :------: | :--: | :-------: | :-: | :------: | :-----------------: | :------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
|
48 |
+
| YOLOv5-n | 512 | 64 | Yes | 3.5 | 51.2 | [config](https://github.com/open-mmlab/mmyolo/tree/main/configs/yolov5/voc/yolov5_n-v61_fast_1xb64-50e_voc.py) | [model](https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_n-v61_fast_1xb64-50e_voc/yolov5_n-v61_fast_1xb64-50e_voc_20221017_234254-f1493430.pth) \| [log](https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_n-v61_fast_1xb64-50e_voc/yolov5_n-v61_fast_1xb64-50e_voc_20221017_234254.log.json) |
|
49 |
+
| YOLOv5-s | 512 | 64 | Yes | 6.5 | 62.7 | [config](https://github.com/open-mmlab/mmyolo/tree/main/configs/yolov5/voc/yolov5_s-v61_fast_1xb64-50e_voc.py) | [model](https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_s-v61_fast_1xb64-50e_voc/yolov5_s-v61_fast_1xb64-50e_voc_20221017_234156-0009b33e.pth) \| [log](https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_s-v61_fast_1xb64-50e_voc/yolov5_s-v61_fast_1xb64-50e_voc_20221017_234156.log.json) |
|
50 |
+
| YOLOv5-m | 512 | 64 | Yes | 12.0 | 70.1 | [config](https://github.com/open-mmlab/mmyolo/tree/main/configs/yolov5/voc/yolov5_m-v61_fast_1xb64-50e_voc.py) | [model](https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_m-v61_fast_1xb64-50e_voc/yolov5_m-v61_fast_1xb64-50e_voc_20221017_114138-815c143a.pth) \| [log](https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_m-v61_fast_1xb64-50e_voc/yolov5_m-v61_fast_1xb64-50e_voc_20221017_114138.log.json) |
|
51 |
+
| YOLOv5-l | 512 | 32 | Yes | 10.0 | 73.1 | [config](https://github.com/open-mmlab/mmyolo/tree/main/configs/yolov5/voc/yolov5_l-v61_fast_1xb32-50e_voc.py) | [model](https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_l-v61_fast_1xb32-50e_voc/yolov5_l-v61_fast_1xb32-50e_voc_20221017_045500-edc7e0d8.pth) \| [log](https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_l-v61_fast_1xb32-50e_voc/yolov5_l-v61_fast_1xb32-50e_voc_20221017_045500.log.json) |
|
52 |
+
|
53 |
+
**Note**:
|
54 |
+
|
55 |
+
1. Training on VOC dataset need pretrained model which trained on COCO.
|
56 |
+
2. The performance is unstable and may fluctuate by about 0.4 mAP.
|
57 |
+
3. Official YOLOv5 use COCO metric, while training VOC dataset.
|
58 |
+
4. We converted the VOC test dataset to COCO format offline, while reproducing mAP result as shown above. We will support to use COCO metric while training VOC dataset in later version.
|
59 |
+
5. Hyperparameter reference from `https://wandb.ai/glenn-jocher/YOLOv5_VOC_official`.
|
60 |
+
|
61 |
+
### CrowdHuman
|
62 |
+
|
63 |
+
Since the `iscrowd` annotation of the COCO dataset is not equivalent to `ignore`, we use the CrowdHuman dataset to verify that the YOLOv5 ignore logic is correct.
|
64 |
+
|
65 |
+
| Backbone | size | SyncBN | AMP | Mem (GB) | ignore_iof_thr | box AP50(CrowDHuman Metric) | MR | JI | Config | Download |
|
66 |
+
| :------: | :--: | :----: | :-: | :------: | :------------: | :-------------------------: | :--: | :---: | :-----------------------------------------------------------------------------------------------------------------------------: | :------: |
|
67 |
+
| YOLOv5-s | 640 | Yes | Yes | 2.6 | -1 | 85.79 | 48.7 | 75.33 | [config](https://github.com/open-mmlab/mmyolo/tree/main/configs/yolov5/crowdhuman/yolov5_s-v61_fast_8xb16-300e_crowdhuman.py) | |
|
68 |
+
| YOLOv5-s | 640 | Yes | Yes | 2.6 | 0.5 | 86.17 | 48.8 | 75.87 | [config](https://github.com/open-mmlab/mmyolo/tree/main/configs/yolov5/crowdhuman/yolov5_s-v61_8xb16-300e_ignore_crowdhuman.py) | |
|
69 |
+
|
70 |
+
**Note**:
|
71 |
+
|
72 |
+
1. `ignore_iof_thr` is -1 indicating that the ignore tag is not considered. We adjusted with `ignore_iof_thr` thresholds of 0.5, 0.8, 0.9, and the results show that 0.5 has the best performance.
|
73 |
+
2. The above table shows the performance of the model with the best performance on the validation set. The best performing models are around 160+ epoch which means that there is no need to train so many epochs.
|
74 |
+
3. This is a very simple implementation that simply replaces COCO's anchor with the `tools/analysis_tools/optimize_anchors.py` script. We'll adjust other parameters later to improve performance.
|
75 |
+
|
76 |
+
## Citation
|
77 |
+
|
78 |
+
```latex
|
79 |
+
@software{glenn_jocher_2022_7002879,
|
80 |
+
author = {Glenn Jocher and
|
81 |
+
Ayush Chaurasia and
|
82 |
+
Alex Stoken and
|
83 |
+
Jirka Borovec and
|
84 |
+
NanoCode012 and
|
85 |
+
Yonghye Kwon and
|
86 |
+
TaoXie and
|
87 |
+
Kalen Michael and
|
88 |
+
Jiacong Fang and
|
89 |
+
imyhxy and
|
90 |
+
Lorna and
|
91 |
+
Colin Wong and
|
92 |
+
曾逸夫(Zeng Yifu) and
|
93 |
+
Abhiram V and
|
94 |
+
Diego Montes and
|
95 |
+
Zhiqiang Wang and
|
96 |
+
Cristi Fati and
|
97 |
+
Jebastin Nadar and
|
98 |
+
Laughing and
|
99 |
+
UnglvKitDe and
|
100 |
+
tkianai and
|
101 |
+
yxNONG and
|
102 |
+
Piotr Skalski and
|
103 |
+
Adam Hogan and
|
104 |
+
Max Strobel and
|
105 |
+
Mrinal Jain and
|
106 |
+
Lorenzo Mammana and
|
107 |
+
xylieong},
|
108 |
+
title = {{ultralytics/yolov5: v6.2 - YOLOv5 Classification
|
109 |
+
Models, Apple M1, Reproducibility, ClearML and
|
110 |
+
Deci.ai integrations}},
|
111 |
+
month = aug,
|
112 |
+
year = 2022,
|
113 |
+
publisher = {Zenodo},
|
114 |
+
version = {v6.2},
|
115 |
+
doi = {10.5281/zenodo.7002879},
|
116 |
+
url = {https://doi.org/10.5281/zenodo.7002879}
|
117 |
+
}
|
118 |
+
```
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/__init__.py
ADDED
File without changes
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/crowdhuman/__init__.py
ADDED
File without changes
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/crowdhuman/yolov5_s-v61_8xb16-300e_ignore_crowdhuman.py
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = 'yolov5_s-v61_fast_8xb16-300e_crowdhuman.py'
|
2 |
+
|
3 |
+
model = dict(
|
4 |
+
data_preprocessor=dict(
|
5 |
+
_delete_=True,
|
6 |
+
type='mmdet.DetDataPreprocessor',
|
7 |
+
mean=[0., 0., 0.],
|
8 |
+
std=[255., 255., 255.],
|
9 |
+
bgr_to_rgb=True),
|
10 |
+
bbox_head=dict(ignore_iof_thr=0.5))
|
11 |
+
|
12 |
+
img_scale = _base_.img_scale
|
13 |
+
|
14 |
+
albu_train_transforms = [
|
15 |
+
dict(type='Blur', p=0.01),
|
16 |
+
dict(type='MedianBlur', p=0.01),
|
17 |
+
dict(type='ToGray', p=0.01),
|
18 |
+
dict(type='CLAHE', p=0.01)
|
19 |
+
]
|
20 |
+
|
21 |
+
pre_transform = [
|
22 |
+
dict(type='LoadImageFromFile', file_client_args=_base_.file_client_args),
|
23 |
+
# only change this
|
24 |
+
dict(type='mmdet.LoadAnnotations', with_bbox=True)
|
25 |
+
]
|
26 |
+
|
27 |
+
train_pipeline = [
|
28 |
+
*pre_transform,
|
29 |
+
dict(
|
30 |
+
type='Mosaic',
|
31 |
+
img_scale=img_scale,
|
32 |
+
pad_val=114.0,
|
33 |
+
pre_transform=pre_transform),
|
34 |
+
dict(
|
35 |
+
type='YOLOv5RandomAffine',
|
36 |
+
max_rotate_degree=0.0,
|
37 |
+
max_shear_degree=0.0,
|
38 |
+
scaling_ratio_range=(0.5, 1.5),
|
39 |
+
# img_scale is (width, height)
|
40 |
+
border=(-img_scale[0] // 2, -img_scale[1] // 2),
|
41 |
+
border_val=(114, 114, 114)),
|
42 |
+
dict(
|
43 |
+
type='mmdet.Albu',
|
44 |
+
transforms=albu_train_transforms,
|
45 |
+
bbox_params=dict(
|
46 |
+
type='BboxParams',
|
47 |
+
format='pascal_voc',
|
48 |
+
label_fields=['gt_bboxes_labels', 'gt_ignore_flags']),
|
49 |
+
keymap={
|
50 |
+
'img': 'image',
|
51 |
+
'gt_bboxes': 'bboxes'
|
52 |
+
}),
|
53 |
+
dict(type='YOLOv5HSVRandomAug'),
|
54 |
+
dict(type='mmdet.RandomFlip', prob=0.5),
|
55 |
+
dict(
|
56 |
+
type='mmdet.PackDetInputs',
|
57 |
+
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'flip',
|
58 |
+
'flip_direction'))
|
59 |
+
]
|
60 |
+
|
61 |
+
train_dataloader = dict(
|
62 |
+
collate_fn=dict(type='pseudo_collate'),
|
63 |
+
dataset=dict(pipeline=train_pipeline))
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/crowdhuman/yolov5_s-v61_fast_8xb16-300e_crowdhuman.py
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = '../yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py'
|
2 |
+
|
3 |
+
# Use the model trained on the COCO as the pretrained model
|
4 |
+
load_from = 'https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_s-v61_syncbn_fast_8xb16-300e_coco/yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700-86e02187.pth' # noqa
|
5 |
+
|
6 |
+
# dataset settings
|
7 |
+
data_root = 'data/CrowdHuman/'
|
8 |
+
dataset_type = 'YOLOv5CrowdHumanDataset'
|
9 |
+
|
10 |
+
# parameters that often need to be modified
|
11 |
+
num_classes = 1
|
12 |
+
|
13 |
+
anchors = [
|
14 |
+
[(6, 14), (12, 28), (19, 48)], # P3/8
|
15 |
+
[(29, 79), (46, 124), (142, 54)], # P4/16
|
16 |
+
[(73, 198), (124, 330), (255, 504)] # P5/32
|
17 |
+
]
|
18 |
+
|
19 |
+
model = dict(
|
20 |
+
bbox_head=dict(
|
21 |
+
head_module=dict(num_classes=num_classes),
|
22 |
+
prior_generator=dict(base_sizes=anchors)))
|
23 |
+
|
24 |
+
train_dataloader = dict(
|
25 |
+
dataset=dict(
|
26 |
+
type=dataset_type,
|
27 |
+
data_root=data_root,
|
28 |
+
ann_file='annotation_train.odgt',
|
29 |
+
data_prefix=dict(img='Images/')))
|
30 |
+
|
31 |
+
val_dataloader = dict(
|
32 |
+
dataset=dict(
|
33 |
+
type=dataset_type,
|
34 |
+
data_root=data_root,
|
35 |
+
ann_file='annotation_val.odgt',
|
36 |
+
data_prefix=dict(img='Images/'),
|
37 |
+
# CrowdHumanMetric does not support out-of-order output images
|
38 |
+
# for the time being. batch_shapes_cfg does not support.
|
39 |
+
batch_shapes_cfg=None))
|
40 |
+
test_dataloader = val_dataloader
|
41 |
+
|
42 |
+
val_evaluator = dict(
|
43 |
+
_delete_=True,
|
44 |
+
type='mmdet.CrowdHumanMetric',
|
45 |
+
ann_file=data_root + 'annotation_val.odgt',
|
46 |
+
metric=['AP', 'MR', 'JI'])
|
47 |
+
test_evaluator = val_evaluator
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/metafile.yml
ADDED
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Collections:
|
2 |
+
- Name: YOLOv5
|
3 |
+
Metadata:
|
4 |
+
Training Data: COCO
|
5 |
+
Training Techniques:
|
6 |
+
- SGD with Nesterov
|
7 |
+
- Weight Decay
|
8 |
+
- AMP
|
9 |
+
- Synchronize BN
|
10 |
+
Training Resources: 8x A100 GPUs
|
11 |
+
Architecture:
|
12 |
+
- CSPDarkNet
|
13 |
+
- PAFPN
|
14 |
+
README: configs/yolov5/README.md
|
15 |
+
Code:
|
16 |
+
URL: https://github.com/open-mmlab/mmyolo/blob/v0.1.0/mmyolo/models/detectors/yolo_detector.py#L12
|
17 |
+
Version: v0.1.0
|
18 |
+
- Name: YOLOv5_VOC
|
19 |
+
Metadata:
|
20 |
+
Training Data: VOC
|
21 |
+
Training Techniques:
|
22 |
+
- SGD with Nesterov
|
23 |
+
- Weight Decay
|
24 |
+
- AMP
|
25 |
+
Training Resources: 1x A100 GPU
|
26 |
+
Architecture:
|
27 |
+
- CSPDarkNet
|
28 |
+
- PAFPN
|
29 |
+
README: configs/yolov5/README.md
|
30 |
+
Code:
|
31 |
+
URL: https://github.com/open-mmlab/mmyolo/blob/v0.1.0/mmyolo/models/detectors/yolo_detector.py#L12
|
32 |
+
Version: v0.1.0
|
33 |
+
|
34 |
+
Models:
|
35 |
+
- Name: yolov5_n-v61_syncbn_fast_8xb16-300e_coco
|
36 |
+
In Collection: YOLOv5
|
37 |
+
Config: configs/yolov5/yolov5_n-v61_syncbn_fast_8xb16-300e_coco.py
|
38 |
+
Metadata:
|
39 |
+
Training Memory (GB): 1.5
|
40 |
+
Epochs: 300
|
41 |
+
Results:
|
42 |
+
- Task: Object Detection
|
43 |
+
Dataset: COCO
|
44 |
+
Metrics:
|
45 |
+
box AP: 28.0
|
46 |
+
Weights: https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_n-v61_syncbn_fast_8xb16-300e_coco/yolov5_n-v61_syncbn_fast_8xb16-300e_coco_20220919_090739-b804c1ad.pth
|
47 |
+
- Name: yolov5_s-v61_syncbn_fast_8xb16-300e_coco
|
48 |
+
In Collection: YOLOv5
|
49 |
+
Config: configs/yolov5/yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py
|
50 |
+
Metadata:
|
51 |
+
Training Memory (GB): 2.7
|
52 |
+
Epochs: 300
|
53 |
+
Results:
|
54 |
+
- Task: Object Detection
|
55 |
+
Dataset: COCO
|
56 |
+
Metrics:
|
57 |
+
box AP: 37.7
|
58 |
+
Weights: https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_s-v61_syncbn_fast_8xb16-300e_coco/yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700-86e02187.pth
|
59 |
+
- Name: yolov5_m-v61_syncbn_fast_8xb16-300e_coco
|
60 |
+
In Collection: YOLOv5
|
61 |
+
Config: configs/yolov5/yolov5_m-v61_syncbn_fast_8xb16-300e_coco.py
|
62 |
+
Metadata:
|
63 |
+
Training Memory (GB): 5.0
|
64 |
+
Epochs: 300
|
65 |
+
Results:
|
66 |
+
- Task: Object Detection
|
67 |
+
Dataset: COCO
|
68 |
+
Metrics:
|
69 |
+
box AP: 45.3
|
70 |
+
Weights: https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_m-v61_syncbn_fast_8xb16-300e_coco/yolov5_m-v61_syncbn_fast_8xb16-300e_coco_20220917_204944-516a710f.pth
|
71 |
+
- Name: yolov5_l-v61_syncbn_fast_8xb16-300e_coco
|
72 |
+
In Collection: YOLOv5
|
73 |
+
Config: configs/yolov5/yolov5_l-v61_syncbn_fast_8xb16-300e_coco.py
|
74 |
+
Metadata:
|
75 |
+
Training Memory (GB): 8.1
|
76 |
+
Epochs: 300
|
77 |
+
Results:
|
78 |
+
- Task: Object Detection
|
79 |
+
Dataset: COCO
|
80 |
+
Metrics:
|
81 |
+
box AP: 48.8
|
82 |
+
Weights: https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_l-v61_syncbn_fast_8xb16-300e_coco/yolov5_l-v61_syncbn_fast_8xb16-300e_coco_20220917_031007-096ef0eb.pth
|
83 |
+
- Name: yolov5_n-p6-v62_syncbn_fast_8xb16-300e_coco
|
84 |
+
In Collection: YOLOv5
|
85 |
+
Config: configs/yolov5/yolov5_n-p6-v62_syncbn_fast_8xb16-300e_coco.py
|
86 |
+
Metadata:
|
87 |
+
Training Memory (GB): 5.8
|
88 |
+
Epochs: 300
|
89 |
+
Results:
|
90 |
+
- Task: Object Detection
|
91 |
+
Dataset: COCO
|
92 |
+
Metrics:
|
93 |
+
box AP: 35.9
|
94 |
+
Weights: https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_n-p6-v62_syncbn_fast_8xb16-300e_coco/yolov5_n-p6-v62_syncbn_fast_8xb16-300e_coco_20221027_224705-d493c5f3.pth
|
95 |
+
- Name: yolov5_s-p6-v62_syncbn_fast_8xb16-300e_coco
|
96 |
+
In Collection: YOLOv5
|
97 |
+
Config: configs/yolov5/yolov5_s-p6-v62_syncbn_fast_8xb16-300e_coco.py
|
98 |
+
Metadata:
|
99 |
+
Training Memory (GB): 10.5
|
100 |
+
Epochs: 300
|
101 |
+
Results:
|
102 |
+
- Task: Object Detection
|
103 |
+
Dataset: COCO
|
104 |
+
Metrics:
|
105 |
+
box AP: 44.4
|
106 |
+
Weights: https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_s-p6-v62_syncbn_fast_8xb16-300e_coco/yolov5_s-p6-v62_syncbn_fast_8xb16-300e_coco_20221027_215044-58865c19.pth
|
107 |
+
- Name: yolov5_m-p6-v62_syncbn_fast_8xb16-300e_coco
|
108 |
+
In Collection: YOLOv5
|
109 |
+
Config: configs/yolov5/yolov5_m-p6-v62_syncbn_fast_8xb16-300e_coco.py
|
110 |
+
Metadata:
|
111 |
+
Training Memory (GB): 19.1
|
112 |
+
Epochs: 300
|
113 |
+
Results:
|
114 |
+
- Task: Object Detection
|
115 |
+
Dataset: COCO
|
116 |
+
Metrics:
|
117 |
+
box AP: 51.3
|
118 |
+
Weights: https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_m-p6-v62_syncbn_fast_8xb16-300e_coco/yolov5_m-p6-v62_syncbn_fast_8xb16-300e_coco_20221027_230453-49564d58.pth
|
119 |
+
- Name: yolov5_l-p6-v62_syncbn_fast_8xb16-300e_coco
|
120 |
+
In Collection: YOLOv5
|
121 |
+
Config: configs/yolov5/yolov5_l-p6-v62_syncbn_fast_8xb16-300e_coco.py
|
122 |
+
Metadata:
|
123 |
+
Training Memory (GB): 30.5
|
124 |
+
Epochs: 300
|
125 |
+
Results:
|
126 |
+
- Task: Object Detection
|
127 |
+
Dataset: COCO
|
128 |
+
Metrics:
|
129 |
+
box AP: 53.7
|
130 |
+
Weights: https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_l-p6-v62_syncbn_fast_8xb16-300e_coco/yolov5_l-p6-v62_syncbn_fast_8xb16-300e_coco_20221027_234308-7a2ba6bf.pth
|
131 |
+
- Name: yolov5_n-v61_fast_1xb64-50e_voc
|
132 |
+
In Collection: YOLOv5_VOC
|
133 |
+
Config: configs/yolov5/voc/yolov5_n-v61_fast_1xb64-50e_voc.py
|
134 |
+
Metadata:
|
135 |
+
Training Memory (GB): 3.5
|
136 |
+
Epochs: 50
|
137 |
+
Results:
|
138 |
+
- Task: Object Detection
|
139 |
+
Dataset: COCO
|
140 |
+
Metrics:
|
141 |
+
box AP: 51.2
|
142 |
+
Weights: https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_n-v61_fast_1xb64-50e_voc/yolov5_n-v61_fast_1xb64-50e_voc_20221017_234254-f1493430.pth
|
143 |
+
- Name: yolov5_s-v61_fast_1xb64-50e_voc
|
144 |
+
In Collection: YOLOv5_VOC
|
145 |
+
Config: configs/yolov5/voc/yolov5_s-v61_fast_1xb64-50e_voc.py
|
146 |
+
Metadata:
|
147 |
+
Training Memory (GB): 6.5
|
148 |
+
Epochs: 50
|
149 |
+
Results:
|
150 |
+
- Task: Object Detection
|
151 |
+
Dataset: COCO
|
152 |
+
Metrics:
|
153 |
+
box AP: 62.7
|
154 |
+
Weights: https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_s-v61_fast_1xb64-50e_voc/yolov5_s-v61_fast_1xb64-50e_voc_20221017_234156-0009b33e.pth
|
155 |
+
- Name: yolov5_m-v61_fast_1xb64-50e_voc
|
156 |
+
In Collection: YOLOv5_VOC
|
157 |
+
Config: configs/yolov5/voc/yolov5_m-v61_fast_1xb64-50e_voc.py
|
158 |
+
Metadata:
|
159 |
+
Training Memory (GB): 12.0
|
160 |
+
Epochs: 50
|
161 |
+
Results:
|
162 |
+
- Task: Object Detection
|
163 |
+
Dataset: COCO
|
164 |
+
Metrics:
|
165 |
+
box AP: 70.1
|
166 |
+
Weights: https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_m-v61_fast_1xb64-50e_voc/yolov5_m-v61_fast_1xb64-50e_voc_20221017_114138-815c143a.pth
|
167 |
+
- Name: yolov5_l-v61_fast_1xb32-50e_voc
|
168 |
+
In Collection: YOLOv5_VOC
|
169 |
+
Config: configs/yolov5/voc/yolov5_l-v61_fast_1xb32-50e_voc.py
|
170 |
+
Metadata:
|
171 |
+
Training Memory (GB): 10.0
|
172 |
+
Epochs: 50
|
173 |
+
Results:
|
174 |
+
- Task: Object Detection
|
175 |
+
Dataset: COCO
|
176 |
+
Metrics:
|
177 |
+
box AP: 73.1
|
178 |
+
Weights: https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_l-v61_fast_1xb32-50e_voc/yolov5_l-v61_fast_1xb32-50e_voc_20221017_045500-edc7e0d8.pth
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/voc/__init__.py
ADDED
File without changes
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/voc/yolov5_l-v61_fast_1xb32-50e_voc.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = './yolov5_s-v61_fast_1xb64-50e_voc.py'
|
2 |
+
|
3 |
+
deepen_factor = 1.0
|
4 |
+
widen_factor = 1.0
|
5 |
+
train_batch_size_per_gpu = 32
|
6 |
+
train_num_workers = 8
|
7 |
+
|
8 |
+
load_from = 'https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_l-v61_syncbn_fast_8xb16-300e_coco/yolov5_l-v61_syncbn_fast_8xb16-300e_coco_20220917_031007-096ef0eb.pth' # noqa
|
9 |
+
|
10 |
+
model = dict(
|
11 |
+
backbone=dict(
|
12 |
+
deepen_factor=deepen_factor,
|
13 |
+
widen_factor=widen_factor,
|
14 |
+
),
|
15 |
+
neck=dict(
|
16 |
+
deepen_factor=deepen_factor,
|
17 |
+
widen_factor=widen_factor,
|
18 |
+
),
|
19 |
+
bbox_head=dict(head_module=dict(widen_factor=widen_factor)))
|
20 |
+
|
21 |
+
train_dataloader = dict(
|
22 |
+
batch_size=train_batch_size_per_gpu, num_workers=train_num_workers)
|
23 |
+
|
24 |
+
optim_wrapper = dict(
|
25 |
+
optimizer=dict(batch_size_per_gpu=train_batch_size_per_gpu))
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/voc/yolov5_m-v61_fast_1xb64-50e_voc.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = './yolov5_s-v61_fast_1xb64-50e_voc.py'
|
2 |
+
|
3 |
+
deepen_factor = 0.67
|
4 |
+
widen_factor = 0.75
|
5 |
+
|
6 |
+
load_from = 'https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_m-v61_syncbn_fast_8xb16-300e_coco/yolov5_m-v61_syncbn_fast_8xb16-300e_coco_20220917_204944-516a710f.pth' # noqa
|
7 |
+
|
8 |
+
model = dict(
|
9 |
+
backbone=dict(
|
10 |
+
deepen_factor=deepen_factor,
|
11 |
+
widen_factor=widen_factor,
|
12 |
+
),
|
13 |
+
neck=dict(
|
14 |
+
deepen_factor=deepen_factor,
|
15 |
+
widen_factor=widen_factor,
|
16 |
+
),
|
17 |
+
bbox_head=dict(head_module=dict(widen_factor=widen_factor)))
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/voc/yolov5_n-v61_fast_1xb64-50e_voc.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = './yolov5_s-v61_fast_1xb64-50e_voc.py'
|
2 |
+
|
3 |
+
deepen_factor = 0.33
|
4 |
+
widen_factor = 0.25
|
5 |
+
|
6 |
+
load_from = 'https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_n-v61_syncbn_fast_8xb16-300e_coco/yolov5_n-v61_syncbn_fast_8xb16-300e_coco_20220919_090739-b804c1ad.pth' # noqa
|
7 |
+
|
8 |
+
model = dict(
|
9 |
+
backbone=dict(
|
10 |
+
deepen_factor=deepen_factor,
|
11 |
+
widen_factor=widen_factor,
|
12 |
+
),
|
13 |
+
neck=dict(
|
14 |
+
deepen_factor=deepen_factor,
|
15 |
+
widen_factor=widen_factor,
|
16 |
+
),
|
17 |
+
bbox_head=dict(head_module=dict(widen_factor=widen_factor)))
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/voc/yolov5_s-v61_fast_1xb64-50e_voc.py
ADDED
@@ -0,0 +1,270 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = '../yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py'
|
2 |
+
|
3 |
+
# dataset settings
|
4 |
+
data_root = 'data/VOCdevkit/'
|
5 |
+
dataset_type = 'YOLOv5VOCDataset'
|
6 |
+
|
7 |
+
# parameters that often need to be modified
|
8 |
+
num_classes = 20
|
9 |
+
img_scale = (512, 512) # width, height
|
10 |
+
max_epochs = 50
|
11 |
+
train_batch_size_per_gpu = 64
|
12 |
+
train_num_workers = 8
|
13 |
+
val_batch_size_per_gpu = 1
|
14 |
+
val_num_workers = 2
|
15 |
+
|
16 |
+
# persistent_workers must be False if num_workers is 0.
|
17 |
+
persistent_workers = True
|
18 |
+
|
19 |
+
lr_factor = 0.15135
|
20 |
+
affine_scale = 0.75544
|
21 |
+
|
22 |
+
# only on Val
|
23 |
+
batch_shapes_cfg = dict(img_size=img_scale[0])
|
24 |
+
|
25 |
+
anchors = [[(26, 44), (67, 57), (61, 130)], [(121, 118), (120, 239),
|
26 |
+
(206, 182)],
|
27 |
+
[(376, 161), (234, 324), (428, 322)]]
|
28 |
+
num_det_layers = 3
|
29 |
+
|
30 |
+
load_from = 'https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_s-v61_syncbn_fast_8xb16-300e_coco/yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700-86e02187.pth' # noqa
|
31 |
+
|
32 |
+
tta_img_scales = [img_scale, (416, 416), (640, 640)]
|
33 |
+
|
34 |
+
# Hyperparameter reference from:
|
35 |
+
# https://github.com/ultralytics/yolov5/blob/master/data/hyps/hyp.VOC.yaml
|
36 |
+
model = dict(
|
37 |
+
bbox_head=dict(
|
38 |
+
head_module=dict(num_classes=num_classes),
|
39 |
+
prior_generator=dict(base_sizes=anchors),
|
40 |
+
loss_cls=dict(
|
41 |
+
loss_weight=0.21638 * (num_classes / 80 * 3 / num_det_layers),
|
42 |
+
class_weight=0.5),
|
43 |
+
loss_bbox=dict(loss_weight=0.02 * (3 / num_det_layers)),
|
44 |
+
loss_obj=dict(
|
45 |
+
loss_weight=0.51728 *
|
46 |
+
((img_scale[0] / 640)**2 * 3 / num_det_layers),
|
47 |
+
class_weight=0.67198),
|
48 |
+
# Different from COCO
|
49 |
+
prior_match_thr=3.3744),
|
50 |
+
test_cfg=dict(nms=dict(iou_threshold=0.6)))
|
51 |
+
|
52 |
+
albu_train_transforms = _base_.albu_train_transforms
|
53 |
+
pre_transform = _base_.pre_transform
|
54 |
+
|
55 |
+
with_mosiac_pipeline = [
|
56 |
+
dict(
|
57 |
+
type='Mosaic',
|
58 |
+
img_scale=img_scale,
|
59 |
+
pad_val=114.0,
|
60 |
+
pre_transform=pre_transform),
|
61 |
+
dict(
|
62 |
+
type='YOLOv5RandomAffine',
|
63 |
+
max_rotate_degree=0.0,
|
64 |
+
max_translate_ratio=0.04591,
|
65 |
+
max_shear_degree=0.0,
|
66 |
+
scaling_ratio_range=(1 - affine_scale, 1 + affine_scale),
|
67 |
+
# img_scale is (width, height)
|
68 |
+
border=(-img_scale[0] // 2, -img_scale[1] // 2),
|
69 |
+
border_val=(114, 114, 114)),
|
70 |
+
dict(
|
71 |
+
type='YOLOv5MixUp',
|
72 |
+
prob=0.04266,
|
73 |
+
pre_transform=[
|
74 |
+
*pre_transform,
|
75 |
+
dict(
|
76 |
+
type='Mosaic',
|
77 |
+
img_scale=img_scale,
|
78 |
+
pad_val=114.0,
|
79 |
+
pre_transform=pre_transform),
|
80 |
+
dict(
|
81 |
+
type='YOLOv5RandomAffine',
|
82 |
+
max_rotate_degree=0.0,
|
83 |
+
max_translate_ratio=0.04591,
|
84 |
+
max_shear_degree=0.0,
|
85 |
+
scaling_ratio_range=(1 - affine_scale, 1 + affine_scale),
|
86 |
+
# img_scale is (width, height)
|
87 |
+
border=(-img_scale[0] // 2, -img_scale[1] // 2),
|
88 |
+
border_val=(114, 114, 114))
|
89 |
+
])
|
90 |
+
]
|
91 |
+
|
92 |
+
without_mosaic_pipeline = [
|
93 |
+
dict(
|
94 |
+
type='YOLOv5RandomAffine',
|
95 |
+
max_rotate_degree=0.0,
|
96 |
+
max_translate_ratio=0.04591,
|
97 |
+
max_shear_degree=0.0,
|
98 |
+
scaling_ratio_range=(1 - affine_scale, 1 + affine_scale),
|
99 |
+
border=(0, 0),
|
100 |
+
border_val=(114, 114, 114)),
|
101 |
+
dict(
|
102 |
+
type='LetterResize',
|
103 |
+
scale=img_scale,
|
104 |
+
allow_scale_up=True,
|
105 |
+
pad_val=dict(img=114))
|
106 |
+
]
|
107 |
+
|
108 |
+
# Because the border parameter is inconsistent when
|
109 |
+
# using mosaic or not, `RandomChoice` is used here.
|
110 |
+
randchoice_mosaic_pipeline = dict(
|
111 |
+
type='RandomChoice',
|
112 |
+
transforms=[with_mosiac_pipeline, without_mosaic_pipeline],
|
113 |
+
prob=[0.85834, 0.14166])
|
114 |
+
|
115 |
+
train_pipeline = [
|
116 |
+
*pre_transform, randchoice_mosaic_pipeline,
|
117 |
+
dict(
|
118 |
+
type='mmdet.Albu',
|
119 |
+
transforms=albu_train_transforms,
|
120 |
+
bbox_params=dict(
|
121 |
+
type='BboxParams',
|
122 |
+
format='pascal_voc',
|
123 |
+
label_fields=['gt_bboxes_labels', 'gt_ignore_flags']),
|
124 |
+
keymap={
|
125 |
+
'img': 'image',
|
126 |
+
'gt_bboxes': 'bboxes'
|
127 |
+
}),
|
128 |
+
dict(
|
129 |
+
type='YOLOv5HSVRandomAug',
|
130 |
+
hue_delta=0.01041,
|
131 |
+
saturation_delta=0.54703,
|
132 |
+
value_delta=0.27739),
|
133 |
+
dict(type='mmdet.RandomFlip', prob=0.5),
|
134 |
+
dict(
|
135 |
+
type='mmdet.PackDetInputs',
|
136 |
+
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'flip',
|
137 |
+
'flip_direction'))
|
138 |
+
]
|
139 |
+
|
140 |
+
train_dataloader = dict(
|
141 |
+
_delete_=True,
|
142 |
+
batch_size=train_batch_size_per_gpu,
|
143 |
+
num_workers=train_num_workers,
|
144 |
+
persistent_workers=persistent_workers,
|
145 |
+
pin_memory=True,
|
146 |
+
sampler=dict(type='DefaultSampler', shuffle=True),
|
147 |
+
dataset=dict(
|
148 |
+
type='ConcatDataset',
|
149 |
+
datasets=[
|
150 |
+
dict(
|
151 |
+
type=dataset_type,
|
152 |
+
data_root=data_root,
|
153 |
+
ann_file='VOC2007/ImageSets/Main/trainval.txt',
|
154 |
+
data_prefix=dict(sub_data_root='VOC2007/'),
|
155 |
+
filter_cfg=dict(filter_empty_gt=False, min_size=32),
|
156 |
+
pipeline=train_pipeline),
|
157 |
+
dict(
|
158 |
+
type=dataset_type,
|
159 |
+
data_root=data_root,
|
160 |
+
ann_file='VOC2012/ImageSets/Main/trainval.txt',
|
161 |
+
data_prefix=dict(sub_data_root='VOC2012/'),
|
162 |
+
filter_cfg=dict(filter_empty_gt=False, min_size=32),
|
163 |
+
pipeline=train_pipeline)
|
164 |
+
],
|
165 |
+
# Use ignore_keys to avoid judging metainfo is
|
166 |
+
# not equal in `ConcatDataset`.
|
167 |
+
ignore_keys='dataset_type'),
|
168 |
+
collate_fn=dict(type='yolov5_collate'))
|
169 |
+
|
170 |
+
test_pipeline = [
|
171 |
+
dict(type='LoadImageFromFile', file_client_args=_base_.file_client_args),
|
172 |
+
dict(type='YOLOv5KeepRatioResize', scale=img_scale),
|
173 |
+
dict(
|
174 |
+
type='LetterResize',
|
175 |
+
scale=img_scale,
|
176 |
+
allow_scale_up=False,
|
177 |
+
pad_val=dict(img=114)),
|
178 |
+
dict(type='LoadAnnotations', with_bbox=True, _scope_='mmdet'),
|
179 |
+
dict(
|
180 |
+
type='mmdet.PackDetInputs',
|
181 |
+
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
|
182 |
+
'scale_factor', 'pad_param'))
|
183 |
+
]
|
184 |
+
|
185 |
+
val_dataloader = dict(
|
186 |
+
batch_size=val_batch_size_per_gpu,
|
187 |
+
num_workers=val_num_workers,
|
188 |
+
persistent_workers=persistent_workers,
|
189 |
+
pin_memory=True,
|
190 |
+
drop_last=False,
|
191 |
+
sampler=dict(type='DefaultSampler', shuffle=False),
|
192 |
+
dataset=dict(
|
193 |
+
type=dataset_type,
|
194 |
+
data_root=data_root,
|
195 |
+
ann_file='VOC2007/ImageSets/Main/test.txt',
|
196 |
+
data_prefix=dict(sub_data_root='VOC2007/'),
|
197 |
+
test_mode=True,
|
198 |
+
pipeline=test_pipeline,
|
199 |
+
batch_shapes_cfg=batch_shapes_cfg))
|
200 |
+
|
201 |
+
test_dataloader = val_dataloader
|
202 |
+
|
203 |
+
param_scheduler = None
|
204 |
+
optim_wrapper = dict(
|
205 |
+
optimizer=dict(
|
206 |
+
lr=0.00334,
|
207 |
+
momentum=0.74832,
|
208 |
+
weight_decay=0.00025,
|
209 |
+
batch_size_per_gpu=train_batch_size_per_gpu))
|
210 |
+
|
211 |
+
default_hooks = dict(
|
212 |
+
param_scheduler=dict(
|
213 |
+
lr_factor=lr_factor,
|
214 |
+
max_epochs=max_epochs,
|
215 |
+
warmup_epochs=3.3835,
|
216 |
+
warmup_momentum=0.59462,
|
217 |
+
warmup_bias_lr=0.18657))
|
218 |
+
|
219 |
+
custom_hooks = [
|
220 |
+
dict(
|
221 |
+
type='EMAHook',
|
222 |
+
ema_type='ExpMomentumEMA',
|
223 |
+
momentum=0.0001,
|
224 |
+
update_buffers=True,
|
225 |
+
# To load COCO pretrained model, need to set `strict_load=False`
|
226 |
+
strict_load=False,
|
227 |
+
priority=49)
|
228 |
+
]
|
229 |
+
|
230 |
+
# TODO: Support using coco metric in voc dataset
|
231 |
+
val_evaluator = dict(
|
232 |
+
_delete_=True, type='mmdet.VOCMetric', metric='mAP', eval_mode='area')
|
233 |
+
|
234 |
+
test_evaluator = val_evaluator
|
235 |
+
|
236 |
+
train_cfg = dict(max_epochs=max_epochs)
|
237 |
+
|
238 |
+
# Config for Test Time Augmentation. (TTA)
|
239 |
+
_multiscale_resize_transforms = [
|
240 |
+
dict(
|
241 |
+
type='Compose',
|
242 |
+
transforms=[
|
243 |
+
dict(type='YOLOv5KeepRatioResize', scale=s),
|
244 |
+
dict(
|
245 |
+
type='LetterResize',
|
246 |
+
scale=s,
|
247 |
+
allow_scale_up=False,
|
248 |
+
pad_val=dict(img=114))
|
249 |
+
]) for s in tta_img_scales
|
250 |
+
]
|
251 |
+
|
252 |
+
tta_pipeline = [
|
253 |
+
dict(type='LoadImageFromFile', file_client_args=_base_.file_client_args),
|
254 |
+
dict(
|
255 |
+
type='TestTimeAug',
|
256 |
+
transforms=[
|
257 |
+
_multiscale_resize_transforms,
|
258 |
+
[
|
259 |
+
dict(type='mmdet.RandomFlip', prob=1.),
|
260 |
+
dict(type='mmdet.RandomFlip', prob=0.)
|
261 |
+
], [dict(type='mmdet.LoadAnnotations', with_bbox=True)],
|
262 |
+
[
|
263 |
+
dict(
|
264 |
+
type='mmdet.PackDetInputs',
|
265 |
+
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
|
266 |
+
'scale_factor', 'pad_param', 'flip',
|
267 |
+
'flip_direction'))
|
268 |
+
]
|
269 |
+
])
|
270 |
+
]
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/voc/yolov5_x-v61_fast_1xb32-50e_voc.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = './yolov5_s-v61_fast_1xb64-50e_voc.py'
|
2 |
+
|
3 |
+
deepen_factor = 1.33
|
4 |
+
widen_factor = 1.25
|
5 |
+
train_batch_size_per_gpu = 32
|
6 |
+
train_num_workers = 8
|
7 |
+
|
8 |
+
# TODO: need to add pretrained_model
|
9 |
+
load_from = None
|
10 |
+
|
11 |
+
model = dict(
|
12 |
+
backbone=dict(
|
13 |
+
deepen_factor=deepen_factor,
|
14 |
+
widen_factor=widen_factor,
|
15 |
+
),
|
16 |
+
neck=dict(
|
17 |
+
deepen_factor=deepen_factor,
|
18 |
+
widen_factor=widen_factor,
|
19 |
+
),
|
20 |
+
bbox_head=dict(head_module=dict(widen_factor=widen_factor)))
|
21 |
+
|
22 |
+
train_dataloader = dict(
|
23 |
+
batch_size=train_batch_size_per_gpu, num_workers=train_num_workers)
|
24 |
+
|
25 |
+
optim_wrapper = dict(
|
26 |
+
optimizer=dict(batch_size_per_gpu=train_batch_size_per_gpu))
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_l-p6-v62_syncbn_fast_8xb16-300e_coco.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = './yolov5_m-p6-v62_syncbn_fast_8xb16-300e_coco.py'
|
2 |
+
|
3 |
+
deepen_factor = 1.0
|
4 |
+
widen_factor = 1.0
|
5 |
+
|
6 |
+
model = dict(
|
7 |
+
backbone=dict(
|
8 |
+
deepen_factor=deepen_factor,
|
9 |
+
widen_factor=widen_factor,
|
10 |
+
),
|
11 |
+
neck=dict(
|
12 |
+
deepen_factor=deepen_factor,
|
13 |
+
widen_factor=widen_factor,
|
14 |
+
),
|
15 |
+
bbox_head=dict(head_module=dict(widen_factor=widen_factor)))
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_l-v61_syncbn_fast_8xb16-300e_coco.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = './yolov5_m-v61_syncbn_fast_8xb16-300e_coco.py'
|
2 |
+
|
3 |
+
deepen_factor = 1.0
|
4 |
+
widen_factor = 1.0
|
5 |
+
|
6 |
+
model = dict(
|
7 |
+
backbone=dict(
|
8 |
+
deepen_factor=deepen_factor,
|
9 |
+
widen_factor=widen_factor,
|
10 |
+
),
|
11 |
+
neck=dict(
|
12 |
+
deepen_factor=deepen_factor,
|
13 |
+
widen_factor=widen_factor,
|
14 |
+
),
|
15 |
+
bbox_head=dict(head_module=dict(widen_factor=widen_factor)))
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_m-p6-v62_syncbn_fast_8xb16-300e_coco.py
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = './yolov5_s-p6-v62_syncbn_fast_8xb16-300e_coco.py'
|
2 |
+
|
3 |
+
# ========================modified parameters======================
|
4 |
+
deepen_factor = 0.67
|
5 |
+
widen_factor = 0.75
|
6 |
+
lr_factor = 0.1
|
7 |
+
affine_scale = 0.9
|
8 |
+
loss_cls_weight = 0.3
|
9 |
+
loss_obj_weight = 0.7
|
10 |
+
mixup_prob = 0.1
|
11 |
+
|
12 |
+
# =======================Unmodified in most cases==================
|
13 |
+
num_classes = _base_.num_classes
|
14 |
+
num_det_layers = _base_.num_det_layers
|
15 |
+
img_scale = _base_.img_scale
|
16 |
+
|
17 |
+
model = dict(
|
18 |
+
backbone=dict(
|
19 |
+
deepen_factor=deepen_factor,
|
20 |
+
widen_factor=widen_factor,
|
21 |
+
),
|
22 |
+
neck=dict(
|
23 |
+
deepen_factor=deepen_factor,
|
24 |
+
widen_factor=widen_factor,
|
25 |
+
),
|
26 |
+
bbox_head=dict(
|
27 |
+
head_module=dict(widen_factor=widen_factor),
|
28 |
+
loss_cls=dict(loss_weight=loss_cls_weight *
|
29 |
+
(num_classes / 80 * 3 / num_det_layers)),
|
30 |
+
loss_obj=dict(loss_weight=loss_obj_weight *
|
31 |
+
((img_scale[0] / 640)**2 * 3 / num_det_layers))))
|
32 |
+
|
33 |
+
pre_transform = _base_.pre_transform
|
34 |
+
albu_train_transforms = _base_.albu_train_transforms
|
35 |
+
|
36 |
+
mosaic_affine_pipeline = [
|
37 |
+
dict(
|
38 |
+
type='Mosaic',
|
39 |
+
img_scale=img_scale,
|
40 |
+
pad_val=114.0,
|
41 |
+
pre_transform=pre_transform),
|
42 |
+
dict(
|
43 |
+
type='YOLOv5RandomAffine',
|
44 |
+
max_rotate_degree=0.0,
|
45 |
+
max_shear_degree=0.0,
|
46 |
+
scaling_ratio_range=(1 - affine_scale, 1 + affine_scale),
|
47 |
+
# img_scale is (width, height)
|
48 |
+
border=(-img_scale[0] // 2, -img_scale[1] // 2),
|
49 |
+
border_val=(114, 114, 114))
|
50 |
+
]
|
51 |
+
|
52 |
+
# enable mixup
|
53 |
+
train_pipeline = [
|
54 |
+
*pre_transform, *mosaic_affine_pipeline,
|
55 |
+
dict(
|
56 |
+
type='YOLOv5MixUp',
|
57 |
+
prob=mixup_prob,
|
58 |
+
pre_transform=[*pre_transform, *mosaic_affine_pipeline]),
|
59 |
+
dict(
|
60 |
+
type='mmdet.Albu',
|
61 |
+
transforms=albu_train_transforms,
|
62 |
+
bbox_params=dict(
|
63 |
+
type='BboxParams',
|
64 |
+
format='pascal_voc',
|
65 |
+
label_fields=['gt_bboxes_labels', 'gt_ignore_flags']),
|
66 |
+
keymap={
|
67 |
+
'img': 'image',
|
68 |
+
'gt_bboxes': 'bboxes'
|
69 |
+
}),
|
70 |
+
dict(type='YOLOv5HSVRandomAug'),
|
71 |
+
dict(type='mmdet.RandomFlip', prob=0.5),
|
72 |
+
dict(
|
73 |
+
type='mmdet.PackDetInputs',
|
74 |
+
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'flip',
|
75 |
+
'flip_direction'))
|
76 |
+
]
|
77 |
+
|
78 |
+
train_dataloader = dict(dataset=dict(pipeline=train_pipeline))
|
79 |
+
default_hooks = dict(param_scheduler=dict(lr_factor=lr_factor))
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_m-v61_syncbn_fast_8xb16-300e_coco.py
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = './yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py'
|
2 |
+
|
3 |
+
# ========================modified parameters======================
|
4 |
+
deepen_factor = 0.67
|
5 |
+
widen_factor = 0.75
|
6 |
+
lr_factor = 0.1
|
7 |
+
affine_scale = 0.9
|
8 |
+
loss_cls_weight = 0.3
|
9 |
+
loss_obj_weight = 0.7
|
10 |
+
mixup_prob = 0.1
|
11 |
+
|
12 |
+
# =======================Unmodified in most cases==================
|
13 |
+
num_classes = _base_.num_classes
|
14 |
+
num_det_layers = _base_.num_det_layers
|
15 |
+
img_scale = _base_.img_scale
|
16 |
+
|
17 |
+
model = dict(
|
18 |
+
backbone=dict(
|
19 |
+
deepen_factor=deepen_factor,
|
20 |
+
widen_factor=widen_factor,
|
21 |
+
),
|
22 |
+
neck=dict(
|
23 |
+
deepen_factor=deepen_factor,
|
24 |
+
widen_factor=widen_factor,
|
25 |
+
),
|
26 |
+
bbox_head=dict(
|
27 |
+
head_module=dict(widen_factor=widen_factor),
|
28 |
+
loss_cls=dict(loss_weight=loss_cls_weight *
|
29 |
+
(num_classes / 80 * 3 / num_det_layers)),
|
30 |
+
loss_obj=dict(loss_weight=loss_obj_weight *
|
31 |
+
((img_scale[0] / 640)**2 * 3 / num_det_layers))))
|
32 |
+
|
33 |
+
pre_transform = _base_.pre_transform
|
34 |
+
albu_train_transforms = _base_.albu_train_transforms
|
35 |
+
|
36 |
+
mosaic_affine_pipeline = [
|
37 |
+
dict(
|
38 |
+
type='Mosaic',
|
39 |
+
img_scale=img_scale,
|
40 |
+
pad_val=114.0,
|
41 |
+
pre_transform=pre_transform),
|
42 |
+
dict(
|
43 |
+
type='YOLOv5RandomAffine',
|
44 |
+
max_rotate_degree=0.0,
|
45 |
+
max_shear_degree=0.0,
|
46 |
+
scaling_ratio_range=(1 - affine_scale, 1 + affine_scale),
|
47 |
+
# img_scale is (width, height)
|
48 |
+
border=(-img_scale[0] // 2, -img_scale[1] // 2),
|
49 |
+
border_val=(114, 114, 114))
|
50 |
+
]
|
51 |
+
|
52 |
+
# enable mixup
|
53 |
+
train_pipeline = [
|
54 |
+
*pre_transform, *mosaic_affine_pipeline,
|
55 |
+
dict(
|
56 |
+
type='YOLOv5MixUp',
|
57 |
+
prob=mixup_prob,
|
58 |
+
pre_transform=[*pre_transform, *mosaic_affine_pipeline]),
|
59 |
+
dict(
|
60 |
+
type='mmdet.Albu',
|
61 |
+
transforms=albu_train_transforms,
|
62 |
+
bbox_params=dict(
|
63 |
+
type='BboxParams',
|
64 |
+
format='pascal_voc',
|
65 |
+
label_fields=['gt_bboxes_labels', 'gt_ignore_flags']),
|
66 |
+
keymap={
|
67 |
+
'img': 'image',
|
68 |
+
'gt_bboxes': 'bboxes'
|
69 |
+
}),
|
70 |
+
dict(type='YOLOv5HSVRandomAug'),
|
71 |
+
dict(type='mmdet.RandomFlip', prob=0.5),
|
72 |
+
dict(
|
73 |
+
type='mmdet.PackDetInputs',
|
74 |
+
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'flip',
|
75 |
+
'flip_direction'))
|
76 |
+
]
|
77 |
+
|
78 |
+
train_dataloader = dict(dataset=dict(pipeline=train_pipeline))
|
79 |
+
default_hooks = dict(param_scheduler=dict(lr_factor=lr_factor))
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_n-p6-v62_syncbn_fast_8xb16-300e_coco.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = 'yolov5_s-p6-v62_syncbn_fast_8xb16-300e_coco.py'
|
2 |
+
|
3 |
+
deepen_factor = 0.33
|
4 |
+
widen_factor = 0.25
|
5 |
+
|
6 |
+
model = dict(
|
7 |
+
backbone=dict(
|
8 |
+
deepen_factor=deepen_factor,
|
9 |
+
widen_factor=widen_factor,
|
10 |
+
),
|
11 |
+
neck=dict(
|
12 |
+
deepen_factor=deepen_factor,
|
13 |
+
widen_factor=widen_factor,
|
14 |
+
),
|
15 |
+
bbox_head=dict(head_module=dict(widen_factor=widen_factor)))
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_n-v61_syncbn_fast_8xb16-300e_coco.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = './yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py'
|
2 |
+
|
3 |
+
deepen_factor = 0.33
|
4 |
+
widen_factor = 0.25
|
5 |
+
|
6 |
+
model = dict(
|
7 |
+
backbone=dict(
|
8 |
+
deepen_factor=deepen_factor,
|
9 |
+
widen_factor=widen_factor,
|
10 |
+
),
|
11 |
+
neck=dict(
|
12 |
+
deepen_factor=deepen_factor,
|
13 |
+
widen_factor=widen_factor,
|
14 |
+
),
|
15 |
+
bbox_head=dict(head_module=dict(widen_factor=widen_factor)))
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_s-p6-v62_syncbn_fast_8xb16-300e_coco.py
ADDED
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = 'yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py'
|
2 |
+
|
3 |
+
# ========================modified parameters======================
|
4 |
+
img_scale = (1280, 1280) # width, height
|
5 |
+
num_classes = 80 # Number of classes for classification
|
6 |
+
# Config of batch shapes. Only on val.
|
7 |
+
# It means not used if batch_shapes_cfg is None.
|
8 |
+
batch_shapes_cfg = dict(
|
9 |
+
img_size=img_scale[0],
|
10 |
+
# The image scale of padding should be divided by pad_size_divisor
|
11 |
+
size_divisor=64)
|
12 |
+
# Basic size of multi-scale prior box
|
13 |
+
anchors = [
|
14 |
+
[(19, 27), (44, 40), (38, 94)], # P3/8
|
15 |
+
[(96, 68), (86, 152), (180, 137)], # P4/16
|
16 |
+
[(140, 301), (303, 264), (238, 542)], # P5/32
|
17 |
+
[(436, 615), (739, 380), (925, 792)] # P6/64
|
18 |
+
]
|
19 |
+
# Strides of multi-scale prior box
|
20 |
+
strides = [8, 16, 32, 64]
|
21 |
+
num_det_layers = 4 # The number of model output scales
|
22 |
+
loss_cls_weight = 0.5
|
23 |
+
loss_bbox_weight = 0.05
|
24 |
+
loss_obj_weight = 1.0
|
25 |
+
# The obj loss weights of the three output layers
|
26 |
+
obj_level_weights = [4.0, 1.0, 0.25, 0.06]
|
27 |
+
affine_scale = 0.5 # YOLOv5RandomAffine scaling ratio
|
28 |
+
|
29 |
+
tta_img_scales = [(1280, 1280), (1024, 1024), (1536, 1536)]
|
30 |
+
# =======================Unmodified in most cases==================
|
31 |
+
model = dict(
|
32 |
+
backbone=dict(arch='P6', out_indices=(2, 3, 4, 5)),
|
33 |
+
neck=dict(
|
34 |
+
in_channels=[256, 512, 768, 1024], out_channels=[256, 512, 768, 1024]),
|
35 |
+
bbox_head=dict(
|
36 |
+
head_module=dict(
|
37 |
+
in_channels=[256, 512, 768, 1024], featmap_strides=strides),
|
38 |
+
prior_generator=dict(base_sizes=anchors, strides=strides),
|
39 |
+
# scaled based on number of detection layers
|
40 |
+
loss_cls=dict(loss_weight=loss_cls_weight *
|
41 |
+
(num_classes / 80 * 3 / num_det_layers)),
|
42 |
+
loss_bbox=dict(loss_weight=loss_bbox_weight * (3 / num_det_layers)),
|
43 |
+
loss_obj=dict(loss_weight=loss_obj_weight *
|
44 |
+
((img_scale[0] / 640)**2 * 3 / num_det_layers)),
|
45 |
+
obj_level_weights=obj_level_weights))
|
46 |
+
|
47 |
+
pre_transform = _base_.pre_transform
|
48 |
+
albu_train_transforms = _base_.albu_train_transforms
|
49 |
+
|
50 |
+
train_pipeline = [
|
51 |
+
*pre_transform,
|
52 |
+
dict(
|
53 |
+
type='Mosaic',
|
54 |
+
img_scale=img_scale,
|
55 |
+
pad_val=114.0,
|
56 |
+
pre_transform=pre_transform),
|
57 |
+
dict(
|
58 |
+
type='YOLOv5RandomAffine',
|
59 |
+
max_rotate_degree=0.0,
|
60 |
+
max_shear_degree=0.0,
|
61 |
+
scaling_ratio_range=(1 - affine_scale, 1 + affine_scale),
|
62 |
+
# img_scale is (width, height)
|
63 |
+
border=(-img_scale[0] // 2, -img_scale[1] // 2),
|
64 |
+
border_val=(114, 114, 114)),
|
65 |
+
dict(
|
66 |
+
type='mmdet.Albu',
|
67 |
+
transforms=albu_train_transforms,
|
68 |
+
bbox_params=dict(
|
69 |
+
type='BboxParams',
|
70 |
+
format='pascal_voc',
|
71 |
+
label_fields=['gt_bboxes_labels', 'gt_ignore_flags']),
|
72 |
+
keymap={
|
73 |
+
'img': 'image',
|
74 |
+
'gt_bboxes': 'bboxes'
|
75 |
+
}),
|
76 |
+
dict(type='YOLOv5HSVRandomAug'),
|
77 |
+
dict(type='mmdet.RandomFlip', prob=0.5),
|
78 |
+
dict(
|
79 |
+
type='mmdet.PackDetInputs',
|
80 |
+
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'flip',
|
81 |
+
'flip_direction'))
|
82 |
+
]
|
83 |
+
|
84 |
+
train_dataloader = dict(dataset=dict(pipeline=train_pipeline))
|
85 |
+
|
86 |
+
test_pipeline = [
|
87 |
+
dict(type='LoadImageFromFile', file_client_args=_base_.file_client_args),
|
88 |
+
dict(type='YOLOv5KeepRatioResize', scale=img_scale),
|
89 |
+
dict(
|
90 |
+
type='LetterResize',
|
91 |
+
scale=img_scale,
|
92 |
+
allow_scale_up=False,
|
93 |
+
pad_val=dict(img=114)),
|
94 |
+
dict(type='LoadAnnotations', with_bbox=True, _scope_='mmdet'),
|
95 |
+
dict(
|
96 |
+
type='mmdet.PackDetInputs',
|
97 |
+
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
|
98 |
+
'scale_factor', 'pad_param'))
|
99 |
+
]
|
100 |
+
|
101 |
+
val_dataloader = dict(
|
102 |
+
dataset=dict(pipeline=test_pipeline, batch_shapes_cfg=batch_shapes_cfg))
|
103 |
+
|
104 |
+
test_dataloader = val_dataloader
|
105 |
+
|
106 |
+
# Config for Test Time Augmentation. (TTA)
|
107 |
+
_multiscale_resize_transforms = [
|
108 |
+
dict(
|
109 |
+
type='Compose',
|
110 |
+
transforms=[
|
111 |
+
dict(type='YOLOv5KeepRatioResize', scale=s),
|
112 |
+
dict(
|
113 |
+
type='LetterResize',
|
114 |
+
scale=s,
|
115 |
+
allow_scale_up=False,
|
116 |
+
pad_val=dict(img=114))
|
117 |
+
]) for s in tta_img_scales
|
118 |
+
]
|
119 |
+
|
120 |
+
tta_pipeline = [
|
121 |
+
dict(type='LoadImageFromFile', file_client_args=_base_.file_client_args),
|
122 |
+
dict(
|
123 |
+
type='TestTimeAug',
|
124 |
+
transforms=[
|
125 |
+
_multiscale_resize_transforms,
|
126 |
+
[
|
127 |
+
dict(type='mmdet.RandomFlip', prob=1.),
|
128 |
+
dict(type='mmdet.RandomFlip', prob=0.)
|
129 |
+
], [dict(type='mmdet.LoadAnnotations', with_bbox=True)],
|
130 |
+
[
|
131 |
+
dict(
|
132 |
+
type='mmdet.PackDetInputs',
|
133 |
+
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
|
134 |
+
'scale_factor', 'pad_param', 'flip',
|
135 |
+
'flip_direction'))
|
136 |
+
]
|
137 |
+
])
|
138 |
+
]
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_s-v61_fast_1xb12-40e_608x352_cat.py
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = 'yolov5_s-v61_fast_1xb12-40e_cat.py'
|
2 |
+
|
3 |
+
# This configuration is used to provide non-square training examples
|
4 |
+
# Must be a multiple of 32
|
5 |
+
img_scale = (608, 352) # w h
|
6 |
+
|
7 |
+
anchors = [
|
8 |
+
[(65, 35), (159, 45), (119, 80)], # P3/8
|
9 |
+
[(215, 77), (224, 116), (170, 166)], # P4/16
|
10 |
+
[(376, 108), (339, 176), (483, 190)] # P5/32
|
11 |
+
]
|
12 |
+
|
13 |
+
# ===============================Unmodified in most cases====================
|
14 |
+
_base_.model.bbox_head.loss_obj.loss_weight = 1.0 * ((img_scale[1] / 640)**2)
|
15 |
+
_base_.model.bbox_head.prior_generator.base_sizes = anchors
|
16 |
+
|
17 |
+
train_pipeline = [
|
18 |
+
*_base_.pre_transform,
|
19 |
+
dict(
|
20 |
+
type='Mosaic',
|
21 |
+
img_scale=img_scale,
|
22 |
+
pad_val=114.0,
|
23 |
+
pre_transform=_base_.pre_transform),
|
24 |
+
dict(
|
25 |
+
type='YOLOv5RandomAffine',
|
26 |
+
max_rotate_degree=0.0,
|
27 |
+
max_shear_degree=0.0,
|
28 |
+
scaling_ratio_range=(1 - _base_.affine_scale, 1 + _base_.affine_scale),
|
29 |
+
# img_scale is (width, height)
|
30 |
+
border=(-img_scale[0] // 2, -img_scale[1] // 2),
|
31 |
+
border_val=(114, 114, 114)),
|
32 |
+
dict(
|
33 |
+
type='mmdet.Albu',
|
34 |
+
transforms=_base_.albu_train_transforms,
|
35 |
+
bbox_params=dict(
|
36 |
+
type='BboxParams',
|
37 |
+
format='pascal_voc',
|
38 |
+
label_fields=['gt_bboxes_labels', 'gt_ignore_flags']),
|
39 |
+
keymap={
|
40 |
+
'img': 'image',
|
41 |
+
'gt_bboxes': 'bboxes'
|
42 |
+
}),
|
43 |
+
dict(type='YOLOv5HSVRandomAug'),
|
44 |
+
dict(type='mmdet.RandomFlip', prob=0.5),
|
45 |
+
dict(
|
46 |
+
type='mmdet.PackDetInputs',
|
47 |
+
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'flip',
|
48 |
+
'flip_direction'))
|
49 |
+
]
|
50 |
+
|
51 |
+
_base_.train_dataloader.dataset.pipeline = train_pipeline
|
52 |
+
|
53 |
+
test_pipeline = [
|
54 |
+
dict(type='LoadImageFromFile', file_client_args=_base_.file_client_args),
|
55 |
+
dict(type='YOLOv5KeepRatioResize', scale=img_scale),
|
56 |
+
dict(
|
57 |
+
type='LetterResize',
|
58 |
+
scale=img_scale,
|
59 |
+
allow_scale_up=False,
|
60 |
+
pad_val=dict(img=114)),
|
61 |
+
dict(type='mmdet.LoadAnnotations', with_bbox=True),
|
62 |
+
dict(
|
63 |
+
type='mmdet.PackDetInputs',
|
64 |
+
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
|
65 |
+
'scale_factor', 'pad_param'))
|
66 |
+
]
|
67 |
+
|
68 |
+
val_dataloader = dict(
|
69 |
+
dataset=dict(pipeline=test_pipeline, batch_shapes_cfg=None))
|
70 |
+
test_dataloader = val_dataloader
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_s-v61_fast_1xb12-40e_cat.py
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = 'yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py'
|
2 |
+
|
3 |
+
data_root = './data/cat/'
|
4 |
+
class_name = ('cat', )
|
5 |
+
num_classes = len(class_name)
|
6 |
+
metainfo = dict(classes=class_name, palette=[(20, 220, 60)])
|
7 |
+
|
8 |
+
anchors = [
|
9 |
+
[(68, 69), (154, 91), (143, 162)], # P3/8
|
10 |
+
[(242, 160), (189, 287), (391, 207)], # P4/16
|
11 |
+
[(353, 337), (539, 341), (443, 432)] # P5/32
|
12 |
+
]
|
13 |
+
|
14 |
+
max_epochs = 40
|
15 |
+
train_batch_size_per_gpu = 12
|
16 |
+
train_num_workers = 4
|
17 |
+
|
18 |
+
load_from = 'https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_s-v61_syncbn_fast_8xb16-300e_coco/yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700-86e02187.pth' # noqa
|
19 |
+
|
20 |
+
model = dict(
|
21 |
+
backbone=dict(frozen_stages=4),
|
22 |
+
bbox_head=dict(
|
23 |
+
head_module=dict(num_classes=num_classes),
|
24 |
+
prior_generator=dict(base_sizes=anchors)))
|
25 |
+
|
26 |
+
train_dataloader = dict(
|
27 |
+
batch_size=train_batch_size_per_gpu,
|
28 |
+
num_workers=train_num_workers,
|
29 |
+
dataset=dict(
|
30 |
+
data_root=data_root,
|
31 |
+
metainfo=metainfo,
|
32 |
+
ann_file='annotations/trainval.json',
|
33 |
+
data_prefix=dict(img='images/')))
|
34 |
+
|
35 |
+
val_dataloader = dict(
|
36 |
+
dataset=dict(
|
37 |
+
metainfo=metainfo,
|
38 |
+
data_root=data_root,
|
39 |
+
ann_file='annotations/test.json',
|
40 |
+
data_prefix=dict(img='images/')))
|
41 |
+
|
42 |
+
test_dataloader = val_dataloader
|
43 |
+
|
44 |
+
_base_.optim_wrapper.optimizer.batch_size_per_gpu = train_batch_size_per_gpu
|
45 |
+
|
46 |
+
val_evaluator = dict(ann_file=data_root + 'annotations/test.json')
|
47 |
+
test_evaluator = val_evaluator
|
48 |
+
|
49 |
+
default_hooks = dict(
|
50 |
+
checkpoint=dict(interval=10, max_keep_ckpts=2, save_best='auto'),
|
51 |
+
# The warmup_mim_iter parameter is critical.
|
52 |
+
# The default value is 1000 which is not suitable for cat datasets.
|
53 |
+
param_scheduler=dict(max_epochs=max_epochs, warmup_mim_iter=10),
|
54 |
+
logger=dict(type='LoggerHook', interval=5))
|
55 |
+
train_cfg = dict(max_epochs=max_epochs, val_interval=10)
|
56 |
+
# visualizer = dict(vis_backends = [dict(type='LocalVisBackend'), dict(type='WandbVisBackend')]) # noqa
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_s-v61_syncbn-detect_8xb16-300e_coco.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = 'yolov5_s-v61_syncbn_8xb16-300e_coco.py'
|
2 |
+
|
3 |
+
test_pipeline = [
|
4 |
+
dict(type='LoadImageFromFile', file_client_args=_base_.file_client_args),
|
5 |
+
dict(
|
6 |
+
type='LetterResize',
|
7 |
+
scale=_base_.img_scale,
|
8 |
+
allow_scale_up=True,
|
9 |
+
use_mini_pad=True),
|
10 |
+
dict(type='LoadAnnotations', with_bbox=True),
|
11 |
+
dict(
|
12 |
+
type='mmdet.PackDetInputs',
|
13 |
+
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
|
14 |
+
'scale_factor', 'pad_param'))
|
15 |
+
]
|
16 |
+
|
17 |
+
val_dataloader = dict(
|
18 |
+
dataset=dict(pipeline=test_pipeline, batch_shapes_cfg=None))
|
19 |
+
test_dataloader = val_dataloader
|
20 |
+
|
21 |
+
model = dict(
|
22 |
+
test_cfg=dict(
|
23 |
+
multi_label=False, score_thr=0.25, nms=dict(iou_threshold=0.45)))
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_s-v61_syncbn_8xb16-300e_coco.py
ADDED
@@ -0,0 +1,292 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = ['../_base_/default_runtime.py', '../_base_/det_p5_tta.py']
|
2 |
+
|
3 |
+
# ========================Frequently modified parameters======================
|
4 |
+
# -----data related-----
|
5 |
+
data_root = 'data/coco/' # Root path of data
|
6 |
+
# Path of train annotation file
|
7 |
+
train_ann_file = 'annotations/instances_train2017.json'
|
8 |
+
train_data_prefix = 'train2017/' # Prefix of train image path
|
9 |
+
# Path of val annotation file
|
10 |
+
val_ann_file = 'annotations/instances_val2017.json'
|
11 |
+
val_data_prefix = 'val2017/' # Prefix of val image path
|
12 |
+
|
13 |
+
num_classes = 80 # Number of classes for classification
|
14 |
+
# Batch size of a single GPU during training
|
15 |
+
train_batch_size_per_gpu = 16
|
16 |
+
# Worker to pre-fetch data for each single GPU during training
|
17 |
+
train_num_workers = 8
|
18 |
+
# persistent_workers must be False if num_workers is 0
|
19 |
+
persistent_workers = True
|
20 |
+
|
21 |
+
# -----model related-----
|
22 |
+
# Basic size of multi-scale prior box
|
23 |
+
anchors = [
|
24 |
+
[(10, 13), (16, 30), (33, 23)], # P3/8
|
25 |
+
[(30, 61), (62, 45), (59, 119)], # P4/16
|
26 |
+
[(116, 90), (156, 198), (373, 326)] # P5/32
|
27 |
+
]
|
28 |
+
|
29 |
+
# -----train val related-----
|
30 |
+
# Base learning rate for optim_wrapper. Corresponding to 8xb16=128 bs
|
31 |
+
base_lr = 0.01
|
32 |
+
max_epochs = 300 # Maximum training epochs
|
33 |
+
|
34 |
+
model_test_cfg = dict(
|
35 |
+
# The config of multi-label for multi-class prediction.
|
36 |
+
multi_label=True,
|
37 |
+
# The number of boxes before NMS
|
38 |
+
nms_pre=30000,
|
39 |
+
score_thr=0.001, # Threshold to filter out boxes.
|
40 |
+
nms=dict(type='nms', iou_threshold=0.65), # NMS type and threshold
|
41 |
+
max_per_img=300) # Max number of detections of each image
|
42 |
+
|
43 |
+
# ========================Possible modified parameters========================
|
44 |
+
# -----data related-----
|
45 |
+
img_scale = (640, 640) # width, height
|
46 |
+
# Dataset type, this will be used to define the dataset
|
47 |
+
dataset_type = 'YOLOv5CocoDataset'
|
48 |
+
# Batch size of a single GPU during validation
|
49 |
+
val_batch_size_per_gpu = 1
|
50 |
+
# Worker to pre-fetch data for each single GPU during validation
|
51 |
+
val_num_workers = 2
|
52 |
+
|
53 |
+
# Config of batch shapes. Only on val.
|
54 |
+
# It means not used if batch_shapes_cfg is None.
|
55 |
+
batch_shapes_cfg = dict(
|
56 |
+
type='BatchShapePolicy',
|
57 |
+
batch_size=val_batch_size_per_gpu,
|
58 |
+
img_size=img_scale[0],
|
59 |
+
# The image scale of padding should be divided by pad_size_divisor
|
60 |
+
size_divisor=32,
|
61 |
+
# Additional paddings for pixel scale
|
62 |
+
extra_pad_ratio=0.5)
|
63 |
+
|
64 |
+
# -----model related-----
|
65 |
+
# The scaling factor that controls the depth of the network structure
|
66 |
+
deepen_factor = 0.33
|
67 |
+
# The scaling factor that controls the width of the network structure
|
68 |
+
widen_factor = 0.5
|
69 |
+
# Strides of multi-scale prior box
|
70 |
+
strides = [8, 16, 32]
|
71 |
+
num_det_layers = 3 # The number of model output scales
|
72 |
+
norm_cfg = dict(type='BN', momentum=0.03, eps=0.001) # Normalization config
|
73 |
+
|
74 |
+
# -----train val related-----
|
75 |
+
affine_scale = 0.5 # YOLOv5RandomAffine scaling ratio
|
76 |
+
loss_cls_weight = 0.5
|
77 |
+
loss_bbox_weight = 0.05
|
78 |
+
loss_obj_weight = 1.0
|
79 |
+
prior_match_thr = 4. # Priori box matching threshold
|
80 |
+
# The obj loss weights of the three output layers
|
81 |
+
obj_level_weights = [4., 1., 0.4]
|
82 |
+
lr_factor = 0.01 # Learning rate scaling factor
|
83 |
+
weight_decay = 0.0005
|
84 |
+
# Save model checkpoint and validation intervals
|
85 |
+
save_checkpoint_intervals = 10
|
86 |
+
# The maximum checkpoints to keep.
|
87 |
+
max_keep_ckpts = 3
|
88 |
+
# Single-scale training is recommended to
|
89 |
+
# be turned on, which can speed up training.
|
90 |
+
env_cfg = dict(cudnn_benchmark=True)
|
91 |
+
|
92 |
+
# ===============================Unmodified in most cases====================
|
93 |
+
model = dict(
|
94 |
+
type='YOLODetector',
|
95 |
+
data_preprocessor=dict(
|
96 |
+
type='mmdet.DetDataPreprocessor',
|
97 |
+
mean=[0., 0., 0.],
|
98 |
+
std=[255., 255., 255.],
|
99 |
+
bgr_to_rgb=True),
|
100 |
+
backbone=dict(
|
101 |
+
type='YOLOv5CSPDarknet',
|
102 |
+
deepen_factor=deepen_factor,
|
103 |
+
widen_factor=widen_factor,
|
104 |
+
norm_cfg=norm_cfg,
|
105 |
+
act_cfg=dict(type='SiLU', inplace=True)),
|
106 |
+
neck=dict(
|
107 |
+
type='YOLOv5PAFPN',
|
108 |
+
deepen_factor=deepen_factor,
|
109 |
+
widen_factor=widen_factor,
|
110 |
+
in_channels=[256, 512, 1024],
|
111 |
+
out_channels=[256, 512, 1024],
|
112 |
+
num_csp_blocks=3,
|
113 |
+
norm_cfg=norm_cfg,
|
114 |
+
act_cfg=dict(type='SiLU', inplace=True)),
|
115 |
+
bbox_head=dict(
|
116 |
+
type='YOLOv5Head',
|
117 |
+
head_module=dict(
|
118 |
+
type='YOLOv5HeadModule',
|
119 |
+
num_classes=num_classes,
|
120 |
+
in_channels=[256, 512, 1024],
|
121 |
+
widen_factor=widen_factor,
|
122 |
+
featmap_strides=strides,
|
123 |
+
num_base_priors=3),
|
124 |
+
prior_generator=dict(
|
125 |
+
type='mmdet.YOLOAnchorGenerator',
|
126 |
+
base_sizes=anchors,
|
127 |
+
strides=strides),
|
128 |
+
# scaled based on number of detection layers
|
129 |
+
loss_cls=dict(
|
130 |
+
type='mmdet.CrossEntropyLoss',
|
131 |
+
use_sigmoid=True,
|
132 |
+
reduction='mean',
|
133 |
+
loss_weight=loss_cls_weight *
|
134 |
+
(num_classes / 80 * 3 / num_det_layers)),
|
135 |
+
loss_bbox=dict(
|
136 |
+
type='IoULoss',
|
137 |
+
iou_mode='ciou',
|
138 |
+
bbox_format='xywh',
|
139 |
+
eps=1e-7,
|
140 |
+
reduction='mean',
|
141 |
+
loss_weight=loss_bbox_weight * (3 / num_det_layers),
|
142 |
+
return_iou=True),
|
143 |
+
loss_obj=dict(
|
144 |
+
type='mmdet.CrossEntropyLoss',
|
145 |
+
use_sigmoid=True,
|
146 |
+
reduction='mean',
|
147 |
+
loss_weight=loss_obj_weight *
|
148 |
+
((img_scale[0] / 640)**2 * 3 / num_det_layers)),
|
149 |
+
prior_match_thr=prior_match_thr,
|
150 |
+
obj_level_weights=obj_level_weights),
|
151 |
+
test_cfg=model_test_cfg)
|
152 |
+
|
153 |
+
albu_train_transforms = [
|
154 |
+
dict(type='Blur', p=0.01),
|
155 |
+
dict(type='MedianBlur', p=0.01),
|
156 |
+
dict(type='ToGray', p=0.01),
|
157 |
+
dict(type='CLAHE', p=0.01)
|
158 |
+
]
|
159 |
+
|
160 |
+
pre_transform = [
|
161 |
+
dict(type='LoadImageFromFile', file_client_args=_base_.file_client_args),
|
162 |
+
dict(type='LoadAnnotations', with_bbox=True)
|
163 |
+
]
|
164 |
+
|
165 |
+
train_pipeline = [
|
166 |
+
*pre_transform,
|
167 |
+
dict(
|
168 |
+
type='Mosaic',
|
169 |
+
img_scale=img_scale,
|
170 |
+
pad_val=114.0,
|
171 |
+
pre_transform=pre_transform),
|
172 |
+
dict(
|
173 |
+
type='YOLOv5RandomAffine',
|
174 |
+
max_rotate_degree=0.0,
|
175 |
+
max_shear_degree=0.0,
|
176 |
+
scaling_ratio_range=(1 - affine_scale, 1 + affine_scale),
|
177 |
+
# img_scale is (width, height)
|
178 |
+
border=(-img_scale[0] // 2, -img_scale[1] // 2),
|
179 |
+
border_val=(114, 114, 114)),
|
180 |
+
dict(
|
181 |
+
type='mmdet.Albu',
|
182 |
+
transforms=albu_train_transforms,
|
183 |
+
bbox_params=dict(
|
184 |
+
type='BboxParams',
|
185 |
+
format='pascal_voc',
|
186 |
+
label_fields=['gt_bboxes_labels', 'gt_ignore_flags']),
|
187 |
+
keymap={
|
188 |
+
'img': 'image',
|
189 |
+
'gt_bboxes': 'bboxes'
|
190 |
+
}),
|
191 |
+
dict(type='YOLOv5HSVRandomAug'),
|
192 |
+
dict(type='mmdet.RandomFlip', prob=0.5),
|
193 |
+
dict(
|
194 |
+
type='mmdet.PackDetInputs',
|
195 |
+
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'flip',
|
196 |
+
'flip_direction'))
|
197 |
+
]
|
198 |
+
|
199 |
+
train_dataloader = dict(
|
200 |
+
batch_size=train_batch_size_per_gpu,
|
201 |
+
num_workers=train_num_workers,
|
202 |
+
persistent_workers=persistent_workers,
|
203 |
+
pin_memory=True,
|
204 |
+
sampler=dict(type='DefaultSampler', shuffle=True),
|
205 |
+
dataset=dict(
|
206 |
+
type=dataset_type,
|
207 |
+
data_root=data_root,
|
208 |
+
ann_file=train_ann_file,
|
209 |
+
data_prefix=dict(img=train_data_prefix),
|
210 |
+
filter_cfg=dict(filter_empty_gt=False, min_size=32),
|
211 |
+
pipeline=train_pipeline))
|
212 |
+
|
213 |
+
test_pipeline = [
|
214 |
+
dict(type='LoadImageFromFile', file_client_args=_base_.file_client_args),
|
215 |
+
dict(type='YOLOv5KeepRatioResize', scale=img_scale),
|
216 |
+
dict(
|
217 |
+
type='LetterResize',
|
218 |
+
scale=img_scale,
|
219 |
+
allow_scale_up=False,
|
220 |
+
pad_val=dict(img=114)),
|
221 |
+
dict(type='LoadAnnotations', with_bbox=True, _scope_='mmdet'),
|
222 |
+
dict(
|
223 |
+
type='mmdet.PackDetInputs',
|
224 |
+
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
|
225 |
+
'scale_factor', 'pad_param'))
|
226 |
+
]
|
227 |
+
|
228 |
+
val_dataloader = dict(
|
229 |
+
batch_size=val_batch_size_per_gpu,
|
230 |
+
num_workers=val_num_workers,
|
231 |
+
persistent_workers=persistent_workers,
|
232 |
+
pin_memory=True,
|
233 |
+
drop_last=False,
|
234 |
+
sampler=dict(type='DefaultSampler', shuffle=False),
|
235 |
+
dataset=dict(
|
236 |
+
type=dataset_type,
|
237 |
+
data_root=data_root,
|
238 |
+
test_mode=True,
|
239 |
+
data_prefix=dict(img=val_data_prefix),
|
240 |
+
ann_file=val_ann_file,
|
241 |
+
pipeline=test_pipeline,
|
242 |
+
batch_shapes_cfg=batch_shapes_cfg))
|
243 |
+
|
244 |
+
test_dataloader = val_dataloader
|
245 |
+
|
246 |
+
param_scheduler = None
|
247 |
+
optim_wrapper = dict(
|
248 |
+
type='OptimWrapper',
|
249 |
+
optimizer=dict(
|
250 |
+
type='SGD',
|
251 |
+
lr=base_lr,
|
252 |
+
momentum=0.937,
|
253 |
+
weight_decay=weight_decay,
|
254 |
+
nesterov=True,
|
255 |
+
batch_size_per_gpu=train_batch_size_per_gpu),
|
256 |
+
constructor='YOLOv5OptimizerConstructor')
|
257 |
+
|
258 |
+
default_hooks = dict(
|
259 |
+
param_scheduler=dict(
|
260 |
+
type='YOLOv5ParamSchedulerHook',
|
261 |
+
scheduler_type='linear',
|
262 |
+
lr_factor=lr_factor,
|
263 |
+
max_epochs=max_epochs),
|
264 |
+
checkpoint=dict(
|
265 |
+
type='CheckpointHook',
|
266 |
+
interval=save_checkpoint_intervals,
|
267 |
+
save_best='auto',
|
268 |
+
max_keep_ckpts=max_keep_ckpts))
|
269 |
+
|
270 |
+
custom_hooks = [
|
271 |
+
dict(
|
272 |
+
type='EMAHook',
|
273 |
+
ema_type='ExpMomentumEMA',
|
274 |
+
momentum=0.0001,
|
275 |
+
update_buffers=True,
|
276 |
+
strict_load=False,
|
277 |
+
priority=49)
|
278 |
+
]
|
279 |
+
|
280 |
+
val_evaluator = dict(
|
281 |
+
type='mmdet.CocoMetric',
|
282 |
+
proposal_nums=(100, 1, 10),
|
283 |
+
ann_file=data_root + val_ann_file,
|
284 |
+
metric='bbox')
|
285 |
+
test_evaluator = val_evaluator
|
286 |
+
|
287 |
+
train_cfg = dict(
|
288 |
+
type='EpochBasedTrainLoop',
|
289 |
+
max_epochs=max_epochs,
|
290 |
+
val_interval=save_checkpoint_intervals)
|
291 |
+
val_cfg = dict(type='ValLoop')
|
292 |
+
test_cfg = dict(type='TestLoop')
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = './yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py'
|
2 |
+
|
3 |
+
# ========================modified parameters======================
|
4 |
+
data_root = 'data/balloon/'
|
5 |
+
# Path of train annotation file
|
6 |
+
train_ann_file = 'train.json'
|
7 |
+
train_data_prefix = 'train/' # Prefix of train image path
|
8 |
+
# Path of val annotation file
|
9 |
+
val_ann_file = 'val.json'
|
10 |
+
val_data_prefix = 'val/' # Prefix of val image path
|
11 |
+
metainfo = {
|
12 |
+
'classes': ('balloon', ),
|
13 |
+
'palette': [
|
14 |
+
(220, 20, 60),
|
15 |
+
]
|
16 |
+
}
|
17 |
+
num_classes = 1
|
18 |
+
|
19 |
+
train_batch_size_per_gpu = 4
|
20 |
+
train_num_workers = 2
|
21 |
+
log_interval = 1
|
22 |
+
|
23 |
+
# =======================Unmodified in most cases==================
|
24 |
+
train_dataloader = dict(
|
25 |
+
batch_size=train_batch_size_per_gpu,
|
26 |
+
num_workers=train_num_workers,
|
27 |
+
dataset=dict(
|
28 |
+
data_root=data_root,
|
29 |
+
metainfo=metainfo,
|
30 |
+
data_prefix=dict(img=train_data_prefix),
|
31 |
+
ann_file=train_ann_file))
|
32 |
+
val_dataloader = dict(
|
33 |
+
dataset=dict(
|
34 |
+
data_root=data_root,
|
35 |
+
metainfo=metainfo,
|
36 |
+
data_prefix=dict(img=val_data_prefix),
|
37 |
+
ann_file=val_ann_file))
|
38 |
+
test_dataloader = val_dataloader
|
39 |
+
val_evaluator = dict(ann_file=data_root + val_ann_file)
|
40 |
+
test_evaluator = val_evaluator
|
41 |
+
model = dict(bbox_head=dict(head_module=dict(num_classes=num_classes)))
|
42 |
+
default_hooks = dict(logger=dict(interval=log_interval))
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = 'yolov5_s-v61_syncbn_8xb16-300e_coco.py'
|
2 |
+
|
3 |
+
# fast means faster training speed,
|
4 |
+
# but less flexibility for multitasking
|
5 |
+
model = dict(
|
6 |
+
data_preprocessor=dict(
|
7 |
+
type='YOLOv5DetDataPreprocessor',
|
8 |
+
mean=[0., 0., 0.],
|
9 |
+
std=[255., 255., 255.],
|
10 |
+
bgr_to_rgb=True))
|
11 |
+
|
12 |
+
train_dataloader = dict(collate_fn=dict(type='yolov5_collate'))
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_x-p6-v62_syncbn_fast_8xb16-300e_coco.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = './yolov5_m-p6-v62_syncbn_fast_8xb16-300e_coco.py'
|
2 |
+
deepen_factor = 1.33
|
3 |
+
widen_factor = 1.25
|
4 |
+
|
5 |
+
model = dict(
|
6 |
+
backbone=dict(
|
7 |
+
deepen_factor=deepen_factor,
|
8 |
+
widen_factor=widen_factor,
|
9 |
+
),
|
10 |
+
neck=dict(
|
11 |
+
deepen_factor=deepen_factor,
|
12 |
+
widen_factor=widen_factor,
|
13 |
+
),
|
14 |
+
bbox_head=dict(head_module=dict(widen_factor=widen_factor)))
|
Model/Model6/Model6_0_ClothesDetection/mmyolo/configs/yolov5/yolov5_x-v61_syncbn_fast_8xb16-300e_coco.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = './yolov5_m-v61_syncbn_fast_8xb16-300e_coco.py'
|
2 |
+
deepen_factor = 1.33
|
3 |
+
widen_factor = 1.25
|
4 |
+
|
5 |
+
model = dict(
|
6 |
+
backbone=dict(
|
7 |
+
deepen_factor=deepen_factor,
|
8 |
+
widen_factor=widen_factor,
|
9 |
+
),
|
10 |
+
neck=dict(
|
11 |
+
deepen_factor=deepen_factor,
|
12 |
+
widen_factor=widen_factor,
|
13 |
+
),
|
14 |
+
bbox_head=dict(head_module=dict(widen_factor=widen_factor)))
|