tom-roddick / oft

MIT License
200 stars 50 forks source link

infer.py does not work #7

Open VICKY1991 opened 4 years ago

VICKY1991 commented 4 years ago

Hi,

The training worked well. But, when I run infer.py, I get the following errors:

RuntimeError: Error(s) in loading state_dict for OftNet: Missing key(s) in state_dict: "mean", "std", "frontend.conv1.weight", "frontend.bn1.weight", "frontend.bn1.bias", "frontend.layer1.0.conv1.weight", "frontend.layer1.0.bn1.weight", "frontend.layer1.0.bn1.bias", "frontend.layer1.0.conv2.weight", "frontend.layer1.0.bn2.weight", "frontend.layer1.0.bn2.bias", "frontend.layer1.1.conv1.weight", "frontend.layer1.1.bn1.weight", "frontend.layer1.1.bn1.bias", "frontend.layer1.1.conv2.weight", "frontend.layer1.1.bn2.weight", "frontend.layer1.1.bn2.bias", "frontend.layer2.0.conv1.weight", "frontend.layer2.0.bn1.weight", "frontend.layer2.0.bn1.bias", "frontend.layer2.0.conv2.weight", "frontend.layer2.0.bn2.weight", "frontend.layer2.0.bn2.bias", "frontend.layer2.0.downsample.0.weight", "frontend.layer2.0.downsample.1.weight", "frontend.layer2.0.downsample.1.bias", "frontend.layer2.1.conv1.weight", "frontend.layer2.1.bn1.weight", "frontend.layer2.1.bn1.bias", "frontend.layer2.1.conv2.weight", "frontend.layer2.1.bn2.weight", "frontend.layer2.1.bn2.bias", "frontend.layer3.0.conv1.weight", "frontend.layer3.0.bn1.weight", "frontend.layer3.0.bn1.bias", "frontend.layer3.0.conv2.weight", "frontend.layer3.0.bn2.weight", "frontend.layer3.0.bn2.bias", "frontend.layer3.0.downsample.0.weight", "frontend.layer3.0.downsample.1.weight", "frontend.layer3.0.downsample.1.bias", "frontend.layer3.1.conv1.weight", "frontend.layer3.1.bn1.weight", "frontend.layer3.1.bn1.bias", "frontend.layer3.1.conv2.weight", "frontend.layer3.1.bn2.weight", "frontend.layer3.1.bn2.bias", "frontend.layer4.0.conv1.weight", "frontend.layer4.0.bn1.weight", "frontend.layer4.0.bn1.bias", "frontend.layer4.0.conv2.weight", "frontend.layer4.0.bn2.weight", "frontend.layer4.0.bn2.bias", "frontend.layer4.0.downsample.0.weight", "frontend.layer4.0.downsample.1.weight", "frontend.layer4.0.downsample.1.bias", "frontend.layer4.1.conv1.weight", "frontend.layer4.1.bn1.weight", "frontend.layer4.1.bn1.bias", "frontend.layer4.1.conv2.weight", "frontend.layer4.1.bn2.weight", "frontend.layer4.1.bn2.bias", "lat8.weight", "lat8.bias", "lat16.weight", "lat16.bias", "lat32.weight", "lat32.bias", "bn8.weight", "bn8.bias", "bn16.weight", "bn16.bias", "bn32.weight", "bn32.bias", "oft8.y_corners", "oft8.conv3d.weight", "oft8.conv3d.bias", "oft16.y_corners", "oft16.conv3d.weight", "oft16.conv3d.bias", "oft32.y_corners", "oft32.conv3d.weight", "oft32.conv3d.bias", "topdown.0.conv1.weight", "topdown.0.bn1.weight", "topdown.0.bn1.bias", "topdown.0.conv2.weight", "topdown.0.bn2.weight", "topdown.0.bn2.bias", "topdown.1.conv1.weight", "topdown.1.bn1.weight", "topdown.1.bn1.bias", "topdown.1.conv2.weight", "topdown.1.bn2.weight", "topdown.1.bn2.bias", "topdown.2.conv1.weight", "topdown.2.bn1.weight", "topdown.2.bn1.bias", "topdown.2.conv2.weight", "topdown.2.bn2.weight", "topdown.2.bn2.bias", "topdown.3.conv1.weight", "topdown.3.bn1.weight", "topdown.3.bn1.bias", "topdown.3.conv2.weight", "topdown.3.bn2.weight", "topdown.3.bn2.bias", "topdown.4.conv1.weight", "topdown.4.bn1.weight", "topdown.4.bn1.bias", "topdown.4.conv2.weight", "topdown.4.bn2.weight", "topdown.4.bn2.bias", "topdown.5.conv1.weight", "topdown.5.bn1.weight", "topdown.5.bn1.bias", "topdown.5.conv2.weight", "topdown.5.bn2.weight", "topdown.5.bn2.bias", "topdown.6.conv1.weight", "topdown.6.bn1.weight", "topdown.6.bn1.bias", "topdown.6.conv2.weight", "topdown.6.bn2.weight", "topdown.6.bn2.bias", "topdown.7.conv1.weight", "topdown.7.bn1.weight", "topdown.7.bn1.bias", "topdown.7.conv2.weight", "topdown.7.bn2.weight", "topdown.7.bn2.bias", "head.weight", "head.bias". Unexpected key(s) in state_dict: "module.mean", "module.std", "module.frontend.conv1.weight", "module.frontend.bn1.weight", "module.frontend.bn1.bias", "module.frontend.layer1.0.conv1.weight", "module.frontend.layer1.0.bn1.weight", "module.frontend.layer1.0.bn1.bias", "module.frontend.layer1.0.conv2.weight", "module.frontend.layer1.0.bn2.weight", "module.frontend.layer1.0.bn2.bias", "module.frontend.layer1.1.conv1.weight", "module.frontend.layer1.1.bn1.weight", "module.frontend.layer1.1.bn1.bias", "module.frontend.layer1.1.conv2.weight", "module.frontend.layer1.1.bn2.weight", "module.frontend.layer1.1.bn2.bias", "module.frontend.layer2.0.conv1.weight", "module.frontend.layer2.0.bn1.weight", "module.frontend.layer2.0.bn1.bias", "module.frontend.layer2.0.conv2.weight", "module.frontend.layer2.0.bn2.weight", "module.frontend.layer2.0.bn2.bias", "module.frontend.layer2.0.downsample.0.weight", "module.frontend.layer2.0.downsample.1.weight", "module.frontend.layer2.0.downsample.1.bias", "module.frontend.layer2.1.conv1.weight", "module.frontend.layer2.1.bn1.weight", "module.frontend.layer2.1.bn1.bias", "module.frontend.layer2.1.conv2.weight", "module.frontend.layer2.1.bn2.weight", "module.frontend.layer2.1.bn2.bias", "module.frontend.layer3.0.conv1.weight", "module.frontend.layer3.0.bn1.weight", "module.frontend.layer3.0.bn1.bias", "module.frontend.layer3.0.conv2.weight", "module.frontend.layer3.0.bn2.weight", "module.frontend.layer3.0.bn2.bias", "module.frontend.layer3.0.downsample.0.weight", "module.frontend.layer3.0.downsample.1.weight", "module.frontend.layer3.0.downsample.1.bias", "module.frontend.layer3.1.conv1.weight", "module.frontend.layer3.1.bn1.weight", "module.frontend.layer3.1.bn1.bias", "module.frontend.layer3.1.conv2.weight", "module.frontend.layer3.1.bn2.weight", "module.frontend.layer3.1.bn2.bias", "module.frontend.layer4.0.conv1.weight", "module.frontend.layer4.0.bn1.weight", "module.frontend.layer4.0.bn1.bias", "module.frontend.layer4.0.conv2.weight", "module.frontend.layer4.0.bn2.weight", "module.frontend.layer4.0.bn2.bias", "module.frontend.layer4.0.downsample.0.weight", "module.frontend.layer4.0.downsample.1.weight", "module.frontend.layer4.0.downsample.1.bias", "module.frontend.layer4.1.conv1.weight", "module.frontend.layer4.1.bn1.weight", "module.frontend.layer4.1.bn1.bias", "module.frontend.layer4.1.conv2.weight", "module.frontend.layer4.1.bn2.weight", "module.frontend.layer4.1.bn2.bias", "module.lat8.weight", "module.lat8.bias", "module.lat16.weight", "module.lat16.bias", "module.lat32.weight", "module.lat32.bias", "module.bn8.weight", "module.bn8.bias", "module.bn16.weight", "module.bn16.bias", "module.bn32.weight", "module.bn32.bias", "module.oft8.y_corners", "module.oft8.conv3d.weight", "module.oft8.conv3d.bias", "module.oft16.y_corners", "module.oft16.conv3d.weight", "module.oft16.conv3d.bias", "module.oft32.y_corners", "module.oft32.conv3d.weight", "module.oft32.conv3d.bias", "module.topdown.0.conv1.weight", "module.topdown.0.bn1.weight", "module.topdown.0.bn1.bias", "module.topdown.0.conv2.weight", "module.topdown.0.bn2.weight", "module.topdown.0.bn2.bias", "module.topdown.1.conv1.weight", "module.topdown.1.bn1.weight", "module.topdown.1.bn1.bias", "module.topdown.1.conv2.weight", "module.topdown.1.bn2.weight", "module.topdown.1.bn2.bias", "module.topdown.2.conv1.weight", "module.topdown.2.bn1.weight", "module.topdown.2.bn1.bias", "module.topdown.2.conv2.weight", "module.topdown.2.bn2.weight", "module.topdown.2.bn2.bias", "module.topdown.3.conv1.weight", "module.topdown.3.bn1.weight", "module.topdown.3.bn1.bias", "module.topdown.3.conv2.weight", "module.topdown.3.bn2.weight", "module.topdown.3.bn2.bias", "module.topdown.4.conv1.weight", "module.topdown.4.bn1.weight", "module.topdown.4.bn1.bias", "module.topdown.4.conv2.weight", "module.topdown.4.bn2.weight", "module.topdown.4.bn2.bias", "module.topdown.5.conv1.weight", "module.topdown.5.bn1.weight", "module.topdown.5.bn1.bias", "module.topdown.5.conv2.weight", "module.topdown.5.bn2.weight", "module.topdown.5.bn2.bias", "module.topdown.6.conv1.weight", "module.topdown.6.bn1.weight", "module.topdown.6.bn1.bias", "module.topdown.6.conv2.weight", "module.topdown.6.bn2.weight", "module.topdown.6.bn2.bias", "module.topdown.7.conv1.weight", "module.topdown.7.bn1.weight", "module.topdown.7.bn1.bias", "module.topdown.7.conv2.weight", "module.topdown.7.bn2.weight", "module.topdown.7.bn2.bias", "module.head.weight", "module.head.bias".

Please help.

Best Regards Sambit

qfwysw commented 3 years ago

Tty this may help you. "model.load_state_dict({k.replace('module.', ''): v for k, v in ckpt['model'].items()})" BTW, do you know why the loss value of the validation set does not seem to decrease?

zyh321 commented 1 year ago

Tty this may help you. "model.load_state_dict({k.replace('module.', ''): v for k, v in ckpt['model'].items()})" BTW, do you know why the loss value of the validation set does not seem to decrease?

Hi qfwysw,

Do you have the pre-trained model?