Skip to content

Commit

Permalink
Merge pull request meituan#488 from lippman1125/main
Browse files Browse the repository at this point in the history
1. fix bug of qat
  • Loading branch information
Chilicyy authored Sep 20, 2022
2 parents 9a1bb03 + 852144a commit 6551d19
Show file tree
Hide file tree
Showing 8 changed files with 401 additions and 9 deletions.
58 changes: 58 additions & 0 deletions configs/repopt/yolov6_tiny_hs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# YOLOv6t model
model = dict(
type='YOLOv6t',
pretrained=None,
depth_multiple=0.33,
width_multiple=0.375,
backbone=dict(
type='EfficientRep',
num_repeats=[1, 6, 12, 18, 6],
out_channels=[64, 128, 256, 512, 1024],
),
neck=dict(
type='RepPANNeck',
num_repeats=[12, 12, 12, 12],
out_channels=[256, 128, 128, 256, 256, 512],
),
head=dict(
type='EffiDeHead',
in_channels=[128, 256, 512],
num_layers=3,
begin_indices=24,
anchors=1,
out_indices=[17, 20, 23],
strides=[8, 16, 32],
iou_type='siou',
use_dfl=False,
reg_max=0 #if use_dfl is False, please set reg_max to 0
)
)

solver = dict(
optim='SGD',
lr_scheduler='Cosine',
lr0=0.01,
lrf=0.01,
momentum=0.937,
weight_decay=0.0005,
warmup_epochs=3.0,
warmup_momentum=0.8,
warmup_bias_lr=0.1
)

data_aug = dict(
hsv_h=0.015,
hsv_s=0.7,
hsv_v=0.4,
degrees=0.0,
translate=0.1,
scale=0.5,
shear=0.0,
flipud=0.0,
fliplr=0.5,
mosaic=1.0,
mixup=0.0,
)

# Choose Rep-block by the training Mode, choices=["repvgg", "hyper-search", "repopt"]
training_mode='hyper_search'
58 changes: 58 additions & 0 deletions configs/repopt/yolov6_tiny_opt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# YOLOv6t model
model = dict(
type='YOLOv6t',
pretrained=None,
scales='../yolov6_assert/v6t_v2_scale_last.pt',
depth_multiple=0.33,
width_multiple=0.375,
backbone=dict(
type='EfficientRep',
num_repeats=[1, 6, 12, 18, 6],
out_channels=[64, 128, 256, 512, 1024],
),
neck=dict(
type='RepPANNeck',
num_repeats=[12, 12, 12, 12],
out_channels=[256, 128, 128, 256, 256, 512],
),
head=dict(
type='EffiDeHead',
in_channels=[128, 256, 512],
num_layers=3,
begin_indices=24,
anchors=1,
out_indices=[17, 20, 23],
strides=[8, 16, 32],
iou_type='siou',
use_dfl=False,
reg_max=0 #if use_dfl is False, please set reg_max to 0
)
)

solver = dict(
optim='SGD',
lr_scheduler='Cosine',
lr0=0.01,
lrf=0.01,
momentum=0.937,
weight_decay=0.0005,
warmup_epochs=3.0,
warmup_momentum=0.8,
warmup_bias_lr=0.1
)

data_aug = dict(
hsv_h=0.015,
hsv_s=0.7,
hsv_v=0.4,
degrees=0.0,
translate=0.1,
scale=0.5,
shear=0.0,
flipud=0.0,
fliplr=0.5,
mosaic=1.0,
mixup=0.0,
)
# Choose Rep-block by the training Mode, choices=["repvgg", "hyper-search", "repopt"]
training_mode='repopt'
82 changes: 82 additions & 0 deletions configs/repopt/yolov6_tiny_opt_qat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# YOLOv6t model
model = dict(
type='YOLOv6t',
pretrained='./assets/v6s_t.pt',
scales='./assets/v6t_v2_scale_last.pt',
depth_multiple=0.33,
width_multiple=0.375,
backbone=dict(
type='EfficientRep',
num_repeats=[1, 6, 12, 18, 6],
out_channels=[64, 128, 256, 512, 1024],
),
neck=dict(
type='RepPANNeck',
num_repeats=[12, 12, 12, 12],
out_channels=[256, 128, 128, 256, 256, 512],
),
head=dict(
type='EffiDeHead',
in_channels=[128, 256, 512],
num_layers=3,
begin_indices=24,
anchors=1,
out_indices=[17, 20, 23],
strides=[8, 16, 32],
iou_type='siou',
use_dfl=False,
reg_max=0, #if use_dfl is False, please set reg_max to 0
distill_weight={
'class': 1.0,
'dfl': 1.0,
},
)
)

solver = dict(
optim='SGD',
lr_scheduler='Cosine',
lr0=0.00001,
lrf=0.001,
momentum=0.937,
weight_decay=0.00005,
warmup_epochs=3.0,
warmup_momentum=0.8,
warmup_bias_lr=0.1
)

data_aug = dict(
hsv_h=0.015,
hsv_s=0.7,
hsv_v=0.4,
degrees=0.0,
translate=0.1,
scale=0.5,
shear=0.0,
flipud=0.0,
fliplr=0.5,
mosaic=1.0,
mixup=0.0,
)

ptq = dict(
num_bits = 8,
calib_batches = 4,
# 'max', 'histogram'
calib_method = 'histogram',
# 'entropy', 'percentile', 'mse'
histogram_amax_method='entropy',
histogram_amax_percentile=99.99,
calib_output_path='./',
sensitive_layers_skip=False,
sensitive_layers_list=[],
)

qat = dict(
calib_pt = './assets/v6s_t_calib_histogram.pt',
sensitive_layers_skip = False,
sensitive_layers_list=[],
)

# Choose Rep-block by the training Mode, choices=["repvgg", "hyper-search", "repopt"]
training_mode='repopt'
58 changes: 58 additions & 0 deletions configs/repopt/yolov6n_hs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# YOLOv6n model
model = dict(
type='YOLOv6n',
pretrained=None,
depth_multiple=0.33,
width_multiple=0.25,
backbone=dict(
type='EfficientRep',
num_repeats=[1, 6, 12, 18, 6],
out_channels=[64, 128, 256, 512, 1024],
),
neck=dict(
type='RepPANNeck',
num_repeats=[12, 12, 12, 12],
out_channels=[256, 128, 128, 256, 256, 512],
),
head=dict(
type='EffiDeHead',
in_channels=[128, 256, 512],
num_layers=3,
begin_indices=24,
anchors=1,
out_indices=[17, 20, 23],
strides=[8, 16, 32],
iou_type='siou',
use_dfl=False,
reg_max=0 #if use_dfl is False, please set reg_max to 0
)
)

solver = dict(
optim='SGD',
lr_scheduler='Cosine',
lr0=0.02, #0.01 # 0.02
lrf=0.01,
momentum=0.937,
weight_decay=0.0005,
warmup_epochs=3.0,
warmup_momentum=0.8,
warmup_bias_lr=0.1
)

data_aug = dict(
hsv_h=0.015,
hsv_s=0.7,
hsv_v=0.4,
degrees=0.0,
translate=0.1,
scale=0.5,
shear=0.0,
flipud=0.0,
fliplr=0.5,
mosaic=1.0,
mixup=0.0,
)

# Choose Rep-block by the training Mode, choices=["repvgg", "hyper-search", "repopt"]
training_mode='hyper_search'
58 changes: 58 additions & 0 deletions configs/repopt/yolov6n_opt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# YOLOv6n model
model = dict(
type='YOLOv6n',
pretrained=None,
scales='../yolov6_assert/v6n_v2_scale_last.pt',
depth_multiple=0.33,
width_multiple=0.25,
backbone=dict(
type='EfficientRep',
num_repeats=[1, 6, 12, 18, 6],
out_channels=[64, 128, 256, 512, 1024],
),
neck=dict(
type='RepPANNeck',
num_repeats=[12, 12, 12, 12],
out_channels=[256, 128, 128, 256, 256, 512],
),
head=dict(
type='EffiDeHead',
in_channels=[128, 256, 512],
num_layers=3,
begin_indices=24,
anchors=1,
out_indices=[17, 20, 23],
strides=[8, 16, 32],
iou_type='siou',
use_dfl=False,
reg_max=0 #if use_dfl is False, please set reg_max to 0
)
)

solver = dict(
optim='SGD',
lr_scheduler='Cosine',
lr0=0.02, #0.01 # 0.02
lrf=0.01,
momentum=0.937,
weight_decay=0.0005,
warmup_epochs=3.0,
warmup_momentum=0.8,
warmup_bias_lr=0.1
)

data_aug = dict(
hsv_h=0.015,
hsv_s=0.7,
hsv_v=0.4,
degrees=0.0,
translate=0.1,
scale=0.5,
shear=0.0,
flipud=0.0,
fliplr=0.5,
mosaic=1.0,
mixup=0.0,
)
# Choose Rep-block by the training Mode, choices=["repvgg", "hyper-search", "repopt"]
training_mode='repopt'
Loading

0 comments on commit 6551d19

Please sign in to comment.