Open alankbi opened 2 years ago
I have a similar error, can someone help me
RuntimeError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py in load_state_dict(self, state_dict, strict, assign) 2213 2214 if len(error_msgs) > 0: -> 2215 raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( 2216 self.class.name, "\n\t".join(error_msgs))) 2217 return _IncompatibleKeys(missing_keys, unexpected_keys)
RuntimeError: Error(s) in loading state_dict for FasterRCNN: Missing key(s) in state_dict: "backbone.body.conv1.weight", "backbone.body.bn1.weight", "backbone.body.bn1.bias", "backbone.body.bn1.running_mean", "backbone.body.bn1.running_var", "backbone.body.layer1.0.conv1.weight", "backbone.body.layer1.0.bn1.weight", "backbone.body.layer1.0.bn1.bias", "backbone.body.layer1.0.bn1.running_mean", "backbone.body.layer1.0.bn1.running_var", "backbone.body.layer1.0.conv2.weight", "backbone.body.layer1.0.bn2.weight", "backbone.body.layer1.0.bn2.bias", "backbone.body.layer1.0.bn2.running_mean", "backbone.body.layer1.0.bn2.running_var", "backbone.body.layer1.0.conv3.weight", "backbone.body.layer1.0.bn3.weight", "backbone.body.layer1.0.bn3.bias", "backbone.body.layer1.0.bn3.running_mean", "backbone.body.layer1.0.bn3.running_var", "backbone.body.layer1.0.downsample.0.weight", "backbone.body.layer1.0.downsample.1.weight", "backbone.body.layer1.0.downsample.1.bias", "backbone.body.layer1.0.downsample.1.running_mean", "backbone.body.layer1.0.downsample.1.running_var", "backbone.body.layer1.1.conv1.weight", "backbone.body.layer1.1.bn1.weight", "backbone.body.layer1.1.bn1.bias", "backbone.body.layer1.1.bn1.running_mean", "backbone.body.layer1.1.bn1.running_var", "backbone.body.layer1.1.conv2.weight", "backbone.body.layer1.1.bn2.weight", "backbone.body.layer1.1.bn2.bias", "backbone.body.layer1.1.bn2.running_mean", "backbone.body.layer1.1.bn2.running_var", "backbone.body.layer1.1.conv3.weight", "backbone.body.layer1.1.bn3.weight", "backbone.body.layer... Unexpected key(s) in state_dict: "quant.scale", "quant.zero_point", "faster_rcnn.backbone.body.conv1.weight", "faster_rcnn.backbone.body.conv1.bias", "faster_rcnn.backbone.body.conv1.scale", "faster_rcnn.backbone.body.conv1.zero_point", "faster_rcnn.backbone.body.bn1.weight", "faster_rcnn.backbone.body.bn1.bias", "faster_rcnn.backbone.body.bn1.running_mean", "faster_rcnn.backbone.body.bn1.running_var", "faster_rcnn.backbone.body.layer1.0.conv1.weight", "faster_rcnn.backbone.body.layer1.0.conv1.bias", "faster_rcnn.backbone.body.layer1.0.conv1.scale", "faster_rcnn.backbone.body.layer1.0.conv1.zero_point", "faster_rcnn.backbone.body.layer1.0.bn1.weight", "faster_rcnn.backbone.body.layer1.0.bn1.bias", "faster_rcnn.backbone.body.layer1.0.bn1.running_mean", "faster_rcnn.backbone.body.layer1.0.bn1.running_var", "faster_rcnn.backbone.body.layer1.0.conv2.weight", "faster_rcnn.backbone.body.layer1.0.conv2.bias", "faster_rcnn.backbone.body.layer1.0.conv2.scale", "faster_rcnn.backbone.body.layer1.0.conv2.zero_point", "faster_rcnn.backbone.body.layer1.0.bn2.weight", "faster_rcnn.backbone.body.layer1.0.bn2.bias", "faster_rcnn.backbone.body.layer1.0.bn2.running_mean", "faster_rcnn.backbone.body.layer1.0.bn2.running_var", "faster_rcnn.backbone.body.layer1.0.conv3.weight", "faster_rcnn.backbone.body.layer1.0.conv3.bias", "faster_rcnn.backbone.body.layer1.0.conv3.scale", "faster_rcnn.backbone.body.layer1.0.conv3.zero_point", "faster_rcnn.backbone.body.layer1.0.bn3.weight", "faster_rcnn.bac...
Describe the bug If someone saves a model file using a non-default model type (
Model.MOBILENET
orModel.MOBILENET_320
) and later tries to load it usingModel.load
, it will cause the following error:Temporary fix
In the meantime, the code below should act as a temporary fix/alternative to the
load
function: