DUTCode icon indicating copy to clipboard operation
DUTCode copied to clipboard

issue in loading difnet model

Open nikeshkrishnan opened this issue 2 years ago • 3 comments

Traceback (most recent call last): File "./scripts/DIFRINTStabilizer.py", line 105, in fhat, I_int = DIFNet(fr_g1, fr_g3, fr_o2, File "/home/nikesh/stabl/venv/lib/python3.8/site-packages/torch/nn/modules/module.py", l return forward_call(*input, **kwargs) File "/home/nikesh/stabl/venv/lib/python3.8/site-packages/torch/nn/parallel/data_paralle return self.module(*inputs[0], **kwargs[0]) File "/home/nikesh/stabl/venv/lib/python3.8/site-packages/torch/nn/modules/module.py", l return forward_call(*input, **kwargs) File "/home/nikesh/stabl/DUTCode/models/DIFRINT/models.py", line 323, in forward w1, flo1 = self.warpFrame(fs2, fr1, scale=scale) File "/home/nikesh/stabl/DUTCode/models/DIFRINT/models.py", line 318, in warpFrame flo = 20.0 * torch.nn.functional.interpolate(input=self.pwc(temp_fr_1, temp_fr_2), siz File "/home/nikesh/stabl/venv/lib/python3.8/site-packages/torch/nn/modules/module.py", l return forward_call(*input, **kwargs) File "/home/nikesh/stabl/DUTCode/models/DIFRINT/pwcNet.py", line 269, in forward objectEstimate = self.moduleSix(tensorFirst[-1], tensorSecond[-1], None) File "/home/nikesh/stabl/venv/lib/python3.8/site-packages/torch/nn/modules/module.py", l return forward_call(*input, **kwargs) File "/home/nikesh/stabl/DUTCode/models/DIFRINT/pwcNet.py", line 197, in forward tensorVolume = self.moduleCorreleaky(self.moduleCorrelation(tensorFirst, tensorSecond) File "/home/nikesh/stabl/venv/lib/python3.8/site-packages/torch/nn/modules/module.py", l return forward_call(*input, **kwargs) File "/home/nikesh/stabl/DUTCode/models/correlation/correlation.py", line 395, in forwar return _FunctionCorrelation.apply(tenFirst, tenSecond) File "/home/nikesh/stabl/DUTCode/models/correlation/correlation.py", line 286, in forwar assert(first.is_contiguous() == True) AssertionError Stabiling using the DIFRINT model

Traceback (most recent call last): File "./scripts/StabNetStabilizer.py", line 36, in model.load_state_dict(r_model) File "/home/nikesh/stabl/venv/lib/python3.8/site-packages/torch/nn/modules/module.py", l raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for stabNet: Missing key(s) in state_dict: "resnet50.resnet_v2_50_block1_unit_1_bottleneck_v2_p_bottleneck_v2_preact_FusedBatchNorm.running_var", "resnet50.resnet_v2_50_block1_unit_1_boet_v2_50_block1_unit_1_bottleneck_v2_conv1_BatchNorm_FusedBatchNorm.running_var", "resnet5m.running_mean", "resnet50.resnet_v2_50_block1_unit_1_bottleneck_v2_conv2_BatchNorm_FusedB2_preact_FusedBatchNorm.running_mean", "resnet50.resnet_v2_50_block1_unit_2_bottleneck_v2__bottleneck_v2_conv1_BatchNorm_FusedBatchNorm.running_mean", "resnet50.resnet_v2_50_block1et50.resnet_v2_50_block1_unit_2_bottleneck_v2_conv2_BatchNorm_FusedBatchNorm.running_mean"edBatchNorm.running_var", "resnet50.resnet_v2_50_block1_unit_3_bottleneck_v2_preact_FusedBv2_preact_FusedBatchNorm.running_var", "resnet50.resnet_v2_50_block1_unit_3_bottleneck_v2_ck1_unit_3_bottleneck_v2_conv1_BatchNorm_FusedBatchNorm.running_var", "resnet50.resnet_v2_an", "resnet50.resnet_v2_50_block1_unit_3_bottleneck_v2_conv2_BatchNorm_FusedBatchNorm.runedBatchNorm.running_mean", "resnet50.resnet_v2_50_block2_unit_1_bottleneck_v2_preact_Fusedv2_conv1_BatchNorm_FusedBatchNorm.running_mean", "resnet50.resnet_v2_50_block2_unit_1_bottv2_50_block2_unit_1_bottleneck_v2_conv2_BatchNorm_FusedBatchNorm.running_mean", "resnet50.running_var", "resnet50.resnet_v2_50_block2_unit_2_bottleneck_v2_preact_FusedBatchNorm.runsedBatchNorm.running_var", "resnet50.resnet_v2_50_block2_unit_2_bottleneck_v2_conv1_BatchNottleneck_v2_conv1_BatchNorm_FusedBatchNorm.running_var", "resnet50.resnet_v2_50_block2_un50.resnet_v2_50_block2_unit_2_bottleneck_v2_conv2_BatchNorm_FusedBatchNorm.running_var", "running_mean", "resnet50.resnet_v2_50_block2_unit_3_bottleneck_v2_preact_FusedBatchNorm.ruchNorm_FusedBatchNorm.running_mean", "resnet50.resnet_v2_50_block2_unit_3_bottleneck_v2_co_unit_3_bottleneck_v2_conv2_BatchNorm_FusedBatchNorm.running_mean", "resnet50.resnet_v2_50, "resnet50.resnet_v2_50_block2_unit_4_bottleneck_v2_preact_FusedBatchNorm.running_mean", .running_var", "resnet50.resnet_v2_50_block2_unit_4_bottleneck_v2_conv1_BatchNorm_FusedBat_conv1_BatchNorm_FusedBatchNorm.running_var", "resnet50.resnet_v2_50_block2_unit_4_bottlen_50_block2_unit_4_bottleneck_v2_conv2_BatchNorm_FusedBatchNorm.running_var", "resnet50.res", "resnet50.resnet_v2_50_block3_unit_1_bottleneck_v2_preact_FusedBatchNorm.running_var", BatchNorm.running_mean", "resnet50.resnet_v2_50_block3_unit_1_bottleneck_v2_conv1_BatchNorleneck_v2_conv2_BatchNorm_FusedBatchNorm.running_mean", "resnet50.resnet_v2_50_block3_unitresnet_v2_50_block3_unit_2_bottleneck_v2_preact_FusedBatchNorm.running_mean", "resnet50.re", "resnet50.resnet_v2_50_block3_unit_2_bottleneck_v2_conv1_BatchNorm_FusedBatchNorm.runniNorm_FusedBatchNorm.running_var", "resnet50.resnet_v2_50_block3_unit_2_bottleneck_v2_conv2nit_2_bottleneck_v2_conv2_BatchNorm_FusedBatchNorm.running_var", "resnet50.resnet_v2_50_bl.resnet_v2_50_block3_unit_3_bottleneck_v2_preact_FusedBatchNorm.running_var", "resnet50.renning_mean", "resnet50.resnet_v2_50_block3_unit_3_bottleneck_v2_conv1_BatchNorm_FusedBatchnv2_BatchNorm_FusedBatchNorm.running_mean", "resnet50.resnet_v2_50_block3_unit_3_bottlenec_block3_unit_4_bottleneck_v2_preact_FusedBatchNorm.running_mean", "resnet50.resnet_v2_50_b.resnet_v2_50_block3_unit_4_bottleneck_v2_conv1_BatchNorm_FusedBatchNorm.running_mean", "rtchNorm.running_var", "resnet50.resnet_v2_50_block3_unit_4_bottleneck_v2_conv2_BatchNorm_Fneck_v2_conv2_BatchNorm_FusedBatchNorm.running_var", "resnet50.resnet_v2_50_block3_unit_5_0_block3_unit_5_bottleneck_v2_preact_FusedBatchNorm.running_var", "resnet50.resnet_v2_50_b "resnet50.resnet_v2_50_block3_unit_5_bottleneck_v2_conv1_BatchNorm_FusedBatchNorm.runningm_FusedBatchNorm.running_mean", "resnet50.resnet_v2_50_block3_unit_5_bottleneck_v2_conv2_B_6_bottleneck_v2_preact_FusedBatchNorm.running_mean", "resnet50.resnet_v2_50_block3_unit_60_block3_unit_6_bottleneck_v2_conv1_BatchNorm_FusedBatchNorm.running_mean", "resnet50.resning_var", "resnet50.resnet_v2_50_block3_unit_6_bottleneck_v2_conv2_BatchNorm_FusedBatchNor2_BatchNorm_FusedBatchNorm.running_var", "resnet50.resnet_v2_50_block4_unit_1_bottleneck_vt_1_bottleneck_v2_preact_FusedBatchNorm.running_var", "resnet50.resnet_v2_50_block4_unit_1esnet_v2_50_block4_unit_1_bottleneck_v2_conv1_BatchNorm_FusedBatchNorm.running_var", "resnNorm.running_mean", "resnet50.resnet_v2_50_block4_unit_1_bottleneck_v2_conv2_BatchNorm_Fusk_v2_preact_FusedBatchNorm.running_mean", "resnet50.resnet_v2_50_block4_unit_2_bottleneck_t_2_bottleneck_v2_conv1_BatchNorm_FusedBatchNorm.running_mean", "resnet50.resnet_v2_50_bloesnet50.resnet_v2_50_block4_unit_2_bottleneck_v2_conv2_BatchNorm_FusedBatchNorm.running_meFusedBatchNorm.running_var", "resnet50.resnet_v2_50_block4_unit_3_bottleneck_v2_preact_Fusck_v2_preact_FusedBatchNorm.running_var", "resnet50.resnet_v2_50_block4_unit_3_bottleneck_block4_unit_3_bottleneck_v2_conv1_BatchNorm_FusedBatchNorm.running_var", "resnet50.resnet__mean", "resnet50.resnet_v2_50_block4_unit_3_bottleneck_v2_conv2_BatchNorm_FusedBatchNorm.n", "resnet50.resnet_v2_50_postnorm_FusedBatchNorm.running_var", "resnet50.resnet_v2_50_

nikeshkrishnan avatar Aug 03 '22 08:08 nikeshkrishnan

Hi Nikesh,

I was able to fix this error by adding 2 lines to ensure that the tensors being correlated are contiguous in memory.

That is, above the line: https://github.com/Annbless/DUTCode/blob/8b014e53961c1f059fe4afd937571bc18dedc6bf/models/correlation/correlation.py#L286

I added the lines: first = first.contiguous() second = second.contiguous()

-Ishank

ishank-juneja avatar Jan 22 '23 14:01 ishank-juneja

For the Errors in the StabNet model you can change the state_dict_load line with the following answer: https://stackoverflow.com/a/54058284/3642162

ishank-juneja avatar Jan 22 '23 14:01 ishank-juneja

@nikeshkrishnan Hello, have you solved this problem? I had the same problem. Looking forward to your reply. You can also contact me by email. My email is [email protected]

Bryson1234321 avatar Nov 17 '23 04:11 Bryson1234321