forked from tinyvision/DAMO-YOLO
-
Notifications
You must be signed in to change notification settings - Fork 1
/
damoyolo_tinynasL20_T.py
76 lines (63 loc) · 3.09 KB
/
damoyolo_tinynasL20_T.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
75
76
#!/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 = 0.2
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_L20_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': 1.0,
'in_channels': [96, 192, 384],
'out_channels': [64, 128, 256],
'act': 'relu',
'spp': False,
'block_name': 'BasicBlock_3x3_Reverse',
}
self.model.neck = GiraffeNeckV2
ZeroHead = {
'name': 'ZeroHead',
'num_classes': 80,
'in_channels': [64, 128, 256],
'stacked_convs': 0,
'reg_max': 16,
'act': 'silu',
'nms_conf_thre': 0.05,
'nms_iou_thre': 0.7
}
self.model.head = ZeroHead
self.dataset.class_names = ['person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic light', 'fire hydrant', 'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow', 'elephant', 'bear', 'zebra', 'giraffe', 'backpack', 'umbrella', 'handbag', 'tie', 'suitcase', 'frisbee', 'skis', 'snowboard', 'sports ball', 'kite', 'baseball bat', 'baseball glove', 'skateboard', 'surfboard', 'tennis racket', 'bottle', 'wine glass', 'cup', 'fork', 'knife', 'spoon', 'bowl', 'banana', 'apple', 'sandwich', 'orange', 'broccoli', 'carrot', 'hot dog', 'pizza', 'donut', 'cake', 'chair', 'couch', 'potted plant', 'bed', 'dining table', 'toilet', 'tv', 'laptop', 'mouse', 'remote', 'keyboard', 'cell phone', 'microwave', 'oven', 'toaster', 'sink', 'refrigerator', 'book', 'clock', 'vase', 'scissors', 'teddy bear', 'hair drier', 'toothbrush']