-
Notifications
You must be signed in to change notification settings - Fork 7
/
yolov5m-quant.yaml
51 lines (44 loc) · 2.57 KB
/
yolov5m-quant.yaml
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
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
# Parameters
nc: 1 # number of classes
use_hardtanh: False # enable hardtanh
depth_multiple: 0.67 # model depth multiple
width_multiple: 0.75 # layer channel multiple
anchors:
- [10,13, 16,30, 33,23] # P3/8
- [30,61, 62,45, 59,119] # P4/16
- [116,90, 156,198, 373,326] # P5/32
bit_width:
- [8, 4, 4, 8] # in_weight_bit_width, in_act_bit_width, weight_bit_width, act_bit_width, out_weight_bit_width
# YOLOv5 v6.0 backbone
backbone:
# [from, number, module, args]
[[-1, 1, QuantConv, [64, 6, 2, 2, 1, True, True, in_weight_bit_width, act_bit_width]], # 0-P1/2
[-1, 1, QuantConv, [128, 3, 2, None, 1, True, True, in_weight_bit_width, act_bit_width]], # 1-P2/4
[-1, 3, QuantC3, [128, True, 1, 0.5, weight_bit_width, act_bit_width]],
[-1, 1, QuantConv, [256, 3, 2, None, 1, True, True, in_weight_bit_width, act_bit_width]], # 3-P3/8
[-1, 6, QuantC3, [256, True, 1, 0.5, weight_bit_width, act_bit_width]],
[-1, 1, QuantConv, [512, 3, 2, None, 1, True, True, in_weight_bit_width, act_bit_width]], # 5-P4/16
[-1, 9, QuantC3, [512, True, 1, 0.5, weight_bit_width, act_bit_width]],
[-1, 1, QuantConv, [1024, 3, 2, None, 1, True, True, in_weight_bit_width, act_bit_width]], # 7-P5/32
[-1, 3, QuantC3, [1024, True, 1, 0.5, weight_bit_width, act_bit_width]],
[-1, 1, QuantSPPF, [1024, 5, weight_bit_width, act_bit_width]], # 9
]
# YOLOv5 v6.0 head
head:
[[-1, 1, QuantConv, [512, 1, 1, None, 1, True, True, in_weight_bit_width, act_bit_width]],
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
[[-1, 6], 1, Concat, [1]], # cat backbone P4
[-1, 3, QuantC3, [512, False, 1, 0.5, weight_bit_width, act_bit_width]], # 13
[-1, 1, QuantConv, [256, 1, 1, None, 1, True, True, in_weight_bit_width, act_bit_width]],
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
[[-1, 4], 1, Concat, [1]], # cat backbone P3
[-1, 3, QuantC3, [256, False, 1, 0.5, weight_bit_width, act_bit_width, use_hardtanh]], # 17 (P3/8-small)
[-1, 1, QuantConv, [256, 3, 2, None, 1, True, True, in_weight_bit_width, act_bit_width]],
[[-1, 14], 1, Concat, [1]], # cat head P4
[-1, 3, QuantC3, [512, False, 1, 0.5, weight_bit_width, act_bit_width, use_hardtanh]], # 20 (P4/16-medium)
[-1, 1, QuantConv, [512, 3, 2, None, 1, True, True, in_weight_bit_width, act_bit_width]],
[[-1, 10], 1, Concat, [1]], # cat head P5
[-1, 3, QuantC3, [1024, False, 1, 0.5, weight_bit_width, act_bit_width, use_hardtanh]], # 23 (P5/32-large)
[[17, 20, 23], 1, Detect, [nc, anchors, True, use_hardtanh, True, out_weight_bit_width]], # Detect(P3, P4, P5)
]