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

How to get Single Image Inference (output) for Deraining and Denoising #25

Open
GitarthVaishnav opened this issue Nov 25, 2021 · 3 comments

Comments

@GitarthVaishnav
Copy link

Thank you for sharing the good work!

I was trying to get deraining and denoising output (inference) on single image of my choice, but was not able to do the same.

The steps I performed are:
Added a folder /Pretrained-IPT-main/test_data/Images
Added this 'Images' in the init.py of /Pretrained-IPT-main/data/
Added the pretrained deraining model to the /Pretrained-IPT-main/pretrained_model/ folder

Used the following code:
python main.py --dir_data /Pretrained-IPT-main/test_data/ --data_test 'Images' --pretrain /Pretrained-IPT-main/pretrained_model/IPT_derain.pt --scale 1 --derain_test 1 --test_only

This is giving the following output:

Requirement already satisfied: einops in /usr/local/lib/python3.7/dist-packages (0.3.2)
Making model...

Evaluation:
0it [00:00, ?it/s]
[Images x1]	PSNR: nan (Best: nan @epoch 1)
Forward: 0.38s

Saving...
Total: 0.38s

There is no derained image being stored in any folder, instead a couple of folders are being created:
/Pretrained-IPT-main/test_data/benchmark/Images/bin (empty)
/Pretrained-IPT-main/test_data/DIV2K
/Pretrained-IPT-main/test_data/DIV2K/DIV2K_train_HR (empty)
/Pretrained-IPT-main/test_data/DIV2K/bin
/Pretrained-IPT-main/test_data/DIV2K/bin/DIV2K_train_HR (empty)

Request you to let me know what am I doing wrong, and how can I get inference (output) on a single image for deraining and denoising.

@GitarthVaishnav GitarthVaishnav changed the title Single Image Inference (output) for Deraining and Denoising How to get Single Image Inference (output) for Deraining and Denoising Nov 25, 2021
@HantingChen
Copy link
Collaborator

For derain:

python main.py --dir_data $DATA_PATH --pretrain $MODEL_PATH --scale 1 --derain

So if you want to get the deraining results, you may set the arg: --derain instead of --derain_test 1

@GitarthVaishnav
Copy link
Author

GitarthVaishnav commented Dec 9, 2021

I tried this, but it is finding TrainL dataset to work.

I want to use my own single image and get deraining result on that single image.

How can I do that?

Request you to let me know.

image

@HantingChen
Copy link
Collaborator

HantingChen commented Dec 13, 2021

You can modify :

        self.derain_dataroot = os.path.join(args.dir_data, "RainTrainL")
        self.derain_img_list = search(self.derain_dataroot, "rainstreak")
        self.derain_test = os.path.join(args.dir_data, "Rain100L")
        self.derain_lr_test = search(self.derain_test, "rain")
        self.derain_hr_test = [path.replace("rainy/","no") for path in self.derain_lr_test]

in Lines to:

        self.derain_lr_test = search(self.derain_test, "")
        self.derain_hr_test = search(self.derain_test, "")

Moreover, you may set the arg --save_results to save the output images.

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

2 participants