Skip to content

Commit

Permalink
support yolov6lite inference
Browse files Browse the repository at this point in the history
  • Loading branch information
nemonameless committed May 25, 2023
1 parent 288ba87 commit b889f6d
Show file tree
Hide file tree
Showing 11 changed files with 1,007 additions and 40 deletions.
14 changes: 14 additions & 0 deletions configs/yolov6/yolov6lite/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# YOLOv6Lite

## 模型库
### YOLOv6Lite on COCO

| 网络网络 | 输入尺寸 | 图片数/GPU | 学习率策略 | TRT-FP16-Latency(ms) | mAP | AP50 | Params(M) | FLOPs(G) | 下载链接 | 配置文件 |
| :------------- | :------- | :-------: | :--------------: | :---------: | :-----: |:-----: | :-----: |:-----: | :-------------: | :-----: |
| *YOLOv6Lite-s | 320 | 32 | 400e | - | 22.3 | 34.2 | 0.55 | 0.56 |[下载链接](https://paddledet.bj.bcebos.com/models/yolov6lite_s_400e_coco.pdparams) | [配置文件](./yolov6lite_s_400e_coco.yml) |
| *YOLOv6Lite-m | 320 | 32 | 400e | - | 24.8 | 37.7 | 0.79 | 0.67 |[下载链接](https://paddledet.bj.bcebos.com/models/yolov6lite_m_400e_coco.pdparams) | [配置文件](./yolov6lite_m_400e_coco.yml) |
| *YOLOv6Lite-l | 320 | 32 | 400e | - | 27.6 | 41.6 | 1.09 | 0.87 |[下载链接](https://paddledet.bj.bcebos.com/models/yolov6lite_l_400e_coco.pdparams) | [配置文件](./yolov6lite_l_400e_coco.yml) |


**注意:**
- YOLOv6Lite 模型暂未支持完全训练;训练使用COCO train2017作为训练集,mAP为在COCO val2017上的`mAP(IoU=0.5:0.95)`结果,且评估未使用`multi_label`等trick;
19 changes: 19 additions & 0 deletions configs/yolov6/yolov6lite/_base_/optimizer_400e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
epoch: 400

LearningRate:
base_lr: 0.01
schedulers:
- !YOLOv5LRDecay
max_epochs: 400
min_lr_ratio: 0.01
- !ExpWarmup
epochs: 3

OptimizerBuilder:
optimizer:
type: Momentum
momentum: 0.937
use_nesterov: True
regularizer:
factor: 0.0005
type: L2
19 changes: 19 additions & 0 deletions configs/yolov6/yolov6lite/_base_/optimizer_400e_fintune.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
epoch: 400

LearningRate:
base_lr: 0.0032
schedulers:
- !YOLOv5LRDecay
max_epochs: 400
min_lr_ratio: 0.12
- !ExpWarmup
epochs: 2

OptimizerBuilder:
optimizer:
type: Momentum
momentum: 0.843
use_nesterov: True
regularizer:
factor: 0.00036
type: L2
48 changes: 48 additions & 0 deletions configs/yolov6/yolov6lite/_base_/yolov6lite_effibackbone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
architecture: YOLOv6
norm_type: sync_bn
use_ema: True
ema_decay: 0.9999
ema_decay_type: "exponential"
find_unused_parameters: True

act: 'relu'
training_mode: "repvgg"
self_distill: False

width_mult: 1.0

YOLOv6:
backbone: Lite_EffiBackbone
neck: Lite_EffiNeck
yolo_head: Lite_EffideHead
post_process: ~

Lite_EffiBackbone:
return_idx: [2, 3, 4]

Lite_EffiNeck:
unified_channels: 96

Lite_EffideHead:
fpn_strides: [8, 16, 32, 64]
grid_cell_scale: 5.0
grid_cell_offset: 0.5
reg_max: 0
use_dfl: False
static_assigner_epoch: 4 # warmup_epoch
loss_weight: {cls: 1.0, iou: 2.5}
iou_type: 'siou' # 'siou' in lite s/m/l
static_assigner:
name: ATSSAssigner
topk: 9
assigner:
name: TaskAlignedAssigner
topk: 13
alpha: 1.0
beta: 6.0
nms:
name: MultiClassNMS
nms_top_k: 2000
keep_top_k: 300
score_threshold: 0.03
nms_threshold: 0.65
52 changes: 52 additions & 0 deletions configs/yolov6/yolov6lite/_base_/yolov6lite_reader_320.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
input_height: &input_height 320
input_width: &input_width 320
input_size: &input_size [*input_height, *input_width]
mosaic_epoch: &mosaic_epoch 400

worker_num: 4
TrainReader:
sample_transforms:
- Decode: {}
- MosaicPerspective:
mosaic_prob: 1.0
target_size: *input_size
degrees: 0.0
translate: 0.1
scale: 0.5
shear: 0.0
mixup_prob: 0.0
- RandomHSV: {hgain: 0.015, sgain: 0.7, vgain: 0.4}
- RandomFlip: {}
batch_transforms:
- NormalizeImage: {mean: [0., 0., 0.], std: [1., 1., 1.], norm_type: none}
- Permute: {}
- PadGT: {}
batch_size: 32
shuffle: True
drop_last: True
use_shared_memory: True
collate_batch: True
mosaic_epoch: *mosaic_epoch


EvalReader:
sample_transforms:
- Decode: {}
- Resize: {target_size: *input_size, keep_ratio: True, interp: 1}
- Pad: {size: *input_size, fill_value: [114., 114., 114.]}
- NormalizeImage: {mean: [0., 0., 0.], std: [1., 1., 1.], norm_type: none}
- Permute: {}
batch_size: 1


TestReader:
inputs_def:
image_shape: [3, *input_height, *input_width]
sample_transforms:
- Decode: {}
- Resize: {target_size: *input_size, keep_ratio: True, interp: 1}
- Pad: {size: *input_size, fill_value: [114., 114., 114.]}
- NormalizeImage: {mean: [0., 0., 0.], std: [1., 1., 1.], norm_type: none}
- Permute: {}
batch_size: 1
fuse_normalize: False
19 changes: 19 additions & 0 deletions configs/yolov6/yolov6lite/yolov6lite_l_400e_coco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
_BASE_: [
'../../datasets/coco_detection.yml',
'../../runtime.yml',
'_base_/optimizer_400e.yml',
'_base_/yolov6lite_effibackbone.yml',
'_base_/yolov6lite_reader_320.yml',
]
width_mult: 1.5
log_iter: 100
snapshot_epoch: 10
weights: output/yolov6lite_l_400e_coco/model_final


### reader config
TrainReader:
batch_size: 32 # default 8 gpus, total bs = 256

EvalReader:
batch_size: 8
19 changes: 19 additions & 0 deletions configs/yolov6/yolov6lite/yolov6lite_m_400e_coco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
_BASE_: [
'../../datasets/coco_detection.yml',
'../../runtime.yml',
'_base_/optimizer_400e.yml',
'_base_/yolov6lite_effibackbone.yml',
'_base_/yolov6lite_reader_320.yml',
]
width_mult: 1.1
log_iter: 100
snapshot_epoch: 10
weights: output/yolov6lite_m_400e_coco/model_final


### reader config
TrainReader:
batch_size: 32 # default 8 gpus, total bs = 256

EvalReader:
batch_size: 8
19 changes: 19 additions & 0 deletions configs/yolov6/yolov6lite/yolov6lite_s_400e_coco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
_BASE_: [
'../../datasets/coco_detection.yml',
'../../runtime.yml',
'_base_/optimizer_400e.yml',
'_base_/yolov6lite_effibackbone.yml',
'_base_/yolov6lite_reader_320.yml',
]
width_mult: 0.7
log_iter: 100
snapshot_epoch: 10
weights: output/yolov6lite_s_400e_coco/model_final


### reader config
TrainReader:
batch_size: 32 # default 8 gpus, total bs = 256

EvalReader:
batch_size: 8
Loading

0 comments on commit b889f6d

Please sign in to comment.