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

load from not working? #12001

Open
JNaranjo-Alcazar opened this issue Oct 18, 2024 · 1 comment
Open

load from not working? #12001

JNaranjo-Alcazar opened this issue Oct 18, 2024 · 1 comment
Assignees

Comments

@JNaranjo-Alcazar
Copy link

Hi community,
I have set the load_from flag like:

load_from = '/app/src/mmdetection/checkpoints/mask_rcnn_r50_caffe_fpn_mstrain-poly_3x_coco_bbox_mAP-0.408__segm_mAP-0.37_20200504_163245-42aa3d00.pth'

However, when training, mmdetection starts downloading weights:

2024-10-18 06:36:33,937 - mmcv - INFO - load model from: open-mmlab://detectron2/resnet50_caffe
2024-10-18 06:36:33,937 - mmcv - INFO - load checkpoint from openmmlab path: open-mmlab://detectron2/resnet50_caffe
Downloading: "https://download.openmmlab.com/pretrain/third_party/resnet50_msra-5891d200.pth" to /root/.cache/torch/hub/checkpoints/resnet50_msra-5891d200.pth
100%|███████████████████████████████████████████████████████████████████████████████████████████████████| 89.9M/89.9M [00:03<00:00, 26.1MB/s]
2024-10-18 06:36:37,815 - mmcv - WARNING - The model and loaded state dict do not match exactly

Is this behaviour expected?

Thanks in advance

@PeterVennerstrom
Copy link
Contributor

A typical sequence of weight loading:

  1. Model object is created and init functions create weights with different random distributions.
  2. Pretrained backbone weights are loaded, overwriting the init weights. These weights may trigger the error since they may contain unused layers like the Imagenet classification layer.
  3. Load from overwrites the rest of the weights in the full network, often triggers the same do not match warning if the class number in the loaded weights does not match a custom setting.

Probably expected.

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

No branches or pull requests

3 participants