sjmoran / CURL

Code for the ICPR 2020 paper: "CURL: Neural Curve Layers for Image Enhancement"
205 stars 34 forks source link

The weights and the architecture are not the same #25

Closed mahdip72 closed 2 years ago

mahdip72 commented 2 years ago

I have a problem in loading the pretrained model. This is my code: model = CURLNet() checkpoint = torch.load(weights, map_location=torch.device('cuda')) model.load_state_dict(checkpoint['model_state_dict'], strict=False) model.eval()

In line 3 I got the following error. RuntimeError: Error(s) in loading state_dict for CURLNet: size mismatch for tednet.ted.dconv_down1.conv1.weight: copying a param with shape torch.Size([16, 3, 3, 3]) from checkpoint, the shape in current model is torch.Size([16, 4, 3, 3]). size mismatch for tednet.ted.dconv_up1.conv1.weight: copying a param with shape torch.Size([3, 32, 3, 3]) from checkpoint, the shape in current model is torch.Size([16, 32, 3, 3]). size mismatch for tednet.ted.dconv_up1.conv1.bias: copying a param with shape torch.Size([3]) from checkpoint, the shape in current model is torch.Size([16]). size mismatch for tednet.ted.dconv_up1.conv2.weight: copying a param with shape torch.Size([3, 3, 3, 3]) from checkpoint, the shape in current model is torch.Size([16, 16, 3, 3]). size mismatch for tednet.ted.dconv_up1.conv2.bias: copying a param with shape torch.Size([3]) from checkpoint, the shape in current model is torch.Size([16]). size mismatch for tednet.final_conv.weight: copying a param with shape torch.Size([64, 3, 3, 3]) from checkpoint, the shape in current model is torch.Size([64, 16, 3, 3]).

It looks like the weights and the architecture are not the same. The pretrained model which I used was: curl_validpsnr_23.073045286204017_validloss_0.0701291635632515_testpsnr_23.584083321292365_testloss_0.061363041400909424_epoch_510_model.pt

What should I do?

sjmoran commented 2 years ago

Please use rgb_ted.py for RGB images.