Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to run demo video: missing keys in source state_dict #8

Open
DanielG1010 opened this issue Aug 26, 2023 · 0 comments
Open

Trying to run demo video: missing keys in source state_dict #8

DanielG1010 opened this issue Aug 26, 2023 · 0 comments

Comments

@DanielG1010
Copy link

Hello, I am new to the openMMLabs framework, I tried to run inference on a video by adding a demo_pipeline in the _base_/datasets/hazeworld.py which I have seen from other openMMLabs projects. Here is:

demo_pipeline = [
    dict(type='GenerateSegmentIndices', interval_list=[1]),
    dict(
        type='LoadImageFromFileList',
        io_backend='disk',
        key='lq',
        channel_order='rgb'),
    dict(type='RescaleToZeroOne', keys=['lq']),
    dict(type='FramesToTensor', keys=['lq']),
    dict(type='Collect', keys=['lq'], meta_keys=['lq_path', 'key'])
]

I tried to run inference on the video with the restoration_video_inference() but I am not sure if this function could work for this model, or what could be the problem, in any case I am getting this:

(map-net) dgonzalez@R730-K80:~/map-net/MAP-Net$ python demo/demo.py --window-size 3 configs/dehazers/mapnet/mapnet_hazeworld.py mapnet_hazeworld_40k.pth demo1_input demo1_output
/home/dgonzalez/anaconda3/envs/map-net/lib/python3.10/site-packages/mmcv/__init__.py:20: UserWarning: On January 1, 2023, MMCV will release v2.0.0, in which it will remove components related to the training process and add a data transformation module. In addition, it will rename the package names mmcv to mmcv-lite and mmcv-full to mmcv. See https://github.com/open-mmlab/mmcv/blob/master/docs/en/compatibility.md for more details.
  warnings.warn(
2023-08-26 13:16:18,525 - mmedit - INFO - Init weights: None
2023-08-26 13:16:18,538 - mmcv - INFO - initialize ConvNeXt with init_cfg {'type': 'Pretrained', 'checkpoint': 'https://download.openmmlab.com/mmclassification/v0/convnext/downstream/convnext-tiny_3rdparty_32xb128-noema_in1k_20220301-795e9634.pth', 'prefix': 'backbone.'}
2023-08-26 13:16:18,538 - mmcv - INFO - load backbone. in model from: https://download.openmmlab.com/mmclassification/v0/convnext/downstream/convnext-tiny_3rdparty_32xb128-noema_in1k_20220301-795e9634.pth
load checkpoint from http path: https://download.openmmlab.com/mmclassification/v0/convnext/downstream/convnext-tiny_3rdparty_32xb128-noema_in1k_20220301-795e9634.pth
2023-08-26 13:16:18,633 - mmcv - WARNING - The model and loaded state dict do not match exactly

missing keys in source state_dict: norm0.weight, norm0.bias, norm1.weight, norm1.bias, norm2.weight, norm2.bias, norm3.weight, norm3.bias

load checkpoint from local path: mapnet_hazeworld_40k.pth
Traceback (most recent call last):
  File "/home/dgonzalez/map-net/MAP-Net/demo/demo.py", line 86, in <module>
    main()
  File "/home/dgonzalez/map-net/MAP-Net/demo/demo.py", line 62, in main
    output = restoration_video_inference(model, args.input_dir,
  File "/home/dgonzalez/map-net/MAP-Net/mmedit/apis/restoration_video_inference.py", line 112, in restoration_video_inference
    result.append(model(lq=data_i, test_mode=True)['output'].cpu())
  File "/home/dgonzalez/anaconda3/envs/map-net/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/dgonzalez/anaconda3/envs/map-net/lib/python3.10/site-packages/mmcv/runner/fp16_utils.py", line 119, in new_func
    return old_func(*args, **kwargs)
  File "/home/dgonzalez/map-net/MAP-Net/mmedit/models/dehazers/basic_dehazer.py", line 79, in forward
    return self.forward_test(lq, gt, **kwargs)
  File "/home/dgonzalez/map-net/MAP-Net/mmedit/models/dehazers/map.py", line 164, in forward_test
    output = self._get_output_from_dict(self.generator(lq))
  File "/home/dgonzalez/anaconda3/envs/map-net/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/dgonzalez/map-net/MAP-Net/mmedit/models/backbones/map_backbones/mapnet_net.py", line 376, in forward
    feats = self.decode(feats)
  File "/home/dgonzalez/map-net/MAP-Net/mmedit/models/backbones/map_backbones/mapnet_net.py", line 338, in decode
    feats = self.prior_decoder_layers[s](feats)
  File "/home/dgonzalez/anaconda3/envs/map-net/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/dgonzalez/map-net/MAP-Net/mmedit/models/backbones/map_backbones/mapnet_net.py", line 64, in forward
    .view(1, self.num_trans_bins, 1, 1).to(prob_t.device).repeat(b, 1, h, w)
RuntimeError: CUDA error: an illegal memory access was encountered
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.

I took the demo.py script from BasicVSR++ repository.

@DanielG1010 DanielG1010 changed the title missing keys in source state_dict Trying to run demo video: missing keys in source state_dict Aug 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant