rwightman / gen-efficientnet-pytorch

Pretrained EfficientNet, EfficientNet-Lite, MixNet, MobileNetV3 / V2, MNASNet A1 and B1, FBNet, Single-Path NAS
Apache License 2.0
1.56k stars 214 forks source link

When I use mmdetection to load mixnet_s I get an error #23

Closed 237014845 closed 4 years ago

237014845 commented 4 years ago

Traceback (most recent call last): File "train.py", line 138, in main() File "train.py", line 116, in main cfg.model, train_cfg=cfg.train_cfg, test_cfg=cfg.test_cfg) File "/home/hs/hao/contextnet/mmdetection-master/mmdet/models/builder.py", line 43, in build_detector return build(cfg, DETECTORS, dict(train_cfg=train_cfg, test_cfg=test_cfg)) File "/home/hs/hao/contextnet/mmdetection-master/mmdet/models/builder.py", line 15, in build return build_from_cfg(cfg, registry, default_args) File "/home/hs/hao/contextnet/mmdetection-master/mmdet/utils/registry.py", line 76, in build_from_cfg return obj_cls(**args) File "/home/hs/hao/contextnet/mmdetection-master/mmdet/models/detectors/retinanet.py", line 16, in init test_cfg, pretrained) File "/home/hs/hao/contextnet/mmdetection-master/mmdet/models/detectors/single_stage.py", line 31, in init self.init_weights(pretrained=pretrained) File "/home/hs/hao/contextnet/mmdetection-master/mmdet/models/detectors/single_stage.py", line 35, in init_weights self.backbone.init_weights(pretrained=pretrained) File "/home/hs/hao/contextnet/mmdetection-master/mmdet/models/backbones/mixnet.py", line 837, in init_weights load_checkpoint(self, pretrained, strict=False, logger=logger) File "/home/hs/anaconda3/lib/python3.7/site-packages/mmcv/runner/checkpoint.py", line 181, in load_checkpoint 'No state_dict found in checkpoint file {}'.format(filename)) RuntimeError: No state_dict found in checkpoint file /home/hs/hao/contextnet/mmdetection-master/weights/mixnet/mixnet_m-4647fc68.pth

rwightman commented 4 years ago

It loads fine here and with other PyTorch code, so don't see why this is an issue here. The pretrained checkpoints here are like torchvision ones, just the state_dict at the top level. mmdetection may be expecting a checkpoint with another dict layer and state_dict under a specific key, dig into their code and figure out what's going on.