forked from meituan/YOLOv6
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'meituan:main' into trtmAP
- Loading branch information
Showing
11 changed files
with
483 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# YOLOv6s model | ||
model = dict( | ||
type='YOLOv6s', | ||
pretrained=None, | ||
depth_multiple=0.33, | ||
width_multiple=0.50, | ||
backbone=dict( | ||
type='EfficientRep', | ||
num_repeats=[1, 6, 12, 18, 6], | ||
out_channels=[64, 128, 256, 512, 1024], | ||
), | ||
neck=dict( | ||
type='RepPAN', | ||
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' | ||
) | ||
) | ||
|
||
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# YOLOv6s model | ||
model = dict( | ||
type='YOLOv6s', | ||
pretrained='./assets/yolov6s_scale.pt', | ||
depth_multiple=0.33, | ||
width_multiple=0.50, | ||
backbone=dict( | ||
type='EfficientRep', | ||
num_repeats=[1, 6, 12, 18, 6], | ||
out_channels=[64, 128, 256, 512, 1024], | ||
), | ||
neck=dict( | ||
type='RepPAN', | ||
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' | ||
) | ||
) | ||
|
||
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# RepOpt version implementation of YOLOv6 | ||
## Introduction | ||
This is a RepOpt-version implementation of YOLOv6 according to RepOptimizer: https://arxiv.org/pdf/2205.15242.pdf @DingXiaoH \ | ||
It shows some advantages: | ||
1. With only minor changes. it is compatible with the original repvgg version, and it is easy to reproduce the precision comparable with original version. | ||
2. No more train/deploy transform. The target network is consistent when training and deploying. | ||
3. A slight training acceleration of about 8%. | ||
4. Last and the most important, It is quantization friendly. Compared to the original version, the mAP decrease of PTQ can be greatly improved. Furthermore, the architecture of RepOptimizer is friendly to wrap quant-models for QAT. | ||
|
||
## Training | ||
The training of V6-RepOpt can be divided into two stages, hyperparameter search and target network training. | ||
1. hyperparameter search. This stage is used to get a suitable 'scale' for RepOptimizer, and the result checkpoint can be passed to stage2. Remember to add `training_mode='hyper_search'` in your config. | ||
``` | ||
python tools/train.py --batch 32 --conf configs/repopt/yolov6s_hs.py --data data/coco.yaml --device 0 | ||
``` | ||
Or you can directly use the [pretrained scale](https://github.com/xingyueye/YOLOv6/releases/download/0.1.0/yolov6s_scale.pt) we provided and omit this stage. | ||
|
||
2. Training. Add the flag of `training_mode='repopt'` and pretraind model `pretrained='./assets/yolov6s_scale.pt',` in your config | ||
``` | ||
python tools/train.py --batch 32 --conf configs/repopt/yolov6s_opt.py --data data/coco.yaml --device 0 | ||
``` | ||
## Evaluation | ||
Reproduce mAP on COCO val2017 dataset, you can directly test our [pretrained model](https://github.com/xingyueye/YOLOv6/releases/download/0.1.0/yolov6s_opt.pt). | ||
``` | ||
python tools/eval.py --data data/coco.yaml --batch 32 --weights yolov6s_opt.pt --task val | ||
``` | ||
## Benchmark | ||
We train a yolov6s-repopt with 300epochs, the fp32 mAP is 42.4, while the mAP of PTQ is 40.5. More results is coming soon... | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.