Skip to content

Commit 3330eca

Browse files
committed
add rtdetr34
1 parent 9625be2 commit 3330eca

File tree

4 files changed

+80
-9
lines changed

4 files changed

+80
-9
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@ English | [简体中文](README_cn.md)
3737

3838
This is the official implementation of the paper "[DETRs Beat YOLOs on Real-time Object Detection](https://arxiv.org/abs/2304.08069)".
3939

40-
<!-- [Wenyu Lv](), [Yian Zhao](), [Shangliang Xu](). -->
4140

4241
## Updates!!!
43-
---
42+
- \[2023.11.07\] Add pytorch *rtdetr_r34vd* for requests [#107](https://github.com/lyuwenyu/RT-DETR/issues/107), [#114](https://github.com/lyuwenyu/RT-DETR/issues/114)
4443
- \[2023.11.05\] upgrade the logic of `remap_mscoco_category` to facilitate training of custom datasets, see detils in [*Train custom data*](./rtdetr_pytorch/) part. [#81](https://github.com/lyuwenyu/RT-DETR/commit/95fc522fd7cf26c64ffd2ad0c622c392d29a9ebf)
4544
- \[2023.10.23\] Add [*discussion for deployments*](https://github.com/lyuwenyu/RT-DETR/issues/95), supported onnxruntime, TensorRT, openVINO
4645
- \[2023.10.12\] Add tuning code for pytorch version, now you can tuning rtdetr based on pretrained weights
@@ -56,7 +55,7 @@ This is the official implementation of the paper "[DETRs Beat YOLOs on Real-time
5655

5756
## Implementations
5857
- rtdetr paddle: [code](./rtdetr_paddle), [weights](./rtdetr_paddle)
59-
- rtdetr pytorch: [code](./rtdetr_pytorch), [weights](https://github.com/lyuwenyu/RT-DETR/issues/42)
58+
- rtdetr pytorch: [code](./rtdetr_pytorch), [weights](./rtdetr_pytorch)
6059

6160

6261
| Model | Epoch | Input shape | Dataset | $AP^{val}$ | $AP^{val}_{50}$| Params(M) | FLOPs(G) | T4 TensorRT FP16(FPS)

rtdetr_pytorch/README.md

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,35 @@
11
## TODO
2+
<details>
3+
<summary> see details </summary>
4+
25
- [x] Training
36
- [x] Evaluation
47
- [x] Export onnx
58
- [x] Upload source code
6-
- [x] Upload weight convert from paddle, see [links](https://github.com/lyuwenyu/RT-DETR/issues/42)
7-
- [x] Align training details with the [paddle version](../rtdetr_paddle/)
8-
- [x] Tuning rtdetr based on [pretrained weights](https://github.com/lyuwenyu/RT-DETR/issues/42)
9+
- [x] Upload weight convert from paddle, see [*links*](https://github.com/lyuwenyu/RT-DETR/issues/42)
10+
- [x] Align training details with the [*paddle version*](../rtdetr_paddle/)
11+
- [x] Tuning rtdetr based on [*pretrained weights*](https://github.com/lyuwenyu/RT-DETR/issues/42)
12+
13+
</details>
14+
15+
16+
## Model Zoo
17+
18+
| Model | Dataset | Input Size | AP<sup>val</sup> | AP<sub>50</sub><sup>val</sup> | #Params(M) | FPS | checkpoint |
19+
| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
20+
rtdetr_r18vd | COCO | 640 | 46.4 | 63.7 | 20 | 217 | [url<sup>*</sup>](https://github.com/lyuwenyu/storage/releases/download/v0.1/rtdetr_r18vd_dec3_6x_coco_from_paddle.pth)
21+
rtdetr_r34vd | COCO | 640 | 48.9 | 66.8 | 31 | 161 | [url<sup>*</sup>](https://github.com/lyuwenyu/storage/releases/download/v0.1/rtdetr_r34vd_dec4_6x_coco_from_paddle.pth)
22+
rtdetr_r50vd_m | COCO | 640 | 51.3 | 69.5 | 36 | 145 | [url<sup>*</sup>](https://github.com/lyuwenyu/storage/releases/download/v0.1/rtdetr_r50vd_m_6x_coco_from_paddle.pth)
23+
rtdetr_r50vd | COCO | 640 | 53.1 | 71.2| 42 | 108 | [url<sup>*</sup>](https://github.com/lyuwenyu/storage/releases/download/v0.1/rtdetr_r50vd_6x_coco_from_paddle.pth)
24+
rtdetr_r101vd | COCO | 640 | 54.3 | 72.8 | 76 | 74 | [url<sup>*</sup>](https://github.com/lyuwenyu/storage/releases/download/v0.1/rtdetr_r101vd_6x_coco_from_paddle.pth)
25+
rtdetr_18vd | COCO+Objects365 | 640 | 49.0 | 66.5 | 20 | 217 | [url<sup>*</sup>](https://github.com/lyuwenyu/storage/releases/download/v0.1/rtdetr_r18vd_5x_coco_objects365_from_paddle.pth)
26+
rtdetr_r50vd | COCO+Objects365 | 640 | 55.2 | 73.4 | 42 | 108 | [url<sup>*</sup>](https://github.com/lyuwenyu/storage/releases/download/v0.1/rtdetr_r50vd_2x_coco_objects365_from_paddle.pth)
27+
rtdetr_r101vd | COCO+Objects365 | 640 | 56.2 | 74.5 | 76 | 74 | [url<sup>*</sup>](https://github.com/lyuwenyu/storage/releases/download/v0.1/rtdetr_r101vd_2x_coco_objects365_from_paddle.pth)
28+
29+
Notes
30+
- `COCO + Objects365` in the table means finetuned model on `COCO` using pretrained weights trained on `Objects365`.
31+
- `url`<sup>`*`</sup> is the url of pretrained weights convert from paddle model for save energy. *It may have slight differences between this table and paper*
32+
<!-- - `FPS` is evaluated on a single T4 GPU with $batch\\_size = 1$ and $tensorrt\\_fp16$ mode -->
933

1034
## Quick start
1135

@@ -79,7 +103,7 @@ python tools/export_onnx.py -c configs/rtdetr/rtdetr_r18vd_6x_coco.yml -r path/t
79103
<details open>
80104
<summary>Train custom data</summary>
81105

82-
1. set `remap_mscoco_category: False`. This variable only works for ms-coco dataset. If you want to use `remap_mscoco_category` logic on your dataset, please modify variable [`mscoco_category2name`](https://github.com/lyuwenyu/RT-DETR/blob/main/rtdetr_pytorch/src/data/coco/coco_dataset.py) based on your dataset.
106+
1. set `remap_mscoco_category: False`. This variable only works for ms-coco dataset. If you want to use `remap_mscoco_category` logic on your dataset, please modify variable [`mscoco_category2name`](https://github.com/lyuwenyu/RT-DETR/blob/main/rtdetr_pytorch/src/data/coco/coco_dataset.py#L154) based on your dataset.
83107

84108
2. add `-t path/to/checkpoint` (optinal) to tuning rtdetr based on pretrained checkpoint. see [training script details](./tools/README.md).
85109
</details>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
2+
__include__: [
3+
'../dataset/coco_detection.yml',
4+
'../runtime.yml',
5+
'./include/dataloader.yml',
6+
'./include/optimizer.yml',
7+
'./include/rtdetr_r50vd.yml',
8+
]
9+
10+
11+
output_dir: ./output/rtdetr_r34vd_6x_coco
12+
13+
14+
PResNet:
15+
depth: 34
16+
freeze_at: -1
17+
freeze_norm: False
18+
pretrained: True
19+
20+
21+
HybridEncoder:
22+
in_channels: [128, 256, 512]
23+
hidden_dim: 256
24+
expansion: 0.5
25+
26+
27+
RTDETRTransformer:
28+
num_decoder_layers: 4
29+
30+
31+
32+
optimizer:
33+
type: AdamW
34+
params:
35+
-
36+
params: '^(?=.*backbone)(?=.*norm|bn).*$'
37+
weight_decay: 0.
38+
lr: 0.00001
39+
-
40+
params: '^(?=.*backbone)(?!.*norm|bn).*$'
41+
lr: 0.00001
42+
-
43+
params: '^(?=.*(?:encoder|decoder))(?=.*(?:norm|bn|bias)).*$'
44+
weight_decay: 0.
45+
46+
lr: 0.0001
47+
betas: [0.9, 0.999]
48+
weight_decay: 0.0001

rtdetr_pytorch/src/optim/ema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ def state_dict(self, ):
8383

8484
def load_state_dict(self, state):
8585
self.module.load_state_dict(state['module'])
86-
self.updates = state['updates']
87-
self.warmups = state['warmups']
86+
if 'updates' in state:
87+
self.updates = state['updates']
8888

8989
def forwad(self, ):
9090
raise RuntimeError('ema...')

0 commit comments

Comments
 (0)