forked from tinyvision/DAMO-YOLO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
damoyolo_tinynasL25_S.py
74 lines (62 loc) · 2.21 KB
/
damoyolo_tinynasL25_S.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env python3
import os
from damo.config import Config as MyConfig
class Config(MyConfig):
def __init__(self):
super(Config, self).__init__()
self.miscs.exp_name = os.path.split(
os.path.realpath(__file__))[1].split('.')[0]
self.miscs.eval_interval_epochs = 10
self.miscs.ckpt_interval_epochs = 10
# optimizer
self.train.batch_size = 256
self.train.base_lr_per_img = 0.01 / 64
self.train.min_lr_ratio = 0.05
self.train.weight_decay = 5e-4
self.train.momentum = 0.9
self.train.no_aug_epochs = 16
self.train.warmup_epochs = 5
# augment
self.train.augment.transform.image_max_range = (640, 640)
self.train.augment.mosaic_mixup.mixup_prob = 0.15
self.train.augment.mosaic_mixup.degrees = 10.0
self.train.augment.mosaic_mixup.translate = 0.2
self.train.augment.mosaic_mixup.shear = 2.0
self.train.augment.mosaic_mixup.mosaic_scale = (0.1, 2.0)
self.dataset.train_ann = ('coco_2017_train', )
self.dataset.val_ann = ('coco_2017_val', )
# backbone
structure = self.read_structure(
'./damo/base_models/backbones/nas_backbones/tinynas_L25_k1kx.txt')
TinyNAS = {
'name': 'TinyNAS_res',
'net_structure_str': structure,
'out_indices': (2, 4, 5),
'with_spp': True,
'use_focus': True,
'act': 'relu',
'reparam': True,
}
self.model.backbone = TinyNAS
GiraffeNeckV2 = {
'name': 'GiraffeNeckV2',
'depth': 1.0,
'hidden_ratio': 0.75,
'in_channels': [128, 256, 512],
'out_channels': [128, 256, 512],
'act': 'relu',
'spp': False,
'block_name': 'BasicBlock_3x3_Reverse',
}
self.model.neck = GiraffeNeckV2
ZeroHead = {
'name': 'ZeroHead',
'num_classes': 80,
'in_channels': [128, 256, 512],
'stacked_convs': 0,
'reg_max': 16,
'act': 'silu',
'nms_conf_thre': 0.05,
'nms_iou_thre': 0.7
}
self.model.head = ZeroHead