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

'init_cfg without layer key, if you do not define override' #5209

Closed
EdyQiu opened this issue May 24, 2021 · 6 comments · Fixed by #5273
Closed

'init_cfg without layer key, if you do not define override' #5209

EdyQiu opened this issue May 24, 2021 · 6 comments · Fixed by #5273
Assignees

Comments

@EdyQiu
Copy link

EdyQiu commented May 24, 2021

All I want to do is just to use faster rcnn + resnet50 on VOC dataset, to see whether the performance is close to the benchmark.
However, there is an error msg about loading the pre-trained model:
UserWarning: init_cfg without layer key, if you do not define override key either, this init_cfg will do nothing

I cloned the mmdetection project today, so every file is up-to-date.
Also, I have modified the config file to be
model = dict(
type='FasterRCNN',
#pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
norm_eval=True,
style='pytorch',
**init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50'),),
**

I realized there was an update about unified parameter initialization, but I have no clue about how to
write the init_cfg to use a pre-trained model. e.g. layer = ??? override = ???
The most related official document is open-mmlab/mmcv#780,
still, I could not solve this simple problem.

Thanks a lot for any suggestions!

@harrylin-hyl
Copy link

same problem

@EdyQiu
Copy link
Author

EdyQiu commented May 26, 2021

same problem

Have u solved it? I am still struggling.

@ZwwWayne
Copy link
Collaborator

Please @hhaAndroid & @MeowZheng have a look.

@ZwwWayne ZwwWayne assigned hhaAndroid and unassigned ZwwWayne May 31, 2021
@hhaAndroid
Copy link
Collaborator

Hi @EdyQiu, This is just a warning. The current default configuration is loaded with pre-training weights, you don’t need to do anything.

@EdyQiu EdyQiu closed this as completed Jun 2, 2021
This was referenced Jun 2, 2021
@zimenglan-sysu-512
Copy link

@hhaAndroid init_cfg in backbone does not work when call init_weights
image

@zimenglan-sysu-512
Copy link

it is weird in https://github.com/open-mmlab/mmcv/blob/54907a3922cd1edf934697e58337343d079d1475/mmcv/utils/registry.py#L35, the cfg is

cfg
{'type': 'RetinaNet', 'backbone': {'type': 'xxx', 'out_index': [2, 6, 10], 'flops': 22.9, 'init_cfg': {'type': 'Pretrained', 'checkpoint': 'xxxxxx'}}, 'neck': {'type': 'FPNQuant', 'in_channels': [16, 48, 80], 'out_channels': 64, 'start_level': 0, 'add_extra_convs': True, 'extra_convs_on_inputs': False, 'num_outs': 4, 'relu_before_extra_con
vs': True}, 'bbox_head': {'type': 'RetinaHeadQuant', 'num_classes': 1, 'in_channels': 64, 'stacked_convs': 3, 'feat_channels': [8, 16, 32, 64], 'anchor_generator': {'type': 'AnchorGenerator', 'ratios': [1], 'scal
es': [1, 1.414, 2.236], 'base_sizes': [16, 32, 64, 128], 'strides': [8, 16, 32, 64]}, 'bbox_coder': {'type': 'DeltaXYWHBBoxCoder', 'target_means': [0.0, 0.0, 0.0, 0.0], 'target_stds': [1.0, 1.0, 1.0, 1.0]}, 'loss
_cls': {'type': 'FocalLoss', 'use_sigmoid': True, 'gamma': 2.0, 'alpha': 0.25, 'loss_weight': 1.0}, 'loss_bbox': {'type': 'L1Loss', 'loss_weight': 1.0}}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants