Skip to content

Commit

Permalink
[Enhance] Update deformable-detr-two-stage training results (#103)
Browse files Browse the repository at this point in the history
* refine README

* set cost class=1

* fix typos

* update table

* update download links

* refine readme and docs

Co-authored-by: ntianhe ren <[email protected]>
  • Loading branch information
rentainhe and ntianhe ren authored Oct 18, 2022
1 parent da7a935 commit f428680
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 33 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Results and models are available in [model zoo](https://detrex.readthedocs.io/en
<summary> Supported methods </summary>

- [x] [DETR (ECCV'2020)](./projects/detr/)
- [x] [Deformable-DETR (ICLR'2021 Oral)](./projects/dab_deformable_detr/)
- [x] [Deformable-DETR (ICLR'2021 Oral)](./projects/deformable_detr/)
- [x] [Conditional-DETR (ICCV'2021)](./projects/conditional_detr/)
- [x] [DAB-DETR (ICLR'2022)](./projects/dab_detr/)
- [x] [DAB-Deformable-DETR (ICLR'2022)](./projects/dab_deformable_detr/)
Expand Down
16 changes: 8 additions & 8 deletions docs/source/tutorials/Model_Zoo.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ Here we provides our pretrained baselines in `detrex beta v0.1.0`. And more pret
<td align="center">R50</td>
<td align="center">IN1k</td>
<td align="center">50</td>
<td align="center">47.28</td>
<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>
<td align="center">48.19</td>
<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>
</tr>
</tbody></table>

Expand Down Expand Up @@ -158,42 +158,42 @@ Here we provides our pretrained baselines in `detrex beta v0.1.0`. And more pret
<td align="center">49.95</td>
<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>
</tr>
<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>
<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>
<td align="center">Swin-Tiny-224</td>
<td align="center">IN1k</td>
<td align="center">12</td>
<td align="center">51.30</td>
<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>
</tr>
<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>
<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>
<td align="center">Swin-Tiny-224</td>
<td align="center">IN22k to IN1k</td>
<td align="center">12</td>
<td align="center">52.50</td>
<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>
</tr>
<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>
<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>
<td align="center">Swin-Small-224</td>
<td align="center">IN1k</td>
<td align="center">12</td>
<td align="center">52.96</td>
<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>
</tr>
<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>
<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>
<td align="center">Swin-Base-384</td>
<td align="center">IN22k to IN1k</td>
<td align="center">12</td>
<td align="center">55.83</td>
<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>
</tr>
<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>
<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>
<td align="center">Swin-Large-224</td>
<td align="center">IN22k to IN1k</td>
<td align="center">12</td>
<td align="center">56.92</td>
<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>
</tr>
<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>
<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>
<td align="center">Swin-Large-384</td>
<td align="center">IN22k to IN1k</td>
<td align="center">12</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def get_reference_points(spatial_shapes, valid_ratios, device):
Args:
spatial_shapes (Tensor): The shape of all
feature maps, has shape (num_level, 2).
valid_ratios (Tensor): The radios of valid
valid_ratios (Tensor): The ratios of valid
points on the feature map, has shape
(bs, num_levels, 2)
device (obj:`device`): The device where
Expand All @@ -337,7 +337,7 @@ def get_reference_points(spatial_shapes, valid_ratios, device):
return reference_points

def get_valid_ratio(self, mask):
"""Get the valid radios of feature maps of all level."""
"""Get the valid ratios of feature maps of all levels."""
_, H, W = mask.shape
valid_H = torch.sum(~mask[:, :, 0], 1)
valid_W = torch.sum(~mask[:, 0, :], 1)
Expand Down
4 changes: 2 additions & 2 deletions projects/deformable_detr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ Here we provide the pretrained `Deformable-DETR` weights based on detrex.
<td align="center">R-50</td>
<td align="center">IN1k</td>
<td align="center">50</td>
<td align="center">47.28</td>
<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>
<td align="center">48.19</td>
<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>
</tr>
</tbody></table>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,6 @@
# modify model config
# set loss_class to 1.0 brings better results for deformable-detr-box-refinement under lr=1e-4
model.with_box_refine = True
model.criterion.weight_dict = {
"loss_class": 1.0,
"loss_bbox": 5.0,
"loss_giou": 2.0,
}
if model.aux_loss:
weight_dict = model.criterion.weight_dict
aux_weight_dict = {}
for i in range(model.transformer.decoder.num_layers - 1):
aux_weight_dict.update({k + f"_{i}": v for k, v in weight_dict.items()})
aux_weight_dict.update({k + "_enc": v for k, v in weight_dict.items()})
weight_dict.update(aux_weight_dict)
model.criterion.weight_dict = weight_dict

# modify training config
train.init_checkpoint = "detectron2://ImageNetPretrained/torchvision/R-50.pkl"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
gamma=2.0,
),
weight_dict={
"loss_class": 2.0,
"loss_class": 1.0,
"loss_bbox": 5.0,
"loss_giou": 2.0,
},
Expand Down
4 changes: 2 additions & 2 deletions projects/deformable_detr/modeling/deformable_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def get_reference_points(spatial_shapes, valid_ratios, device):
Args:
spatial_shapes (Tensor): The shape of all
feature maps, has shape (num_level, 2).
valid_ratios (Tensor): The radios of valid
valid_ratios (Tensor): The ratios of valid
points on the feature map, has shape
(bs, num_levels, 2)
device (obj:`device`): The device where
Expand All @@ -330,7 +330,7 @@ def get_reference_points(spatial_shapes, valid_ratios, device):
return reference_points

def get_valid_ratio(self, mask):
"""Get the valid radios of feature maps of all level."""
"""Get the valid ratios of feature maps of all levels."""
_, H, W = mask.shape
valid_H = torch.sum(~mask[:, :, 0], 1)
valid_W = torch.sum(~mask[:, 0, :], 1)
Expand Down
4 changes: 2 additions & 2 deletions projects/dino/modeling/dino_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def get_reference_points(spatial_shapes, valid_ratios, device):
Args:
spatial_shapes (Tensor): The shape of all
feature maps, has shape (num_level, 2).
valid_ratios (Tensor): The radios of valid
valid_ratios (Tensor): The ratios of valid
points on the feature map, has shape
(bs, num_levels, 2)
device (obj:`device`): The device where
Expand All @@ -338,7 +338,7 @@ def get_reference_points(spatial_shapes, valid_ratios, device):
return reference_points

def get_valid_ratio(self, mask):
"""Get the valid radios of feature maps of all level."""
"""Get the valid ratios of feature maps of all levels."""
_, H, W = mask.shape
valid_H = torch.sum(~mask[:, :, 0], 1)
valid_W = torch.sum(~mask[:, 0, :], 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def get_reference_points(spatial_shapes, valid_ratios, device):
Args:
spatial_shapes (Tensor): The shape of all
feature maps, has shape (num_level, 2).
valid_ratios (Tensor): The radios of valid
valid_ratios (Tensor): The ratios of valid
points on the feature map, has shape
(bs, num_levels, 2)
device (obj:`device`): The device where
Expand All @@ -326,7 +326,7 @@ def get_reference_points(spatial_shapes, valid_ratios, device):
return reference_points

def get_valid_ratio(self, mask):
"""Get the valid radios of feature maps of all level."""
"""Get the valid ratios of feature maps of all levels."""
_, H, W = mask.shape
valid_H = torch.sum(~mask[:, :, 0], 1)
valid_W = torch.sum(~mask[:, 0, :], 1)
Expand Down

0 comments on commit f428680

Please sign in to comment.