Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Support imagenet pre-training for RTMDet's backbone. #8887

Merged
merged 8 commits into from
Sep 28, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions configs/rtmdet/cspnext_imagenet_pretrain/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# CSPNeXt ImageNet Pre-training

In this folder, we provide the imagenet pre-training config of RTMDet's backbone CSPNeXt.
To train with these configs, please install [MMClassification](https://github.com/open-mmlab/mmclassification) first.
RangiLyu marked this conversation as resolved.
Show resolved Hide resolved

## Results and Models

| Model | resolution | Params(M) | Flops(G) | Top-1 (%) | Top-5 (%) | Download |
| :----------: | :--------: | :-------: | :------: | :-------: | :-------: | :------------------------------------------------------------------------------------------------------------------------------: |
| CSPNeXt-tiny | 224x224 | 2.73 | 0.339 | 69.44 | 89.45 | [model](https://download.openmmlab.com/mmdetection/v3.0/rtmdet/cspnext_rsb_pretrain/cspnext_tiny/cspnext-tiny_imagenet_600e.pth) |
RangiLyu marked this conversation as resolved.
Show resolved Hide resolved
| CSPNeXt-s | 224x224 | 4.89 | 0.664 | 74.41 | 92.23 | [model](https://download.openmmlab.com/mmdetection/v3.0/rtmdet/cspnext_rsb_pretrain/cspnext_tiny/cspnext-s_imagenet_600e.pth) |
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
_base_ = [
RangiLyu marked this conversation as resolved.
Show resolved Hide resolved
'mmcls::_base_/datasets/imagenet_bs256_rsb_a12.py',
'mmcls::_base_/schedules/imagenet_bs2048_rsb.py',
'mmcls::_base_/default_runtime.py'
]

custom_imports = dict(imports=['mmdet.models'], allow_failed_imports=False)

model = dict(
type='ImageClassifier',
backbone=dict(
type='mmdet.CSPNeXt',
arch='P5',
out_indices=(4, ),
expand_ratio=0.5,
deepen_factor=0.33,
widen_factor=0.5,
channel_attention=True,
norm_cfg=dict(type='BN'),
act_cfg=dict(type='mmdet.SiLU')),
neck=dict(type='GlobalAveragePooling'),
head=dict(
type='LinearClsHead',
num_classes=1000,
in_channels=512,
loss=dict(
type='LabelSmoothLoss',
label_smooth_val=0.1,
mode='original',
loss_weight=1.0),
topk=(1, 5)),
train_cfg=dict(augments=[
dict(type='Mixup', alpha=0.2, num_classes=1000),
dict(type='CutMix', alpha=1.0, num_classes=1000)
]))

# dataset settings
train_dataloader = dict(sampler=dict(type='RepeatAugSampler', shuffle=True))

# schedule settings
optim_wrapper = dict(
optimizer=dict(weight_decay=0.01),
paramwise_cfg=dict(bias_decay_mult=0., norm_decay_mult=0.),
)

param_scheduler = [
# warm up learning rate scheduler
dict(
type='LinearLR',
start_factor=0.0001,
by_epoch=True,
begin=0,
end=5,
# update by iter
convert_to_iter_based=True),
# main learning rate scheduler
dict(
type='CosineAnnealingLR',
T_max=595,
eta_min=1.0e-6,
by_epoch=True,
begin=5,
end=600)
]

train_cfg = dict(by_epoch=True, max_epochs=600)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
_base_ = './cspnext-s_8xb256-rsb-a1-600e_in1k.py'

model = dict(
backbone=dict(deepen_factor=0.167, widen_factor=0.375),
head=dict(in_channels=384))
2 changes: 1 addition & 1 deletion configs/rtmdet/rtmdet_s_8xb32-300e_coco.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
_base_ = './rtmdet_l_8xb32-300e_coco.py'
checkpoint = 'TODO:imagenet_pretrain' # noqa
checkpoint = 'https://download.openmmlab.com/mmdetection/v3.0/rtmdet/cspnext_rsb_pretrain/cspnext_tiny/cspnext-s_imagenet_600e.pth' # noqa
model = dict(
backbone=dict(
deepen_factor=0.33,
Expand Down
2 changes: 1 addition & 1 deletion configs/rtmdet/rtmdet_tiny_8xb32-300e_coco.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
_base_ = './rtmdet_s_8xb32-300e_coco.py'

checkpoint = 'TODO:imagenet_pretrain' # noqa
checkpoint = 'https://download.openmmlab.com/mmdetection/v3.0/rtmdet/cspnext_rsb_pretrain/cspnext_tiny/cspnext-tiny_imagenet_600e.pth' # noqa

model = dict(
backbone=dict(
Expand Down