Skip to content

Commit ec3eb1f

Browse files
authored
[dev] add ppyoloe_plus configs and alter NormalizeImage (PaddlePaddle#6675)
* [dev] add ppyoloe_plus configs and alter NormalizeImage * alter other NormalizeImage * alter cpp NormalizeImage
1 parent 6ddca83 commit ec3eb1f

26 files changed

+317
-122
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
epoch: 80
2+
3+
LearningRate:
4+
base_lr: 0.001
5+
schedulers:
6+
- !CosineDecay
7+
max_epochs: 96
8+
- !LinearWarmup
9+
start_factor: 0.
10+
epochs: 5
11+
12+
OptimizerBuilder:
13+
optimizer:
14+
momentum: 0.9
15+
type: Momentum
16+
regularizer:
17+
factor: 0.0005
18+
type: L2
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
architecture: YOLOv3
2+
norm_type: sync_bn
3+
use_ema: true
4+
ema_decay: 0.9998
5+
6+
YOLOv3:
7+
backbone: CSPResNet
8+
neck: CustomCSPPAN
9+
yolo_head: PPYOLOEHead
10+
post_process: ~
11+
12+
CSPResNet:
13+
layers: [3, 6, 6, 3]
14+
channels: [64, 128, 256, 512, 1024]
15+
return_idx: [1, 2, 3]
16+
use_large_stem: True
17+
use_alpha: True
18+
19+
CustomCSPPAN:
20+
out_channels: [768, 384, 192]
21+
stage_num: 1
22+
block_num: 3
23+
act: 'swish'
24+
spp: true
25+
26+
PPYOLOEHead:
27+
fpn_strides: [32, 16, 8]
28+
grid_cell_scale: 5.0
29+
grid_cell_offset: 0.5
30+
static_assigner_epoch: 30
31+
use_varifocal_loss: True
32+
loss_weight: {class: 1.0, iou: 2.5, dfl: 0.5}
33+
static_assigner:
34+
name: ATSSAssigner
35+
topk: 9
36+
assigner:
37+
name: TaskAlignedAssigner
38+
topk: 13
39+
alpha: 1.0
40+
beta: 6.0
41+
nms:
42+
name: MultiClassNMS
43+
nms_top_k: 1000
44+
keep_top_k: 300
45+
score_threshold: 0.01
46+
nms_threshold: 0.7
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
worker_num: 4
2+
eval_height: &eval_height 640
3+
eval_width: &eval_width 640
4+
eval_size: &eval_size [*eval_height, *eval_width]
5+
6+
TrainReader:
7+
sample_transforms:
8+
- Decode: {}
9+
- RandomDistort: {}
10+
- RandomExpand: {fill_value: [123.675, 116.28, 103.53]}
11+
- RandomCrop: {}
12+
- RandomFlip: {}
13+
batch_transforms:
14+
- BatchRandomResize: {target_size: [320, 352, 384, 416, 448, 480, 512, 544, 576, 608, 640, 672, 704, 736, 768], random_size: True, random_interp: True, keep_ratio: False}
15+
- NormalizeImage: {mean: [0., 0., 0.], std: [1., 1., 1.], norm_type: none}
16+
- Permute: {}
17+
- PadGT: {}
18+
batch_size: 8
19+
shuffle: true
20+
drop_last: true
21+
use_shared_memory: true
22+
collate_batch: true
23+
24+
EvalReader:
25+
sample_transforms:
26+
- Decode: {}
27+
- Resize: {target_size: *eval_size, keep_ratio: False, interp: 2}
28+
- NormalizeImage: {mean: [0., 0., 0.], std: [1., 1., 1.], norm_type: none}
29+
- Permute: {}
30+
batch_size: 2
31+
32+
TestReader:
33+
inputs_def:
34+
image_shape: [3, *eval_height, *eval_width]
35+
sample_transforms:
36+
- Decode: {}
37+
- Resize: {target_size: *eval_size, keep_ratio: False, interp: 2}
38+
- NormalizeImage: {mean: [0., 0., 0.], std: [1., 1., 1.], norm_type: none}
39+
- Permute: {}
40+
batch_size: 1
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# PP-YOLOE Legacy Model Zoo (2022.03)
2+
3+
## Legacy Model Zoo
4+
| Model | Epoch | GPU number | images/GPU | backbone | input shape | Box AP<sup>val<br>0.5:0.95 | Box AP<sup>test<br>0.5:0.95 | Params(M) | FLOPs(G) | V100 FP32(FPS) | V100 TensorRT FP16(FPS) | download | config |
5+
|:------------------------:|:-------:|:-------:|:--------:|:----------:| :-------:| :------------------: | :-------------------: |:---------:|:--------:|:---------------:| :---------------------: | :------: | :------: |
6+
| PP-YOLOE-s | 400 | 8 | 32 | cspresnet-s | 640 | 43.4 | 43.6 | 7.93 | 17.36 | 208.3 | 333.3 | [model](https://paddledet.bj.bcebos.com/models/ppyoloe_crn_s_400e_coco.pdparams) | [config](./ppyoloe_crn_s_400e_coco.yml) |
7+
| PP-YOLOE-s | 300 | 8 | 32 | cspresnet-s | 640 | 43.0 | 43.2 | 7.93 | 17.36 | 208.3 | 333.3 | [model](https://paddledet.bj.bcebos.com/models/ppyoloe_crn_s_300e_coco.pdparams) | [config](./ppyoloe_crn_s_300e_coco.yml) |
8+
| PP-YOLOE-m | 300 | 8 | 28 | cspresnet-m | 640 | 49.0 | 49.1 | 23.43 | 49.91 | 123.4 | 208.3 | [model](https://paddledet.bj.bcebos.com/models/ppyoloe_crn_m_300e_coco.pdparams) | [config](./ppyoloe_crn_m_300e_coco.yml) |
9+
| PP-YOLOE-l | 300 | 8 | 20 | cspresnet-l | 640 | 51.4 | 51.6 | 52.20 | 110.07 | 78.1 | 149.2 | [model](https://paddledet.bj.bcebos.com/models/ppyoloe_crn_l_300e_coco.pdparams) | [config](./ppyoloe_crn_l_300e_coco.yml) |
10+
| PP-YOLOE-x | 300 | 8 | 16 | cspresnet-x | 640 | 52.3 | 52.4 | 98.42 | 206.59 | 45.0 | 95.2 | [model](https://paddledet.bj.bcebos.com/models/ppyoloe_crn_x_300e_coco.pdparams) | [config](./ppyoloe_crn_x_300e_coco.yml) |
11+
12+
### Comprehensive Metrics
13+
| Model | Epoch | AP<sup>0.5:0.95 | AP<sup>0.5 | AP<sup>0.75 | AP<sup>small | AP<sup>medium | AP<sup>large | AR<sup>small | AR<sup>medium | AR<sup>large | download | config |
14+
|:----------------------:|:-----:|:---------------:|:----------:|:-------------:| :------------:| :-----------: | :----------: |:------------:|:-------------:|:------------:| :-----: | :-----: |
15+
| PP-YOLOE-s | 400 | 43.4 | 60.0 | 47.5 | 25.7 | 47.8 | 59.2 | 43.9 | 70.8 | 81.9 | [model](https://paddledet.bj.bcebos.com/models/ppyoloe_crn_s_400e_coco.pdparams) | [config](./ppyoloe_crn_s_400e_coco.yml)|
16+
| PP-YOLOE-s | 300 | 43.0 | 59.6 | 47.2 | 26.0 | 47.4 | 58.7 | 45.1 | 70.6 | 81.4 | [model](https://paddledet.bj.bcebos.com/models/ppyoloe_crn_s_300e_coco.pdparams) | [config](./ppyoloe_crn_s_300e_coco.yml)|
17+
| PP-YOLOE-m | 300 | 49.0 | 65.9 | 53.8 | 30.9 | 53.5 | 65.3 | 50.9 | 74.4 | 84.7 | [model](https://paddledet.bj.bcebos.com/models/ppyoloe_crn_m_300e_coco.pdparams) | [config](./ppyoloe_crn_m_300e_coco.yml)|
18+
| PP-YOLOE-l | 300 | 51.4 | 68.6 | 56.2 | 34.8 | 56.1 | 68.0 | 53.1 | 76.8 | 85.6 | [model](https://paddledet.bj.bcebos.com/models/ppyoloe_crn_l_300e_coco.pdparams) | [config](./ppyoloe_crn_l_300e_coco.yml)|
19+
| PP-YOLOE-x | 300 | 52.3 | 69.5 | 56.8 | 35.1 | 57.0 | 68.6 | 55.5 | 76.9 | 85.7 | [model](https://paddledet.bj.bcebos.com/models/ppyoloe_crn_x_300e_coco.pdparams) | [config](./ppyoloe_crn_x_300e_coco.yml)|
20+
21+
22+
**Notes:**
23+
24+
- PP-YOLOE is trained on COCO train2017 dataset and evaluated on val2017 & test-dev2017 dataset.
25+
- The model weights in the table of Comprehensive Metrics are **the same as** that in the original Model Zoo, and evaluated on **val2017**.
26+
- PP-YOLOE used 8 GPUs for training, if **GPU number** or **mini-batch size** is changed, **learning rate** should be adjusted according to the formula **lr<sub>new</sub> = lr<sub>default</sub> * (batch_size<sub>new</sub> * GPU_number<sub>new</sub>) / (batch_size<sub>default</sub> * GPU_number<sub>default</sub>)**.
27+
- PP-YOLOE inference speed is tesed on single Tesla V100 with batch size as 1, **CUDA 10.2**, **CUDNN 7.6.5**, **TensorRT 6.0.1.8** in TensorRT mode.
28+
29+
## Appendix
30+
31+
Ablation experiments of PP-YOLOE.
32+
33+
| NO. | Model | Box AP<sup>val</sup> | Params(M) | FLOPs(G) | V100 FP32 FPS |
34+
| :--: | :---------------------------: | :------------------: | :-------: | :------: | :-----------: |
35+
| A | PP-YOLOv2 | 49.1 | 54.58 | 115.77 | 68.9 |
36+
| B | A + Anchor-free | 48.8 | 54.27 | 114.78 | 69.8 |
37+
| C | B + CSPRepResNet | 49.5 | 47.42 | 101.87 | 85.5 |
38+
| D | C + TAL | 50.4 | 48.32 | 104.75 | 84.0 |
39+
| E | D + ET-Head | 50.9 | 52.20 | 110.07 | 78.1 |

configs/ppyoloe/_base_/optimizer_300e.yml renamed to configs/ppyoloe/legacy_model/_base_/optimizer_300e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
epoch: 300
22

33
LearningRate:
4-
base_lr: 0.025
4+
base_lr: 0.01
55
schedulers:
66
- !CosineDecay
77
max_epochs: 360
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
epoch: 400
2+
3+
LearningRate:
4+
base_lr: 0.01
5+
schedulers:
6+
- !CosineDecay
7+
max_epochs: 480
8+
- !LinearWarmup
9+
start_factor: 0.
10+
epochs: 5
11+
12+
OptimizerBuilder:
13+
optimizer:
14+
momentum: 0.9
15+
type: Momentum
16+
regularizer:
17+
factor: 0.0005
18+
type: L2

configs/ppyoloe/_base_/ppyoloe_reader.yml renamed to configs/ppyoloe/legacy_model/_base_/ppyoloe_reader.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ TrainReader:
1515
- NormalizeImage: {mean: [0.485, 0.456, 0.406], std: [0.229, 0.224, 0.225], is_scale: True}
1616
- Permute: {}
1717
- PadGT: {}
18-
batch_size: 20
18+
batch_size: 8
1919
shuffle: true
2020
drop_last: true
2121
use_shared_memory: true

configs/ppyoloe/ppyoloe_crn_l_300e_coco.yml renamed to configs/ppyoloe/legacy_model/ppyoloe_crn_l_300e_coco.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
_BASE_: [
2-
'../datasets/coco_detection.yml',
3-
'../runtime.yml',
2+
'../../datasets/coco_detection.yml',
3+
'../../runtime.yml',
44
'./_base_/optimizer_300e.yml',
55
'./_base_/ppyoloe_crn.yml',
66
'./_base_/ppyoloe_reader.yml',

configs/ppyoloe/ppyoloe_crn_l_36e_coco_xpu.yml renamed to configs/ppyoloe/legacy_model/ppyoloe_crn_l_36e_coco_xpu.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
_BASE_: [
2-
'../datasets/coco_detection.yml',
3-
'../runtime.yml',
2+
'../../datasets/coco_detection.yml',
3+
'../../runtime.yml',
44
'./_base_/optimizer_36e_xpu.yml',
55
'./_base_/ppyoloe_reader.yml',
66
]
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
_BASE_: [
2-
'../datasets/coco_detection.yml',
3-
'../runtime.yml',
2+
'../../datasets/coco_detection.yml',
3+
'../../runtime.yml',
44
'./_base_/optimizer_300e.yml',
55
'./_base_/ppyoloe_crn.yml',
66
'./_base_/ppyoloe_reader.yml',
@@ -13,9 +13,3 @@ weights: output/ppyoloe_crn_m_300e_coco/model_final
1313
pretrain_weights: https://paddledet.bj.bcebos.com/models/pretrained/CSPResNetb_m_pretrained.pdparams
1414
depth_mult: 0.67
1515
width_mult: 0.75
16-
17-
TrainReader:
18-
batch_size: 28
19-
20-
LearningRate:
21-
base_lr: 0.035
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
_BASE_: [
2-
'../datasets/coco_detection.yml',
3-
'../runtime.yml',
2+
'../../datasets/coco_detection.yml',
3+
'../../runtime.yml',
44
'./_base_/optimizer_300e.yml',
55
'./_base_/ppyoloe_crn.yml',
66
'./_base_/ppyoloe_reader.yml',
@@ -13,9 +13,3 @@ weights: output/ppyoloe_crn_s_300e_coco/model_final
1313
pretrain_weights: https://paddledet.bj.bcebos.com/models/pretrained/CSPResNetb_s_pretrained.pdparams
1414
depth_mult: 0.33
1515
width_mult: 0.50
16-
17-
TrainReader:
18-
batch_size: 32
19-
20-
LearningRate:
21-
base_lr: 0.04
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
_BASE_: [
2+
'../../datasets/coco_detection.yml',
3+
'../../runtime.yml',
4+
'./_base_/optimizer_400e.yml',
5+
'./_base_/ppyoloe_crn.yml',
6+
'./_base_/ppyoloe_reader.yml',
7+
]
8+
9+
log_iter: 100
10+
snapshot_epoch: 10
11+
weights: output/ppyoloe_crn_s_400e_coco/model_final
12+
13+
pretrain_weights: https://paddledet.bj.bcebos.com/models/pretrained/CSPResNetb_s_pretrained.pdparams
14+
depth_mult: 0.33
15+
width_mult: 0.50
16+
17+
PPYOLOEHead:
18+
static_assigner_epoch: 133
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
_BASE_: [
2-
'../datasets/coco_detection.yml',
3-
'../runtime.yml',
2+
'../../datasets/coco_detection.yml',
3+
'../../runtime.yml',
44
'./_base_/optimizer_300e.yml',
55
'./_base_/ppyoloe_crn.yml',
66
'./_base_/ppyoloe_reader.yml',
@@ -13,9 +13,3 @@ weights: output/ppyoloe_crn_x_300e_coco/model_final
1313
pretrain_weights: https://paddledet.bj.bcebos.com/models/pretrained/CSPResNetb_x_pretrained.pdparams
1414
depth_mult: 1.33
1515
width_mult: 1.25
16-
17-
TrainReader:
18-
batch_size: 16
19-
20-
LearningRate:
21-
base_lr: 0.02

configs/ppyoloe/ppyoloe_crn_s_400e_coco.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
_BASE_: [
2+
'../datasets/coco_detection.yml',
3+
'../runtime.yml',
4+
'./_base_/optimizer_80e.yml',
5+
'./_base_/ppyoloe_plus_crn.yml',
6+
'./_base_/ppyoloe_plus_reader.yml',
7+
]
8+
9+
log_iter: 100
10+
snapshot_epoch: 5
11+
weights: output/ppyoloe_plus_crn_l_80e_coco/model_final
12+
13+
pretrain_weights: https://bj.bcebos.com/v1/paddledet/models/pretrained/ppyoloe_crn_l_obj365_pretrained.pdparams
14+
depth_mult: 1.0
15+
width_mult: 1.0
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
_BASE_: [
2+
'../datasets/coco_detection.yml',
3+
'../runtime.yml',
4+
'./_base_/optimizer_80e.yml',
5+
'./_base_/ppyoloe_plus_crn.yml',
6+
'./_base_/ppyoloe_plus_reader.yml',
7+
]
8+
9+
log_iter: 100
10+
snapshot_epoch: 5
11+
weights: output/ppyoloe_plus_crn_m_80e_coco/model_final
12+
13+
pretrain_weights: https://bj.bcebos.com/v1/paddledet/models/pretrained/ppyoloe_crn_m_obj365_pretrained.pdparams
14+
depth_mult: 0.67
15+
width_mult: 0.75
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
_BASE_: [
2+
'../datasets/coco_detection.yml',
3+
'../runtime.yml',
4+
'./_base_/optimizer_80e.yml',
5+
'./_base_/ppyoloe_plus_crn.yml',
6+
'./_base_/ppyoloe_plus_reader.yml',
7+
]
8+
9+
log_iter: 100
10+
snapshot_epoch: 5
11+
weights: output/ppyoloe_plus_crn_s_80e_coco/model_final
12+
13+
pretrain_weights: https://bj.bcebos.com/v1/paddledet/models/pretrained/ppyoloe_crn_s_obj365_pretrained.pdparams
14+
depth_mult: 0.33
15+
width_mult: 0.50
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
_BASE_: [
2+
'../datasets/coco_detection.yml',
3+
'../runtime.yml',
4+
'./_base_/optimizer_80e.yml',
5+
'./_base_/ppyoloe_plus_crn.yml',
6+
'./_base_/ppyoloe_plus_reader.yml',
7+
]
8+
9+
log_iter: 100
10+
snapshot_epoch: 5
11+
weights: output/ppyoloe_plus_crn_x_80e_coco/model_final
12+
13+
pretrain_weights: https://bj.bcebos.com/v1/paddledet/models/pretrained/ppyoloe_crn_x_obj365_pretrained.pdparams
14+
depth_mult: 1.33
15+
width_mult: 1.25

0 commit comments

Comments
 (0)