Skip to content

Commit 5183498

Browse files
committed
release YOLOv8-s
1 parent cd5ad3f commit 5183498

File tree

14 files changed

+53
-111
lines changed

14 files changed

+53
-111
lines changed

config/__init__.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ def build_dataset_config(args):
3333
# SSD-Style
3434
ssd_trans_config,
3535
# RT-DETR style
36-
rtdetr_s_trans_config,
37-
rtdetr_l_trans_config,
36+
rtdetr_base_trans_config,
3837
)
3938

4039
def build_trans_config(trans_config='ssd'):
@@ -74,10 +73,8 @@ def build_trans_config(trans_config='ssd'):
7473
cfg = yolox_x_trans_config
7574

7675
# RT-DETR style
77-
elif trans_config == 'rtdetr_s':
78-
cfg = rtdetr_s_trans_config
79-
elif trans_config == 'rtdetr_l':
80-
cfg = rtdetr_l_trans_config
76+
elif trans_config == 'rtdetr_base':
77+
cfg = rtdetr_base_trans_config
8178

8279
print('Transform Config: {} \n'.format(cfg))
8380

config/data_config/transform_config.py

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -296,32 +296,7 @@
296296

297297

298298
# ----------------------- SSD-Style Transform -----------------------
299-
rtdetr_s_trans_config = {
300-
'aug_type': 'rtdetr',
301-
'use_ablu': True,
302-
'pixel_mean': [123.675, 116.28, 103.53], # IN-1K statistics
303-
'pixel_std': [58.395, 57.12, 57.375], # IN-1K statistics
304-
# Basic Augment
305-
'affine_params': {
306-
'degrees': 0.0,
307-
'translate': 0.2,
308-
'scale': [0.1, 2.0],
309-
'shear': 0.0,
310-
'perspective': 0.0,
311-
'hsv_h': 0.015,
312-
'hsv_s': 0.7,
313-
'hsv_v': 0.4,
314-
},
315-
# Mosaic & Mixup
316-
'mosaic_keep_ratio': False,
317-
'mosaic_prob': 0.0,
318-
'mixup_prob': 0.0,
319-
'mosaic_type': 'yolov5',
320-
'mixup_type': 'yolov5',
321-
'mixup_scale': [0.5, 1.5] # "mixup_scale" is not used for YOLOv5MixUp, just for YOLOXMixup
322-
}
323-
324-
rtdetr_l_trans_config = {
299+
rtdetr_base_trans_config = {
325300
'aug_type': 'rtdetr',
326301
'use_ablu': True,
327302
'pixel_mean': [123.675, 116.28, 103.53], # IN-1K statistics

config/model_config/rtdetr_config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
# ---------------- Train config ----------------
5454
## input
5555
'multi_scale': [0.5, 1.25], # 320 -> 800
56-
'trans_type': 'rtdetr_s',
56+
'trans_type': 'rtdetr_base',
5757
# ---------------- Train config ----------------
5858
'trainer_type': 'rtdetr',
5959
},
@@ -110,7 +110,7 @@
110110
# ---------------- Train config ----------------
111111
## input
112112
'multi_scale': [0.5, 1.25], # 320 -> 800
113-
'trans_type': 'rtdetr_l',
113+
'trans_type': 'rtdetr_base',
114114
# ---------------- Train config ----------------
115115
'trainer_type': 'rtdetr',
116116
},
@@ -167,7 +167,7 @@
167167
# ---------------- Train config ----------------
168168
## input
169169
'multi_scale': [0.5, 1.25], # 320 -> 800
170-
'trans_type': 'rtdetr_l',
170+
'trans_type': 'rtdetr_base',
171171
# ---------------- Train config ----------------
172172
'trainer_type': 'rtdetr',
173173
},

config/model_config/yolov3_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
# ---------------- Train config ----------------
3636
## input
3737
'trans_type': 'yolov5_l',
38-
'multi_scale': [0.5, 1.0],
38+
'multi_scale': [0.5, 1.25], # 320 -> 800
3939
# ---------------- Assignment config ----------------
4040
## matcher
4141
'iou_thresh': 0.5,
@@ -82,7 +82,7 @@
8282
# ---------------- Train config ----------------
8383
## input
8484
'trans_type': 'yolov5_n',
85-
'multi_scale': [0.5, 1.0],
85+
'multi_scale': [0.5, 1.25], # 320 -> 800
8686
# ---------------- Assignment config ----------------
8787
## matcher
8888
'iou_thresh': 0.5,

config/model_config/yolov4_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
# ---------------- Train config ----------------
3636
## input
3737
'trans_type': 'yolov5_l',
38-
'multi_scale': [0.5, 1.0],
38+
'multi_scale': [0.5, 1.25], # 320 -> 800
3939
# ---------------- Assignment config ----------------
4040
## matcher
4141
'iou_thresh': 0.5,
@@ -82,7 +82,7 @@
8282
# ---------------- Train config ----------------
8383
## input
8484
'trans_type': 'yolov5_n',
85-
'multi_scale': [0.5, 1.0],
85+
'multi_scale': [0.5, 1.25], # 320 -> 800
8686
# ---------------- Assignment config ----------------
8787
## matcher
8888
'iou_thresh': 0.5,

dataset/coco.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -272,24 +272,26 @@ def pull_anno(self, index):
272272

273273
trans_config = {
274274
'aug_type': args.aug_type, # optional: ssd, yolov5
275-
'pixel_mean': [0., 0., 0.],
276-
'pixel_std': [255., 255., 255.],
277-
# Basic Augment
278-
'degrees': 0.0,
279-
'translate': 0.2,
280-
'scale': [0.1, 2.0],
281-
'shear': 0.0,
282-
'perspective': 0.0,
283-
'hsv_h': 0.015,
284-
'hsv_s': 0.7,
285-
'hsv_v': 0.4,
275+
'pixel_mean': [123.675, 116.28, 103.53],
276+
'pixel_std': [58.395, 57.12, 57.375],
286277
'use_ablu': True,
278+
# Basic Augment
279+
'affine_params': {
280+
'degrees': 0.0,
281+
'translate': 0.2,
282+
'scale': [0.1, 2.0],
283+
'shear': 0.0,
284+
'perspective': 0.0,
285+
'hsv_h': 0.015,
286+
'hsv_s': 0.7,
287+
'hsv_v': 0.4,
288+
},
287289
# Mosaic & Mixup
290+
'mosaic_keep_ratio': False,
288291
'mosaic_prob': args.mosaic,
289292
'mixup_prob': args.mixup,
290-
'mosaic_type': 'yolov5_mosaic',
291-
'mixup_type': args.mixup_type, # optional: yolov5_mixup, yolox_mixup
292-
'mosaic_keep_ratio': False,
293+
'mosaic_type': 'yolov5',
294+
'mixup_type': 'yolov5',
293295
'mixup_scale': [0.5, 1.5]
294296
}
295297
transform, trans_cfg = build_transform(args, trans_config, 32, args.is_train)

demo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ def run():
277277
model_cfg = build_model_config(args)
278278
trans_cfg = build_trans_config(model_cfg['trans_type'])
279279
data_cfg = build_dataset_config(args)
280+
280281
## Data info
281282
num_classes = data_cfg['num_classes']
282283
class_names = data_cfg['class_names']

models/detectors/rtdetr/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ This model is not yet complete.
1010

1111
- For the backbone of the image encoder, we use the IN-1K classification pretrained weight from torchvision, which is different from the official
1212
RT-DETR. It might be hard to train RT-DETR from scratch without IN-1K pretrained weight.
13+
- For the HybridEncoder, we use the C2f of YOLOv8 rather than the CSPRepLayer.
1314
- For training, we train RT-DETR series with 6x (~72 epochs) schedule on COCO and use ModelEMA trick. We close the fp16 training trick.
1415
- For data augmentation, we use the `color jitter`, `random hflip`, `random crop`, and multi-scale training trick.
1516
- For optimizer, we use AdamW with weight decay 0.0001 and base per image lr 0.0001 / 16.

models/detectors/yolov8/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
| Model | Batch | Scale | AP<sup>val<br>0.5:0.95 | AP<sup>val<br>0.5 | FLOPs<br><sup>(G) | Params<br><sup>(M) | Weight |
44
|-----------|--------|-------|------------------------|-------------------|-------------------|--------------------|--------|
55
| YOLOv8-N | 8xb16 | 640 | 37.0 | 52.9 | 8.8 | 3.2 | [ckpt](https://github.com/yjh0410/RT-ODLab/releases/download/yolo_tutorial_ckpt/yolov8_n_coco.pth) |
6-
| YOLOv8-S | 8xb16 | 640 | | | | | |
6+
| YOLOv8-S | 8xb16 | 640 | 43.5 | 60.4 | 28.8 | 11.2 | [ckpt](https://github.com/yjh0410/RT-ODLab/releases/download/yolo_tutorial_ckpt/yolov8_s_coco.pth) |
77
| YOLOv8-M | 8xb16 | 640 | | | | | |
88
| YOLOv8-L | 8xb16 | 640 | 50.7 | 68.3 | 165.7 | 43.7 | [ckpt](https://github.com/yjh0410/RT-ODLab/releases/download/yolo_tutorial_ckpt/yolov8_l_coco.pth) |
99

models/detectors/yolov8/yolov8_backbone.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ def build_backbone(cfg):
105105
'bk_act': 'silu',
106106
'bk_norm': 'BN',
107107
'bk_depthwise': False,
108-
'width': 1.0,
109-
'depth': 1.0,
110-
'ratio': 1.0,
108+
'width': 0.25,
109+
'depth': 0.34,
110+
'ratio': 2.0,
111111
}
112112
model, feats = build_backbone(cfg)
113113
x = torch.randn(1, 3, 640, 640)

0 commit comments

Comments
 (0)