移动paddle_detection
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
# DINO: DETR with Improved DeNoising Anchor Boxes for End-to-End Object Detection
|
||||
|
||||
## Introduction
|
||||
|
||||
|
||||
[DINO](https://arxiv.org/abs/2203.03605) is an object detection model based on DETR. We reproduced the model of the paper.
|
||||
|
||||
|
||||
## Model Zoo
|
||||
|
||||
| Backbone | Model | Epochs | Box AP | Config | Log | Download |
|
||||
|:------:|:---------------:|:------:|:------:|:---------------------------------------:|:-------------------------------------------------------------------------------:|:--------------------------------------------------------------------------------:|
|
||||
| R-50 | dino_r50_4scale | 12 | 49.5 | [config](./dino_r50_4scale_1x_coco.yml) | [log](https://bj.bcebos.com/v1/paddledet/logs/dino_r50_4scale_1x_coco_49.5.log) | [model](https://paddledet.bj.bcebos.com/models/dino_r50_4scale_1x_coco.pdparams) |
|
||||
| R-50 | dino_r50_4scale | 24 | 50.8 | [config](./dino_r50_4scale_2x_coco.yml) | [log](https://bj.bcebos.com/v1/paddledet/logs/dino_r50_4scale_2x_coco_50.8.log) | [model](https://paddledet.bj.bcebos.com/models/dino_r50_4scale_2x_coco.pdparams) |
|
||||
|
||||
**Notes:**
|
||||
|
||||
- DINO is trained on COCO train2017 dataset and evaluated on val2017 results of `mAP(IoU=0.5:0.95)`.
|
||||
- DINO uses 4GPU to train.
|
||||
|
||||
GPU multi-card training
|
||||
```bash
|
||||
python -m paddle.distributed.launch --gpus 0,1,2,3 tools/train.py -c configs/dino/dino_r50_4scale_1x_coco.yml --fleet --eval
|
||||
```
|
||||
|
||||
## Custom Operator
|
||||
- Multi-scale deformable attention custom operator see [here](../../ppdet/modeling/transformers/ext_op).
|
||||
|
||||
## Citations
|
||||
```
|
||||
@misc{zhang2022dino,
|
||||
title={DINO: DETR with Improved DeNoising Anchor Boxes for End-to-End Object Detection},
|
||||
author={Hao Zhang and Feng Li and Shilong Liu and Lei Zhang and Hang Su and Jun Zhu and Lionel M. Ni and Heung-Yeung Shum},
|
||||
year={2022},
|
||||
eprint={2203.03605},
|
||||
archivePrefix={arXiv},
|
||||
primaryClass={cs.CV}
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,45 @@
|
||||
architecture: DETR
|
||||
# pretrain_weights: # rewrite in FocalNet.pretrained in ppdet/modeling/backbones/focalnet.py
|
||||
pretrain_weights: https://bj.bcebos.com/v1/paddledet/models/pretrained/focalnet_large_lrf_384_fl4_pretrained.pdparams
|
||||
hidden_dim: 256
|
||||
use_focal_loss: True
|
||||
|
||||
DETR:
|
||||
backbone: FocalNet
|
||||
transformer: DINOTransformer
|
||||
detr_head: DINOHead
|
||||
post_process: DETRPostProcess
|
||||
|
||||
FocalNet:
|
||||
arch: 'focalnet_L_384_22k_fl4'
|
||||
out_indices: [1, 2, 3]
|
||||
pretrained: https://bj.bcebos.com/v1/paddledet/models/pretrained/focalnet_large_lrf_384_fl4_pretrained.pdparams
|
||||
|
||||
DINOTransformer:
|
||||
num_queries: 900
|
||||
position_embed_type: sine
|
||||
num_levels: 4
|
||||
nhead: 8
|
||||
num_encoder_layers: 6
|
||||
num_decoder_layers: 6
|
||||
dim_feedforward: 2048
|
||||
dropout: 0.0
|
||||
activation: relu
|
||||
pe_temperature: 20
|
||||
pe_offset: 0.0
|
||||
num_denoising: 100
|
||||
label_noise_ratio: 0.5
|
||||
box_noise_scale: 1.0
|
||||
learnt_init_query: True
|
||||
|
||||
DINOHead:
|
||||
loss:
|
||||
name: DINOLoss
|
||||
loss_coeff: {class: 1, bbox: 5, giou: 2}
|
||||
aux_loss: True
|
||||
matcher:
|
||||
name: HungarianMatcher
|
||||
matcher_coeff: {class: 2, bbox: 5, giou: 2}
|
||||
|
||||
DETRPostProcess:
|
||||
num_top_queries: 300
|
||||
@@ -0,0 +1,49 @@
|
||||
architecture: DETR
|
||||
pretrain_weights: https://paddledet.bj.bcebos.com/models/pretrained/ResNet50_cos_pretrained.pdparams
|
||||
hidden_dim: 256
|
||||
use_focal_loss: True
|
||||
|
||||
|
||||
DETR:
|
||||
backbone: ResNet
|
||||
transformer: DINOTransformer
|
||||
detr_head: DINOHead
|
||||
post_process: DETRPostProcess
|
||||
|
||||
ResNet:
|
||||
# index 0 stands for res2
|
||||
depth: 50
|
||||
norm_type: bn
|
||||
freeze_at: 0
|
||||
return_idx: [1, 2, 3]
|
||||
lr_mult_list: [0.0, 0.1, 0.1, 0.1]
|
||||
num_stages: 4
|
||||
|
||||
DINOTransformer:
|
||||
num_queries: 900
|
||||
position_embed_type: sine
|
||||
num_levels: 4
|
||||
nhead: 8
|
||||
num_encoder_layers: 6
|
||||
num_decoder_layers: 6
|
||||
dim_feedforward: 2048
|
||||
dropout: 0.0
|
||||
activation: relu
|
||||
pe_temperature: 20
|
||||
pe_offset: 0.0
|
||||
num_denoising: 100
|
||||
label_noise_ratio: 0.5
|
||||
box_noise_scale: 1.0
|
||||
learnt_init_query: True
|
||||
|
||||
DINOHead:
|
||||
loss:
|
||||
name: DINOLoss
|
||||
loss_coeff: {class: 1, bbox: 5, giou: 2}
|
||||
aux_loss: True
|
||||
matcher:
|
||||
name: HungarianMatcher
|
||||
matcher_coeff: {class: 2, bbox: 5, giou: 2}
|
||||
|
||||
DETRPostProcess:
|
||||
num_top_queries: 300
|
||||
@@ -0,0 +1,40 @@
|
||||
worker_num: 4
|
||||
TrainReader:
|
||||
sample_transforms:
|
||||
- Decode: {}
|
||||
- RandomFlip: {prob: 0.5}
|
||||
- RandomSelect: { transforms1: [ RandomShortSideResize: { short_side_sizes: [ 480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800 ], max_size: 1333 } ],
|
||||
transforms2: [
|
||||
RandomShortSideResize: { short_side_sizes: [ 400, 500, 600 ] },
|
||||
RandomSizeCrop: { min_size: 384, max_size: 600 },
|
||||
RandomShortSideResize: { short_side_sizes: [ 480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800 ], max_size: 1333 } ]
|
||||
}
|
||||
- NormalizeImage: {is_scale: true, mean: [0.485, 0.456, 0.406], std: [0.229, 0.224, 0.225]}
|
||||
- NormalizeBox: {}
|
||||
- BboxXYXY2XYWH: {}
|
||||
- Permute: {}
|
||||
batch_transforms:
|
||||
- PadMaskBatch: {pad_to_stride: -1, return_pad_mask: true}
|
||||
batch_size: 4
|
||||
shuffle: true
|
||||
drop_last: true
|
||||
collate_batch: false
|
||||
use_shared_memory: false
|
||||
|
||||
|
||||
EvalReader:
|
||||
sample_transforms:
|
||||
- Decode: {}
|
||||
- Resize: {target_size: [800, 1333], keep_ratio: True}
|
||||
- NormalizeImage: {is_scale: true, mean: [0.485, 0.456, 0.406], std: [0.229, 0.224, 0.225]}
|
||||
- Permute: {}
|
||||
batch_size: 1
|
||||
|
||||
|
||||
TestReader:
|
||||
sample_transforms:
|
||||
- Decode: {}
|
||||
- Resize: {target_size: [800, 1333], keep_ratio: True}
|
||||
- NormalizeImage: {is_scale: true, mean: [0.485, 0.456, 0.406], std: [0.229, 0.224, 0.225]}
|
||||
- Permute: {}
|
||||
batch_size: 1
|
||||
@@ -0,0 +1,46 @@
|
||||
architecture: DETR
|
||||
# pretrain_weights: # rewrite in SwinTransformer.pretrained in ppdet/modeling/backbones/swin_transformer.py
|
||||
hidden_dim: 256
|
||||
use_focal_loss: True
|
||||
|
||||
DETR:
|
||||
backbone: SwinTransformer
|
||||
transformer: DINOTransformer
|
||||
detr_head: DINOHead
|
||||
post_process: DETRPostProcess
|
||||
|
||||
SwinTransformer:
|
||||
arch: 'swin_L_384' # ['swin_T_224', 'swin_S_224', 'swin_B_224', 'swin_L_224', 'swin_B_384', 'swin_L_384']
|
||||
ape: false
|
||||
drop_path_rate: 0.2
|
||||
patch_norm: true
|
||||
out_indices: [1, 2, 3]
|
||||
|
||||
DINOTransformer:
|
||||
num_queries: 900
|
||||
position_embed_type: sine
|
||||
num_levels: 4
|
||||
nhead: 8
|
||||
num_encoder_layers: 6
|
||||
num_decoder_layers: 6
|
||||
dim_feedforward: 2048
|
||||
dropout: 0.0
|
||||
activation: relu
|
||||
pe_temperature: 10000
|
||||
pe_offset: -0.5
|
||||
num_denoising: 100
|
||||
label_noise_ratio: 0.5
|
||||
box_noise_scale: 1.0
|
||||
learnt_init_query: True
|
||||
|
||||
DINOHead:
|
||||
loss:
|
||||
name: DINOLoss
|
||||
loss_coeff: {class: 1, bbox: 5, giou: 2}
|
||||
aux_loss: True
|
||||
matcher:
|
||||
name: HungarianMatcher
|
||||
matcher_coeff: {class: 2, bbox: 5, giou: 2}
|
||||
|
||||
DETRPostProcess:
|
||||
num_top_queries: 300
|
||||
@@ -0,0 +1,16 @@
|
||||
epoch: 12
|
||||
|
||||
LearningRate:
|
||||
base_lr: 0.0001
|
||||
schedulers:
|
||||
- !PiecewiseDecay
|
||||
gamma: 0.1
|
||||
milestones: [11]
|
||||
use_warmup: false
|
||||
|
||||
OptimizerBuilder:
|
||||
clip_grad_by_norm: 0.1
|
||||
regularizer: false
|
||||
optimizer:
|
||||
type: AdamW
|
||||
weight_decay: 0.0001
|
||||
@@ -0,0 +1,16 @@
|
||||
epoch: 24
|
||||
|
||||
LearningRate:
|
||||
base_lr: 0.0001
|
||||
schedulers:
|
||||
- !PiecewiseDecay
|
||||
gamma: 0.1
|
||||
milestones: [20]
|
||||
use_warmup: false
|
||||
|
||||
OptimizerBuilder:
|
||||
clip_grad_by_norm: 0.1
|
||||
regularizer: false
|
||||
optimizer:
|
||||
type: AdamW
|
||||
weight_decay: 0.0001
|
||||
@@ -0,0 +1,16 @@
|
||||
epoch: 36
|
||||
|
||||
LearningRate:
|
||||
base_lr: 0.0001
|
||||
schedulers:
|
||||
- !PiecewiseDecay
|
||||
gamma: 0.1
|
||||
milestones: [33]
|
||||
use_warmup: false
|
||||
|
||||
OptimizerBuilder:
|
||||
clip_grad_by_norm: 0.1
|
||||
regularizer: false
|
||||
optimizer:
|
||||
type: AdamW
|
||||
weight_decay: 0.0001
|
||||
@@ -0,0 +1,11 @@
|
||||
_BASE_: [
|
||||
'../datasets/coco_detection.yml',
|
||||
'../runtime.yml',
|
||||
'_base_/optimizer_1x.yml',
|
||||
'_base_/dino_r50.yml',
|
||||
'_base_/dino_reader.yml',
|
||||
]
|
||||
|
||||
weights: output/dino_r50_4scale_1x_coco/model_final
|
||||
find_unused_parameters: True
|
||||
log_iter: 100
|
||||
@@ -0,0 +1,11 @@
|
||||
_BASE_: [
|
||||
'../datasets/coco_detection.yml',
|
||||
'../runtime.yml',
|
||||
'_base_/optimizer_2x.yml',
|
||||
'_base_/dino_r50.yml',
|
||||
'_base_/dino_reader.yml',
|
||||
]
|
||||
|
||||
weights: output/dino_r50_4scale_2x_coco/model_final
|
||||
find_unused_parameters: True
|
||||
log_iter: 100
|
||||
Reference in New Issue
Block a user