Trying to run some modules in my RetinaFace architecture using MKLDNN results in these errors :
Any help regarding this is greatly appreciated :
align_MKLDNN.py
Loading pretrained model from ./weights/mobilenet0.25_Final.pth
remove prefix 'module.'
Traceback (most recent call last):
File "/home/user/.vscode-server/extensions/ms-python.python-2020.1.58038/pythonFiles/ptvsd_launcher.py", line 43, in <module>
main(ptvsdArgs)
File "/home/user/.vscode-server/extensions/ms-python.python-2020.1.58038/pythonFiles/lib/python/old_ptvsd/ptvsd/__main__.py", line 432, in main
run()
File "/home/user/.vscode-server/extensions/ms-python.python-2020.1.58038/pythonFiles/lib/python/old_ptvsd/ptvsd/__main__.py", line 316, in run_file
runpy.run_path(target, run_name='__main__')
File "/home/user/anaconda3/lib/python3.7/runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
File "/home/user/anaconda3/lib/python3.7/runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "/home/user/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/mnt/d/Codes/Pytorch_Retinaface_MKLDN/test_detect_align_MKLDNN.py", line 318, in <module>
model_weights=model.weight )
File "/mnt/d/Codes/Pytorch_Retinaface_MKLDN/test_detect_align_MKLDNN.py", line 87, in detect
net = load_model(net, trained_model, cpu)
File "/mnt/d/Codes/Pytorch_Retinaface_MKLDN/test_detect_align_MKLDNN.py", line 60, in load_model
model.load_state_dict(pretrained_dict, strict=False)
File "/home/user/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 830, in load_state_dict
self.__class__.__name__, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for RetinaFace:
While copying the parameter named "body.stage1.0.0.weight", whose dimensions in the model are torch.Size([8, 3, 3, 3]) and whose dimensions in the checkpoint are torch.Size([8, 3, 3, 3]).
While copying the parameter named "body.stage1.0.1.running_var", whose dimensions in the model are torch.Size([8]) and whose dimensions in the checkpoint are torch.Size([8]).
While copying the parameter named "body.stage1.0.1.running_mean", whose dimensions in the model are torch.Size([8]) and whose dimensions in the checkpoint are torch.Size([8]).
While copying the parameter named "body.stage1.0.1.weight", whose dimensions in the model are torch.Size([8]) and whose dimensions in the checkpoint are torch.Size([8]).
While copying the parameter named "body.stage1.0.1.bias", whose dimensions in the model are torch.Size([8]) and whose dimensions in the checkpoint are torch.Size([8]).
While copying the parameter named "body.stage1.1.0.weight", whose dimensions in the model are torch.Size([8, 1, 3, 3]) and whose dimensions in the checkpoint are torch.Size([8, 1, 3, 3]).
While copying the parameter named "body.stage1.1.1.running_var", whose dimensions in the model are torch.Size([8]) and whose dimensions in the checkpoint are torch.Size([8]).
While copying the parameter named "body.stage1.1.1.running_mean", whose dimensions in the model are torch.Size([8]) and whose dimensions in the checkpoint are torch.Size([8]).
While copying the parameter named "body.stage1.1.1.weight", whose dimensions in the model are torch.Size([8]) and whose dimensions in the checkpoint are torch.Size([8]).
While copying the parameter named "body.stage1.1.1.bias", whose dimensions in the model are torch.Size([8]) and whose dimensions in the checkpoint are torch.Size([8]).
While copying the parameter named "body.stage1.1.3.weight", whose dimensions in the model are torch.Size([16, 8, 1, 1]) and whose dimensions in the checkpoint are torch.Size([16, 8, 1, 1]).
While copying the parameter named "body.stage1.1.4.running_var", whose dimensions in the model are torch.Size([16]) and whose dimensions in the checkpoint are torch.Size([16]).
While copying the parameter named "body.stage1.1.4.running_mean", whose dimensions in the model are torch.Size([16]) and whose dimensions in the checkpoint are torch.Size([16]).
While copying the parameter named "body.stage1.1.4.weight", whose dimensions in the model are torch.Size([16]) and whose dimensions in the checkpoint are torch.Size([16]).
While copying the parameter named "body.stage1.1.4.bias", whose dimensions in the model are torch.Size([16]) and whose dimensions in the checkpoint are torch.Size([16]).
While copying the parameter named "body.stage1.2.0.weight", whose dimensions in the model are torch.Size([16, 1, 3, 3]) and whose dimensions in the checkpoint are torch.Size([16, 1, 3, 3]).
While copying the parameter named "body.stage1.2.1.running_var", whose dimensions in the model are torch.Size([16]) and whose dimensions in the checkpoint are torch.Size([16]).
While copying the parameter named "body.stage1.2.1.running_mean", whose dimensions in the model are torch.Size([16]) and whose dimensions in the checkpoint are torch.Size([16]).
While copying the parameter named "body.stage1.2.1.weight", whose dimensions in the model are torch.Size([16]) and whose dimensions in the checkpoint are torch.Size([16]).
While copying the parameter named "body.stage1.2.1.bias", whose dimensions in the model are torch.Size([16]) and whose dimensions in the checkpoint are torch.Size([16]).
While copying the parameter named "body.stage1.2.3.weight", whose dimensions in the model are torch.Size([32, 16, 1, 1]) and whose dimensions in the checkpoint are torch.Size([32, 16, 1, 1]).
While copying the parameter named "body.stage1.2.4.running_var", whose dimensions in the model are torch.Size([32]) and whose dimensions in the checkpoint are torch.Size([32]).
While copying the parameter named "body.stage1.2.4.running_mean", whose dimensions in the model are torch.Size([32]) and whose dimensions in the checkpoint are torch.Size([32]).
While copying the parameter named "body.stage1.2.4.weight", whose dimensions in the model are torch.Size([32]) and whose dimensions in the checkpoint are torch.Size([32]).
While copying the parameter named "body.stage1.2.4.bias", whose dimensions in the model are torch.Size([32]) and whose dimensions in the checkpoint are torch.Size([32]).
While copying the parameter named "body.stage1.3.0.weight", whose dimensions in the model are torch.Size([32, 1, 3, 3]) and whose dimensions in the checkpoint are torch.Size([32, 1, 3, 3]).
While copying the parameter named "body.stage1.3.1.running_var", whose dimensions in the model are torch.Size([32]) and whose dimensions in the checkpoint are torch.Size([32]).
While copying the parameter named "body.stage1.3.1.running_mean", whose dimensions in the model are torch.Size([32]) and whose dimensions in the checkpoint are torch.Size([32]).
While copying the parameter named "body.stage1.3.1.weight", whose dimensions in the model are torch.Size([32]) and whose dimensions in the checkpoint are torch.Size([32]).
While copying the parameter named "body.stage1.3.1.bias", whose dimensions in the model are torch.Size([32]) and whose dimensions in the checkpoint are torch.Size([32]).
While copying the parameter named "body.stage1.3.3.weight", whose dimensions in the model are torch.Size([32, 32, 1, 1]) and whose dimensions in the checkpoint are torch.Size([32, 32, 1, 1]).
While copying the parameter named "body.stage1.3.4.running_var", whose dimensions in the model are torch.Size([32]) and whose dimensions in the checkpoint are torch.Size([32]).
While copying the parameter named "body.stage1.3.4.running_mean", whose dimensions in the model are torch.Size([32]) and whose dimensions in the checkpoint are torch.Size([32]).
While copying the parameter named "body.stage1.3.4.weight", whose dimensions in the model are torch.Size([32]) and whose dimensions in the checkpoint are torch.Size([32]).
While copying the parameter named "body.stage1.3.4.bias", whose dimensions in the model are torch.Size([32]) and whose dimensions in the checkpoint are torch.Size([32]).
While copying the parameter named "body.stage1.4.0.weight", whose dimensions in the model are torch.Size([32, 1, 3, 3]) and whose dimensions in the checkpoint are torch.Size([32, 1, 3, 3]).
While copying the parameter named "body.stage1.4.1.running_var", whose dimensions in the model are torch.Size([32]) and whose dimensions in the checkpoint are torch.Size([32]).
While copying the parameter named "body.stage1.4.1.running_mean", whose dimensions in the model are torch.Size([32]) and whose dimensions in the checkpoint are torch.Size([32]).
While copying the parameter named "body.stage1.4.1.weight", whose dimensions in the model are torch.Size([32]) and whose dimensions in the checkpoint are torch.Size([32]).
While copying the parameter named "body.stage1.4.1.bias", whose dimensions in the model are torch.Size([32]) and whose dimensions in the checkpoint are torch.Size([32]).
While copying the parameter named "body.stage1.4.3.weight", whose dimensions in the model are torch.Size([64, 32, 1, 1]) and whose dimensions in the checkpoint are torch.Size([64, 32, 1, 1]).
While copying the parameter named "body.stage1.4.4.running_var", whose dimensions in the model are torch.Size([64]) and whose dimensions in the checkpoint are torch.Size([64]).
While copying the parameter named "body.stage1.4.4.running_mean", whose dimensions in the model are torch.Size([64]) and whose dimensions in the checkpoint are torch.Size([64]).
While copying the parameter named "body.stage1.4.4.weight", whose dimensions in the model are torch.Size([64]) and whose dimensions in the checkpoint are torch.Size([64]).
While copying the parameter named "body.stage1.4.4.bias", whose dimensions in the model are torch.Size([64]) and whose dimensions in the checkpoint are torch.Size([64]).
While copying the parameter named "body.stage1.5.0.weight", whose dimensions in the model are torch.Size([64, 1, 3, 3]) and whose dimensions in the checkpoint are torch.Size([64, 1, 3, 3]).
While copying the parameter named "body.stage1.5.1.running_var", whose dimensions in the model are torch.Size([64]) and whose dimensions in the checkpoint are torch.Size([64]).
While copying the parameter named "body.stage1.5.1.running_mean", whose dimensions in the model are torch.Size([64]) and whose dimensions in the checkpoint are torch.Size([64]).
While copying the parameter named "body.stage1.5.1.weight", whose dimensions in the model are torch.Size([64]) and whose dimensions in the checkpoint are torch.Size([64]).
While copying the parameter named "body.stage1.5.1.bias", whose dimensions in the model are torch.Size([64]) and whose dimensions in the checkpoint are torch.Size([64]).
While copying the parameter named "body.stage1.5.3.weight", whose dimensions in the model are torch.Size([64, 64, 1, 1]) and whose dimensions in the checkpoint are torch.Size([64, 64, 1, 1]).
While copying the parameter named "body.stage1.5.4.running_var", whose dimensions in the model are torch.Size([64]) and whose dimensions in the checkpoint are torch.Size([64]).
While copying the parameter named "body.stage1.5.4.running_mean", whose dimensions in the model are torch.Size([64]) and whose dimensions in the checkpoint are torch.Size([64]).
While copying the parameter named "body.stage1.5.4.weight", whose dimensions in the model are torch.Size([64]) and whose dimensions in the checkpoint are torch.Size([64]).
While copying the parameter named "body.stage1.5.4.bias", whose dimensions in the model are torch.Size([64]) and whose dimensions in the checkpoint are torch.Size([64]).
While copying the parameter named "body.stage2.0.0.weight", whose dimensions in the model are torch.Size([64, 1, 3, 3]) and whose dimensions in the checkpoint are torch.Size([64, 1, 3, 3]).
While copying the parameter named "body.stage2.0.1.running_var", whose dimensions in the model are torch.Size([64]) and whose dimensions in the checkpoint are torch.Size([64]).
While copying the parameter named "body.stage2.0.1.running_mean", whose dimensions in the model are torch.Size([64]) and whose dimensions in the checkpoint are torch.Size([64]).
While copying the parameter named "body.stage2.0.1.weight", whose dimensions in the model are torch.Size([64]) and whose dimensions in the checkpoint are torch.Size([64]).
While copying the parameter named "body.stage2.0.1.bias", whose dimensions in the model are torch.Size([64]) and whose dimensions in the checkpoint are torch.Size([64]).
While copying the parameter named "body.stage2.0.3.weight", whose dimensions in the model are torch.Size([128, 64, 1, 1]) and whose dimensions in the checkpoint are torch.Size([128, 64, 1, 1]).
While copying the parameter named "body.stage2.0.4.running_var", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.0.4.running_mean", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.0.4.weight", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.0.4.bias", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.1.0.weight", whose dimensions in the model are torch.Size([128, 1, 3, 3]) and whose dimensions in the checkpoint are torch.Size([128, 1, 3, 3]).
While copying the parameter named "body.stage2.1.1.running_var", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.1.1.running_mean", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.1.1.weight", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.1.1.bias", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.1.3.weight", whose dimensions in the model are torch.Size([128, 128, 1, 1]) and whose dimensions in the checkpoint are torch.Size([128, 128, 1, 1]).
While copying the parameter named "body.stage2.1.4.running_var", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.1.4.running_mean", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.1.4.weight", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.1.4.bias", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.2.0.weight", whose dimensions in the model are torch.Size([128, 1, 3, 3]) and whose dimensions in the checkpoint are torch.Size([128, 1, 3, 3]).
While copying the parameter named "body.stage2.2.1.running_var", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.2.1.running_mean", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.2.1.weight", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.2.1.bias", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.2.3.weight", whose dimensions in the model are torch.Size([128, 128, 1, 1]) and whose dimensions in the checkpoint are torch.Size([128, 128, 1, 1]).
While copying the parameter named "body.stage2.2.4.running_var", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.2.4.running_mean", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.2.4.weight", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.2.4.bias", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.3.0.weight", whose dimensions in the model are torch.Size([128, 1, 3, 3]) and whose dimensions in the checkpoint are torch.Size([128, 1, 3, 3]).
While copying the parameter named "body.stage2.3.1.running_var", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.3.1.running_mean", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.3.1.weight", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.3.1.bias", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.3.3.weight", whose dimensions in the model are torch.Size([128, 128, 1, 1]) and whose dimensions in the checkpoint are torch.Size([128, 128, 1, 1]).
While copying the parameter named "body.stage2.3.4.running_var", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.3.4.running_mean", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.3.4.weight", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.3.4.bias", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.4.0.weight", whose dimensions in the model are torch.Size([128, 1, 3, 3]) and whose dimensions in the checkpoint are torch.Size([128, 1, 3, 3]).
While copying the parameter named "body.stage2.4.1.running_var", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.4.1.running_mean", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.4.1.weight", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.4.1.bias", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.4.3.weight", whose dimensions in the model are torch.Size([128, 128, 1, 1]) and whose dimensions in the checkpoint are torch.Size([128, 128, 1, 1]).
While copying the parameter named "body.stage2.4.4.running_var", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.4.4.running_mean", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.4.4.weight", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.4.4.bias", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.5.0.weight", whose dimensions in the model are torch.Size([128, 1, 3, 3]) and whose dimensions in the checkpoint are torch.Size([128, 1, 3, 3]).
While copying the parameter named "body.stage2.5.1.running_var", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.5.1.running_mean", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.5.1.weight", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.5.1.bias", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.5.3.weight", whose dimensions in the model are torch.Size([128, 128, 1, 1]) and whose dimensions in the checkpoint are torch.Size([128, 128, 1, 1]).
While copying the parameter named "body.stage2.5.4.running_var", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.5.4.running_mean", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.5.4.weight", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage2.5.4.bias", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage3.0.0.weight", whose dimensions in the model are torch.Size([128, 1, 3, 3]) and whose dimensions in the checkpoint are torch.Size([128, 1, 3, 3]).
While copying the parameter named "body.stage3.0.1.running_var", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage3.0.1.running_mean", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage3.0.1.weight", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage3.0.1.bias", whose dimensions in the model are torch.Size([128]) and whose dimensions in the checkpoint are torch.Size([128]).
While copying the parameter named "body.stage3.0.3.weight", whose dimensions in the model are torch.Size([256, 128, 1, 1]) and whose dimensions in the checkpoint are torch.Size([256, 128, 1, 1]).
While copying the parameter named "body.stage3.0.4.running_var", whose dimensions in the model are torch.Size([256]) and whose dimensions in the checkpoint are torch.Size([256]).
While copying the parameter named "body.stage3.0.4.running_mean", whose dimensions in the model are torch.Size([256]) and whose dimensions in the checkpoint are torch.Size([256]).
While copying the parameter named "body.stage3.0.4.weight", whose dimensions in the model are torch.Size([256]) and whose dimensions in the checkpoint are torch.Size([256]).
While copying the parameter named "body.stage3.0.4.bias", whose dimensions in the model are torch.Size([256]) and whose dimensions in the checkpoint are torch.Size([256]).
While copying the parameter named "body.stage3.1.0.weight", whose dimensions in the model are torch.Size([256, 1, 3, 3]) and whose dimensions in the checkpoint are torch.Size([256, 1, 3, 3]).
While copying the parameter named "body.stage3.1.1.running_var", whose dimensions in the model are torch.Size([256]) and whose dimensions in the checkpoint are torch.Size([256]).
While copying the parameter named "body.stage3.1.1.running_mean", whose dimensions in the model are torch.Size([256]) and whose dimensions in the checkpoint are torch.Size([256]).
While copying the parameter named "body.stage3.1.1.weight", whose dimensions in the model are torch.Size([256]) and whose dimensions in the checkpoint are torch.Size([256]).
While copying the parameter named "body.stage3.1.1.bias", whose dimensions in the model are torch.Size([256]) and whose dimensions in the checkpoint are torch.Size([256]).
While copying the parameter named "body.stage3.1.3.weight", whose dimensions in the model are torch.Size([256, 256, 1, 1]) and whose dimensions in the checkpoint are torch.Size([256, 256, 1, 1]).
While copying the parameter named "body.stage3.1.4.running_var", whose dimensions in the model are torch.Size([256]) and whose dimensions in the checkpoint are torch.Size([256]).
While copying the parameter named "body.stage3.1.4.running_mean", whose dimensions in the model are torch.Size([256]) and whose dimensions in the checkpoint are torch.Size([256]).
While copying the parameter named "body.stage3.1.4.weight", whose dimensions in the model are torch.Size([256]) and whose dimensions in the checkpoint are torch.Size([256]).
While copying the parameter named "body.stage3.1.4.bias", whose dimensions in the model are torch.Size([256]) and whose dimensions in the checkpoint are torch.Size([256]).
While copying the parameter named "ssh1.conv3X3.0.weight", whose dimensions in the model are torch.Size([32, 64, 3, 3]) and whose dimensions in the checkpoint are torch.Size([32, 64, 3, 3]).
While copying the parameter named "ssh1.conv3X3.1.running_var", whose dimensions in the model are torch.Size([32]) and whose dimensions in the checkpoint are torch.Size([32]).
While copying the parameter named "ssh1.conv3X3.1.running_mean", whose dimensions in the model are torch.Size([32]) and whose dimensions in the checkpoint are torch.Size([32]).
While copying the parameter named "ssh1.conv3X3.1.weight", whose dimensions in the model are torch.Size([32]) and whose dimensions in the checkpoint are torch.Size([32]).
While copying the parameter named "ssh1.conv3X3.1.bias", whose dimensions in the model are torch.Size([32]) and whose dimensions in the checkpoint are torch.Size([32]).
....
The full list can be viewed here : https://paste.ee/p/Vx4Wi
The changes that I have made looks like this :
class RetinaFace(nn.Module):
def __init__(self, cfg = None, phase = 'train'):
"""
:param cfg: Network related settings.
:param phase: train or test.
"""
super(RetinaFace,self).__init__()
self.phase = phase
backbone = None
if cfg['name'] == 'mobilenet0.25':
backbone = MobileNetV1()
if cfg['pretrain']:
checkpoint = torch.load("./weights/mobilenetV1X0.25_pretrain.tar", map_location=torch.device('cpu'))
from collections import OrderedDict
new_state_dict = OrderedDict()
for k, v in checkpoint['state_dict'].items():
name = k[7:] # remove module.
new_state_dict[name] = v
# load params
backbone.load_state_dict(new_state_dict)
elif cfg['name'] == 'Resnet50':
import torchvision.models as models
backbone = models.resnet50(pretrained=cfg['pretrain'])
# self.body = _utils.IntermediateLayerGetter(backbone, cfg['return_layers'])
self.body = _utils.IntermediateLayerGetter(backbone, cfg['return_layers'])
# convert to mkldnn
# self.body = mkldnn_utils.to_mkldnn(self.body)
in_channels_stage2 = cfg['in_channel']
in_channels_list = [
in_channels_stage2 * 2,
in_channels_stage2 * 4,
in_channels_stage2 * 8,
]
out_channels = cfg['out_channel']
self.fpn = FPN(in_channels_list,out_channels)
self.ssh1 = SSH(out_channels, out_channels)
self.ssh2 = SSH(out_channels, out_channels)
self.ssh3 = SSH(out_channels, out_channels)
self.ClassHead = self._make_class_head(fpn_num=3, inchannels=cfg['out_channel'])
self.BboxHead = self._make_bbox_head(fpn_num=3, inchannels=cfg['out_channel'])
self.LandmarkHead = self._make_landmark_head(fpn_num=3, inchannels=cfg['out_channel'])
# convert to mkldnn
self.body.eval()
self.ssh1.eval()
self.ssh2.eval()
self.ssh3.eval()
self.ClassHead.eval()
self.BboxHead.eval()
self.LandmarkHead.eval()
self.body = mkldnn_utils.to_mkldnn(self.body)
self.ssh1 = mkldnn_utils.to_mkldnn(self.ssh1)
self.ssh2 = mkldnn_utils.to_mkldnn(self.ssh2)
self.ssh3 = mkldnn_utils.to_mkldnn(self.ssh3)
self.ClassHead = mkldnn_utils.to_mkldnn(self.ClassHead)
self.BboxHead = mkldnn_utils.to_mkldnn(self.BboxHead)
self.LandmarkHead = mkldnn_utils.to_mkldnn(self.LandmarkHead)
def forward(self,inputs):
inputs = inputs.to_mkldnn()
out = self.body(inputs)
# FPN
fpn = self.fpn(out)
# move to mkldnn
fpn = fpn.to_mkldnn()
# SSH
feature1 = self.ssh1(fpn[0])
feature2 = self.ssh2(fpn[1])
feature3 = self.ssh3(fpn[2])
features = [feature1, feature2, feature3]
# move to mkldnn
features = features.to_mkldnn()
bbox_regressions = torch.cat([self.BboxHead[i](feature) for i, feature in enumerate(features)], dim=1)
classifications = torch.cat([self.ClassHead[i](feature) for i, feature in enumerate(features)],dim=1)
ldm_regressions = torch.cat([self.LandmarkHead[i](feature) for i, feature in enumerate(features)], dim=1)
if self.phase == 'train':
output = (bbox_regressions, classifications, ldm_regressions)
else:
output = (bbox_regressions, F.softmax(classifications, dim=-1), ldm_regressions)
return output
Any help is greatly appreciated.