Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added a support of SODA-D dataset #692

Open
wants to merge 73 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
b9e032f
correct the scale_factor and pad_param value in LetterResize
tang576225574 Dec 18, 2022
45d331b
correct the scale_factor and pad_param value in LetterResize
tang576225574 Dec 18, 2022
bfe864d
correct the scale_factor and pad_param value in LetterResize
tang576225574 Dec 18, 2022
446213d
correct the scale_factor and pad_param value in LetterResize
tang576225574 Dec 18, 2022
acc89af
tang
tang576225574 Dec 25, 2022
8eac57a
update
hhaAndroid Dec 27, 2022
6ee6391
tang
tang576225574 Dec 28, 2022
db07087
tang
tang576225574 Dec 28, 2022
9baf66f
Merge branch 'dev' of https://github.com/open-mmlab/mmyolo into dev
tang576225574 Dec 28, 2022
ac39449
tang
tang576225574 Dec 28, 2022
6a75391
fix linting
tang576225574 Dec 28, 2022
45a6b6f
tang
tang576225574 Dec 28, 2022
c489ec0
tang
tang576225574 Dec 28, 2022
e6b0391
tang
tang576225574 Jan 1, 2023
b1b0333
Merge branch 'dev' of https://github.com/open-mmlab/mmyolo into dev
tang576225574 Jan 1, 2023
f3f18b6
Merge branch 'dev' of https://github.com/open-mmlab/mmyolo into dev
tang576225574 Jan 9, 2023
04fa350
Merge branch 'dev' of https://github.com/open-mmlab/mmyolo into dev
tang576225574 Jan 10, 2023
cbb7c71
Merge branch 'dev' of https://github.com/open-mmlab/mmyolo into dev
tang576225574 Jan 11, 2023
ff45117
Merge branch 'dev' of https://github.com/open-mmlab/mmyolo into dev
tang576225574 Feb 5, 2023
1687265
Merge branch 'dev' of https://github.com/open-mmlab/mmyolo into dev
tang576225574 Feb 16, 2023
0df6086
add print registers
tang576225574 Feb 16, 2023
fd46d90
add print registers
tang576225574 Feb 16, 2023
c70c97c
add print registers
tang576225574 Feb 16, 2023
6997cae
add print registers
tang576225574 Feb 16, 2023
244d0ee
Merge branch 'dev' of https://github.com/open-mmlab/mmyolo into dev
tang576225574 Feb 16, 2023
aeeabfe
Merge branch 'dev' into tang
tang576225574 Feb 16, 2023
86a55c6
add print registers
tang576225574 Feb 16, 2023
e92c30d
tang
tang576225574 Feb 23, 2023
b153db7
Merge branch 'dev' of https://github.com/open-mmlab/mmyolo into tang
tang576225574 Feb 23, 2023
5804e89
tang v1 finished
tang576225574 Feb 24, 2023
47a5e9a
tang
tang576225574 Feb 26, 2023
b708d5b
Merge branch 'dev' of https://github.com/open-mmlab/mmyolo into tang
tang576225574 Feb 28, 2023
07f5c1a
print registers v1.2
tang576225574 Feb 28, 2023
a00bb43
update
hhaAndroid Feb 28, 2023
3f745ab
Merge branch 'dev' of https://github.com/open-mmlab/mmyolo into tang
tang576225574 Feb 28, 2023
fd86928
Merge branch 'dev' of https://github.com/open-mmlab/mmyolo into tang
tang576225574 Feb 28, 2023
91cefc7
tang
tang576225574 Feb 28, 2023
a5127a8
update version
tang576225574 Feb 28, 2023
108578c
update
tang576225574 Feb 28, 2023
c8c31d7
update
tang576225574 Feb 28, 2023
db2e3fd
update
hhaAndroid Feb 28, 2023
7b2e32b
remove exclude_prefix
tang576225574 Feb 28, 2023
c87f08b
Merge branch 'tang' of https://github.com/tang576225574/mmyolo into tang
tang576225574 Feb 28, 2023
fe4d6e4
Merge branch 'dev' of https://github.com/open-mmlab/mmyolo into tang
tang576225574 Feb 28, 2023
e8b94b5
Merge branch 'dev' of https://github.com/open-mmlab/mmyolo into dev
tang576225574 Feb 28, 2023
046a445
Merge branch 'dev' into tang
tang576225574 Mar 1, 2023
060d05e
Merge branch 'dev' of https://github.com/open-mmlab/mmyolo into tang
tang576225574 Mar 2, 2023
caa246e
Merge branch 'dev' of https://github.com/open-mmlab/mmyolo into dev
tang576225574 Mar 2, 2023
d0c8a51
Merge branch 'dev' of https://github.com/open-mmlab/mmyolo into tang
tang576225574 Mar 6, 2023
260724c
Merge branch 'dev' into tang
tang576225574 Mar 6, 2023
c6965bc
Merge branch 'dev' of https://github.com/open-mmlab/mmyolo into dev
tang576225574 Mar 7, 2023
4dfcc67
Merge branch 'dev' into tang
tang576225574 Mar 7, 2023
b7a53b7
swap the val pipeline for visualization
tang576225574 Mar 7, 2023
04f3529
swap the val pipeline for visualization
tang576225574 Mar 7, 2023
384c089
swap the val pipeline for visualization
tang576225574 Mar 7, 2023
062a85a
swap the val pipeline for visualization
tang576225574 Mar 8, 2023
8ff793f
swap the val pipeline for visualization
tang576225574 Mar 8, 2023
1f3306a
Merge branch 'dev' of https://github.com/open-mmlab/mmyolo into tang
tang576225574 Mar 8, 2023
e5aef0e
Merge branch 'dev' of https://github.com/open-mmlab/mmyolo into dev
tang576225574 Mar 8, 2023
730210f
Merge branch 'dev' into tang
tang576225574 Mar 8, 2023
4e99611
optimize the convert_kd_ckpt_to_student file
tang576225574 Mar 8, 2023
6ef7d70
optimize the convert_kd_ckpt_to_student file
tang576225574 Mar 8, 2023
a56ab01
optimize the tools/model_converters/convert_kd_ckpt_to_student.py file
tang576225574 Mar 9, 2023
d329c54
Merge branch 'dev' of https://github.com/open-mmlab/mmyolo into dev
tang576225574 Mar 10, 2023
f955c52
Merge branch 'dev' into tang
tang576225574 Mar 10, 2023
3e23140
soda-d supoorted
tang576225574 Mar 13, 2023
fd5620c
sodad supported
tang576225574 Mar 15, 2023
cb6b50d
sodad supported
tang576225574 Mar 16, 2023
b193ce3
dataset sodad supported
tang576225574 Mar 22, 2023
0087fa0
sodad supported
tang576225574 Mar 24, 2023
d20938c
sodad supported
tang576225574 Mar 24, 2023
f652ed8
Merge branch 'dev' of https://github.com/open-mmlab/mmyolo into dev
tang576225574 Mar 24, 2023
0fe992b
Merge branch 'dev' into tang_sodad
tang576225574 Mar 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
190 changes: 190 additions & 0 deletions configs/yolov7/yolov7_tiny_syncbn_fast_4x16b-100e_sodad.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
_base_ = './yolov7_tiny_syncbn_fast_8x16b-300e_coco.py'

# ========================Frequently modified parameters======================
# -----data related-----
data_root = './data/SODA-D/'
train_ann_file = 'Annotations/train.json'
train_data_prefix = 'Images' # Prefix of train image path
# Path of val annotation file
val_ann_file = 'Annotations/val.json'
val_data_prefix = 'Images' # Prefix of val image path
test_ann_file = 'Annotations/test.json'
metainfo = dict(
classes=('people', 'rider', 'bicycle', 'motor', 'vehicle', 'traffic-sign',
'traffic-light', 'traffic-camera', 'warning-cone'),
palette=None)

num_classes = 9 # Number of classes for classification
# Batch size of a single GPU during training
train_batch_size_per_gpu = 16
# Worker to pre-fetch data for each single GPU during training
train_num_workers = 4

# -----model related-----
# Basic size of multi-scale prior box
anchors = [
[(12, 16), (19, 36), (40, 28)], # P3/8
[(36, 75), (76, 55), (72, 146)], # P4/16
[(142, 110), (192, 243), (459, 401)] # P5/32
]
# -----train val related-----
# Base learning rate for optim_wrapper. Corresponding to 8xb16=128 bs
# base_lr = base_lr / num_gpus
base_lr = 0.01 / 8
max_epochs = 100 # Maximum training epochs

# ========================Possible modified parameters========================
# -----data related-----
img_scale = (1216, 1216) # width, height
# Dataset type, this will be used to define the dataset
dataset_type = 'YOLOv5CocoDataset'
# Batch size of a single GPU during validation
val_batch_size_per_gpu = 1
# Worker to pre-fetch data for each single GPU during validation
val_num_workers = 2

# Config of batch shapes. Only on val.
# It means not used if batch_shapes_cfg is None.
batch_shapes_cfg = dict(
batch_size=val_batch_size_per_gpu,
img_size=img_scale[0],
# The image scale of padding should be divided by pad_size_divisor
size_divisor=32)

# -----train val related-----
loss_cls_weight = 0.3
loss_bbox_weight = 0.05
loss_obj_weight = 0.7

# ===============================Unmodified in most cases====================
model = dict(
bbox_head=dict(
head_module=dict(num_classes=num_classes),
prior_generator=dict(base_sizes=anchors),
# scaled based on number of detection layers
loss_cls=dict(loss_weight=loss_cls_weight *
(num_classes / 80 * 3 / _base_.num_det_layers)),
loss_bbox=dict(
loss_weight=loss_bbox_weight * (3 / _base_.num_det_layers),
return_iou=True),
loss_obj=dict(loss_weight=loss_obj_weight *
((img_scale[0] / 640)**2 * 3 / _base_.num_det_layers)),
))



pre_transform = _base_.pre_transform
max_translate_ratio = _base_.max_translate_ratio
scaling_ratio_range = _base_.scaling_ratio_range
randchoice_mosaic_prob = _base_.randchoice_mosaic_prob
mixup_alpha = _base_.mixup_alpha
mixup_beta = _base_.mixup_beta
mixup_prob = _base_.mixup_prob

mosiac4_pipeline = [
dict(
type='Mosaic',
img_scale=img_scale,
pad_val=114.0,
pre_transform=pre_transform),
dict(
type='YOLOv5RandomAffine',
max_rotate_degree=0.0,
max_shear_degree=0.0,
max_translate_ratio=max_translate_ratio, # change
scaling_ratio_range=scaling_ratio_range, # change
# img_scale is (width, height)
border=(-img_scale[0] // 2, -img_scale[1] // 2),
border_val=(114, 114, 114)),
]
mosiac9_pipeline = [
dict(
type='Mosaic9',
img_scale=img_scale,
pad_val=114.0,
pre_transform=pre_transform),
dict(
type='YOLOv5RandomAffine',
max_rotate_degree=0.0,
max_shear_degree=0.0,
max_translate_ratio=max_translate_ratio, # change
scaling_ratio_range=scaling_ratio_range, # change
border=(-img_scale[0] // 2, -img_scale[1] // 2),
border_val=(114, 114, 114)),
]

randchoice_mosaic_pipeline = dict(
type='RandomChoice',
transforms=[mosiac4_pipeline, mosiac9_pipeline],
prob=randchoice_mosaic_prob)

train_pipeline = [
*pre_transform,
randchoice_mosaic_pipeline,
dict(
type='YOLOv5MixUp',
alpha=mixup_alpha,
beta=mixup_beta,
prob=mixup_prob, # change
pre_transform=[*pre_transform, randchoice_mosaic_pipeline]),
dict(type='YOLOv5HSVRandomAug'),
dict(type='mmdet.RandomFlip', prob=0.5),
dict(
type='mmdet.PackDetInputs',
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'flip',
'flip_direction'))
]

train_dataloader = dict(
batch_size=train_batch_size_per_gpu,
num_workers=train_num_workers,
dataset=dict(
type=dataset_type,
metainfo=metainfo,
data_root=data_root,
ann_file=train_ann_file,
data_prefix=dict(img=train_data_prefix)))

val_dataloader = dict(
batch_size=val_batch_size_per_gpu,
num_workers=val_num_workers,
dataset=dict(
type=dataset_type,
metainfo=metainfo,
data_root=data_root,
data_prefix=dict(img=val_data_prefix),
ann_file=val_ann_file,
batch_shapes_cfg=batch_shapes_cfg))

test_dataloader = dict(
batch_size=val_batch_size_per_gpu,
num_workers=val_num_workers,
dataset=dict(
type=dataset_type,
metainfo=metainfo,
data_root=data_root,
data_prefix=dict(img=val_data_prefix),
ann_file=test_ann_file,
batch_shapes_cfg=batch_shapes_cfg))

# optimizer
optim_wrapper = dict(
type='OptimWrapper',
optimizer=dict(
type='SGD',
lr=base_lr,
momentum=0.9,
weight_decay=_base_.weight_decay,
nesterov=True,
batch_size_per_gpu=train_batch_size_per_gpu),
clip_grad=None,
constructor='YOLOv7OptimWrapperConstructor')

default_hooks = dict(param_scheduler=dict(max_epochs=max_epochs))
val_evaluator = dict(type='SodadMetric', classwise=True, ann_file=data_root + val_ann_file)
test_evaluator = dict(type='SodadMetric', classwise=True, ann_file=data_root + test_ann_file)

train_cfg = dict(
max_epochs=max_epochs,
dynamic_intervals=[(max_epochs - _base_.num_epoch_stage2,
_base_.val_interval_stage2)])
1 change: 1 addition & 0 deletions mmyolo/engine/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
from .hooks import * # noqa: F401,F403
from .optimizers import * # noqa: F401,F403
from .evaluation import * # noqa: F401,F403
6 changes: 6 additions & 0 deletions mmyolo/engine/evaluation/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright (c) OpenMMLab. All rights reserved.
from .sodad_metric import SodadMetric # noqa: F401,F403

__all__ = [
'SodadMetric'
]
Loading