-
Notifications
You must be signed in to change notification settings - Fork 476
/
damoyolo_tinynasL35_M.py
77 lines (64 loc) · 3.12 KB
/
damoyolo_tinynasL35_M.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
77
#!/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_L35_kxkx.txt')
TinyNAS = {
'name': 'TinyNAS_csp',
'net_structure_str': structure,
'out_indices': (2, 3, 4),
'with_spp': True,
'use_focus': True,
'act': 'silu',
'reparam': True,
}
self.model.backbone = TinyNAS
GiraffeNeckV2 = {
'name': 'GiraffeNeckV2',
'depth': 1.5,
'hidden_ratio': 1.0,
'in_channels': [128, 256, 512],
'out_channels': [128, 256, 512],
'act': 'silu',
'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,
'legacy': False,
}
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']