Skip to content

Commit f428680

Browse files
rentainhentianhe ren
andauthored
[Enhance] Update deformable-detr-two-stage training results (#103)
* refine README * set cost class=1 * fix typos * update table * update download links * refine readme and docs Co-authored-by: ntianhe ren <[email protected]>
1 parent da7a935 commit f428680

File tree

9 files changed

+20
-33
lines changed

9 files changed

+20
-33
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Results and models are available in [model zoo](https://detrex.readthedocs.io/en
7373
<summary> Supported methods </summary>
7474

7575
- [x] [DETR (ECCV'2020)](./projects/detr/)
76-
- [x] [Deformable-DETR (ICLR'2021 Oral)](./projects/dab_deformable_detr/)
76+
- [x] [Deformable-DETR (ICLR'2021 Oral)](./projects/deformable_detr/)
7777
- [x] [Conditional-DETR (ICCV'2021)](./projects/conditional_detr/)
7878
- [x] [DAB-DETR (ICLR'2022)](./projects/dab_detr/)
7979
- [x] [DAB-Deformable-DETR (ICLR'2022)](./projects/dab_deformable_detr/)

docs/source/tutorials/Model_Zoo.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ Here we provides our pretrained baselines in `detrex beta v0.1.0`. And more pret
3131
<td align="center">R50</td>
3232
<td align="center">IN1k</td>
3333
<td align="center">50</td>
34-
<td align="center">47.28</td>
35-
<td align="center"> <a href="https://github.com/IDEA-Research/detrex-storage/releases/download/v0.1.1/deformable_detr_r50_two_stage_50ep.pth"> model </a></td>
34+
<td align="center">48.19</td>
35+
<td align="center"> <a href="https://github.com/IDEA-Research/detrex-storage/releases/download/v0.1.1/deformable_detr_r50_two_stage_50ep_new.pth"> model </a></td>
3636
</tr>
3737
</tbody></table>
3838

@@ -158,42 +158,42 @@ Here we provides our pretrained baselines in `detrex beta v0.1.0`. And more pret
158158
<td align="center">49.95</td>
159159
<td align="center"> <a href="https://github.com/IDEA-Research/detrex-storage/releases/download/v0.1.1/dino_r101_4scale_12ep.pth"> model </a></td>
160160
</tr>
161-
<tr><td align="left"> <a href="https://github.com/IDEA-Research/detrex/blob/main/projects/dino/configs/dino_swin_tiny_224_4scale_12ep.py"> DINO-Swin-T-224-4scale </a> </td>
161+
<tr><td align="left"> <a href="https://github.com/IDEA-Research/detrex/blob/main/projects/dino/configs/dino_swin_tiny_224_4scale_12ep.py"> DINO-Swin-T-224-4Scale </a> </td>
162162
<td align="center">Swin-Tiny-224</td>
163163
<td align="center">IN1k</td>
164164
<td align="center">12</td>
165165
<td align="center">51.30</td>
166166
<td align="center"> <a href="https://github.com/IDEA-Research/detrex-storage/releases/download/v0.1.1/dino_swin_tiny_224_4scale_12ep.pth"> model </a></td>
167167
</tr>
168-
<tr><td align="left"> <a href="https://github.com/IDEA-Research/detrex/blob/main/projects/dino/configs/dino_swin_tiny_224_4scale_12ep.py"> DINO-Swin-T-224-4scale </a> </td>
168+
<tr><td align="left"> <a href="https://github.com/IDEA-Research/detrex/blob/main/projects/dino/configs/dino_swin_tiny_224_4scale_12ep.py"> DINO-Swin-T-224-4Scale </a> </td>
169169
<td align="center">Swin-Tiny-224</td>
170170
<td align="center">IN22k to IN1k</td>
171171
<td align="center">12</td>
172172
<td align="center">52.50</td>
173173
<td align="center"> <a href="https://github.com/IDEA-Research/detrex-storage/releases/download/v0.1.1/dino_swin_tiny_224_22kto1k_finetune_4scale_12ep.pth"> model </a></td>
174174
</tr>
175-
<tr><td align="left"> <a href="https://github.com/IDEA-Research/detrex/blob/main/projects/dino/configs/dino_swin_small_224_4scale_12ep.py"> DINO-Swin-S-224-4scale </a> </td>
175+
<tr><td align="left"> <a href="https://github.com/IDEA-Research/detrex/blob/main/projects/dino/configs/dino_swin_small_224_4scale_12ep.py"> DINO-Swin-S-224-4Scale </a> </td>
176176
<td align="center">Swin-Small-224</td>
177177
<td align="center">IN1k</td>
178178
<td align="center">12</td>
179179
<td align="center">52.96</td>
180180
<td align="center"> <a href="https://github.com/IDEA-Research/detrex-storage/releases/download/v0.1.1/dino_swin_small_224_4scale_12ep.pth"> model </a></td>
181181
</tr>
182-
<tr><td align="left"> <a href="https://github.com/IDEA-Research/detrex/blob/main/projects/dino/configs/dino_swin_base_384_4scale_12ep.py"> DINO-Swin-B-384-4scale </a> </td>
182+
<tr><td align="left"> <a href="https://github.com/IDEA-Research/detrex/blob/main/projects/dino/configs/dino_swin_base_384_4scale_12ep.py"> DINO-Swin-B-384-4Scale </a> </td>
183183
<td align="center">Swin-Base-384</td>
184184
<td align="center">IN22k to IN1k</td>
185185
<td align="center">12</td>
186186
<td align="center">55.83</td>
187187
<td align="center"> <a href="https://github.com/IDEA-Research/detrex-storage/releases/download/v0.1.1/dino_swin_base_384_4scale_12ep.pth"> model </a></td>
188188
</tr>
189-
<tr><td align="left"> <a href="https://github.com/IDEA-Research/detrex/blob/main/projects/dino/configs/dino_swin_large_224_4scale_12ep.py"> DINO-Swin-L-224-4scale </a> </td>
189+
<tr><td align="left"> <a href="https://github.com/IDEA-Research/detrex/blob/main/projects/dino/configs/dino_swin_large_224_4scale_12ep.py"> DINO-Swin-L-224-4Scale </a> </td>
190190
<td align="center">Swin-Large-224</td>
191191
<td align="center">IN22k to IN1k</td>
192192
<td align="center">12</td>
193193
<td align="center">56.92</td>
194194
<td align="center"> <a href="https://github.com/IDEA-Research/detrex-storage/releases/download/v0.1.1/dino_swin_large_224_4scale_12ep.pth"> model </a></td>
195195
</tr>
196-
<tr><td align="left"> <a href="https://github.com/IDEA-Research/detrex/blob/main/projects/dino/configs/dino_swin_large_384_4scale_12ep.py"> DINO-Swin-L-384-4scale </a> </td>
196+
<tr><td align="left"> <a href="https://github.com/IDEA-Research/detrex/blob/main/projects/dino/configs/dino_swin_large_384_4scale_12ep.py"> DINO-Swin-L-384-4Scale </a> </td>
197197
<td align="center">Swin-Large-384</td>
198198
<td align="center">IN22k to IN1k</td>
199199
<td align="center">12</td>

projects/dab_deformable_detr/modeling/dab_deformable_transformer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ def get_reference_points(spatial_shapes, valid_ratios, device):
311311
Args:
312312
spatial_shapes (Tensor): The shape of all
313313
feature maps, has shape (num_level, 2).
314-
valid_ratios (Tensor): The radios of valid
314+
valid_ratios (Tensor): The ratios of valid
315315
points on the feature map, has shape
316316
(bs, num_levels, 2)
317317
device (obj:`device`): The device where
@@ -337,7 +337,7 @@ def get_reference_points(spatial_shapes, valid_ratios, device):
337337
return reference_points
338338

339339
def get_valid_ratio(self, mask):
340-
"""Get the valid radios of feature maps of all level."""
340+
"""Get the valid ratios of feature maps of all levels."""
341341
_, H, W = mask.shape
342342
valid_H = torch.sum(~mask[:, :, 0], 1)
343343
valid_W = torch.sum(~mask[:, 0, :], 1)

projects/deformable_detr/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ Here we provide the pretrained `Deformable-DETR` weights based on detrex.
3434
<td align="center">R-50</td>
3535
<td align="center">IN1k</td>
3636
<td align="center">50</td>
37-
<td align="center">47.28</td>
38-
<td align="center"> <a href="https://github.com/IDEA-Research/detrex-storage/releases/download/v0.1.1/deformable_detr_r50_two_stage_50ep.pth">model</a></td>
37+
<td align="center">48.19</td>
38+
<td align="center"> <a href="https://github.com/IDEA-Research/detrex-storage/releases/download/v0.1.1/deformable_detr_r50_two_stage_50ep_new.pth">model</a></td>
3939
</tr>
4040
</tbody></table>
4141

projects/deformable_detr/configs/deformable_detr_r50_with_box_refinement_50ep.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,6 @@
33
# modify model config
44
# set loss_class to 1.0 brings better results for deformable-detr-box-refinement under lr=1e-4
55
model.with_box_refine = True
6-
model.criterion.weight_dict = {
7-
"loss_class": 1.0,
8-
"loss_bbox": 5.0,
9-
"loss_giou": 2.0,
10-
}
11-
if model.aux_loss:
12-
weight_dict = model.criterion.weight_dict
13-
aux_weight_dict = {}
14-
for i in range(model.transformer.decoder.num_layers - 1):
15-
aux_weight_dict.update({k + f"_{i}": v for k, v in weight_dict.items()})
16-
aux_weight_dict.update({k + "_enc": v for k, v in weight_dict.items()})
17-
weight_dict.update(aux_weight_dict)
18-
model.criterion.weight_dict = weight_dict
196

207
# modify training config
218
train.init_checkpoint = "detectron2://ImageNetPretrained/torchvision/R-50.pkl"

projects/deformable_detr/configs/models/deformable_detr_r50.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
gamma=2.0,
8888
),
8989
weight_dict={
90-
"loss_class": 2.0,
90+
"loss_class": 1.0,
9191
"loss_bbox": 5.0,
9292
"loss_giou": 2.0,
9393
},

projects/deformable_detr/modeling/deformable_transformer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ def get_reference_points(spatial_shapes, valid_ratios, device):
304304
Args:
305305
spatial_shapes (Tensor): The shape of all
306306
feature maps, has shape (num_level, 2).
307-
valid_ratios (Tensor): The radios of valid
307+
valid_ratios (Tensor): The ratios of valid
308308
points on the feature map, has shape
309309
(bs, num_levels, 2)
310310
device (obj:`device`): The device where
@@ -330,7 +330,7 @@ def get_reference_points(spatial_shapes, valid_ratios, device):
330330
return reference_points
331331

332332
def get_valid_ratio(self, mask):
333-
"""Get the valid radios of feature maps of all level."""
333+
"""Get the valid ratios of feature maps of all levels."""
334334
_, H, W = mask.shape
335335
valid_H = torch.sum(~mask[:, :, 0], 1)
336336
valid_W = torch.sum(~mask[:, 0, :], 1)

projects/dino/modeling/dino_transformer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ def get_reference_points(spatial_shapes, valid_ratios, device):
312312
Args:
313313
spatial_shapes (Tensor): The shape of all
314314
feature maps, has shape (num_level, 2).
315-
valid_ratios (Tensor): The radios of valid
315+
valid_ratios (Tensor): The ratios of valid
316316
points on the feature map, has shape
317317
(bs, num_levels, 2)
318318
device (obj:`device`): The device where
@@ -338,7 +338,7 @@ def get_reference_points(spatial_shapes, valid_ratios, device):
338338
return reference_points
339339

340340
def get_valid_ratio(self, mask):
341-
"""Get the valid radios of feature maps of all level."""
341+
"""Get the valid ratios of feature maps of all levels."""
342342
_, H, W = mask.shape
343343
valid_H = torch.sum(~mask[:, :, 0], 1)
344344
valid_W = torch.sum(~mask[:, 0, :], 1)

projects/dn_deformable_detr/modeling/dn_deformable_transformer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ def get_reference_points(spatial_shapes, valid_ratios, device):
301301
Args:
302302
spatial_shapes (Tensor): The shape of all
303303
feature maps, has shape (num_level, 2).
304-
valid_ratios (Tensor): The radios of valid
304+
valid_ratios (Tensor): The ratios of valid
305305
points on the feature map, has shape
306306
(bs, num_levels, 2)
307307
device (obj:`device`): The device where
@@ -326,7 +326,7 @@ def get_reference_points(spatial_shapes, valid_ratios, device):
326326
return reference_points
327327

328328
def get_valid_ratio(self, mask):
329-
"""Get the valid radios of feature maps of all level."""
329+
"""Get the valid ratios of feature maps of all levels."""
330330
_, H, W = mask.shape
331331
valid_H = torch.sum(~mask[:, :, 0], 1)
332332
valid_W = torch.sum(~mask[:, 0, :], 1)

0 commit comments

Comments
 (0)