Skip to content

Am I using the inference.py the right way? #2

@HenrySomeCode

Description

@HenrySomeCode

Firstly, I really appreciate how fast Phạm Băng Đăn has replied, also re-write the readme.md and updated an inference code.
When I first run the inference command ( maybe this just applies the blur2vid model, e.g., Jin et al., Purohit et al. models and not the whole blur2vid + HyperCUT):

python inference.py --backbone Jin \
                    --target_frames 1 2 3 4 5 6 7 \
                    --pretrained_path path/to/pretrained_Blur2Vid.pth \
                    --blur_path path/to/blurry_image \		

I ran into this error:
ModuleNotFoundError: No module named 'models.backbones.jin_et_al'
So I download the Jin et al. repo: https://github.com/MeiguangJin/Learning-to-Extract-a-Video-Sequence-from-a-Single-Motion-Blurred-Image/tree/master , place it in models/backbones/jin_et_al.
Also, I downloaded the pre-trained Jin et al models: https://www.dropbox.com/sh/r0n9x6uz1ke8iuy/AADJBQBf9E2UMzG4Gt2Az-Qza?dl=0 , put the folder 'models' inside models/backbones/jin_et_al, like this:
image

Then I changed the jin_backbone.py a little bit like this:
image

After that I test an image and get a 'not good' result, I would say:

Test image:
image_4_blurry

Results:
deblur_0
deblur_1
deblur_2
deblur_3
deblur_4
deblur_5
deblur_6

This is the the command I used:
python inference.py --backbone Jin --target_frames 1 2 3 4 5 6 7 --pretrained_path models/backbones/jin_et_al/models/center_v3.pth --blur_path custom_dataset/image_4_blurry.png

This is another try, this time I used this image:
0054
and this command (with Hand.pth not center_v3.pth):
python inference.py --backbone Jin --target_frames 1 2 3 4 5 6 7 --pretrained_path pretrained_models/Hand.pth --blur_path 0054.png

I ran into an error that said:
RuntimeError: shape '[1, 1, 112, 4, 112, 4]' is invalid for input of size 202500
So I resized the image from the size of 448x448 to the size of 460x460 since I figured out that somehow the size of image must be divisible by 5 and 4, but still, the bad result:

deblur_0
deblur_1
deblur_2
deblur_3
deblur_4
deblur_5
deblur_6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions