naoto0804 / pytorch-inpainting-with-partial-conv

Unofficial pytorch implementation of 'Image Inpainting for Irregular Holes Using Partial Convolutions' [Liu+, ECCV2018]

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to test this code on my own dataset?

fu123456 opened this issue · comments

commented

Hi, I want to know how to use this code to test on my own dataset? I try to run the following code "python test.py --snapshot ./1000000.pth --root ./dataset", where "./dataset" is my own dataset (.jpg). But it outputs the error:
Traceback (most recent call last):
File "test.py", line 32, in
dataset_val = Places2(args.root, img_transform, mask_transform, 'val')
File "/home/user/FG/code/pytorch-inpainting-with-partial-conv/places2.py", line 21, in init
self.mask_paths = glob('{:s}/
.jpg'.format(mask_root))
TypeError: unsupported format string passed to Compose.format

How to solve this. Very thank you.

commented

In test.py, there is no any parameter about mask_root?

As a dataset for both training/testing, Places2 class is used.
Please modify Places2 class in places2.py to adapt your dataset.

commented

Thx. I only want to test on my images using the pre-trained model. For example, I have some images and their corresponding masks, then how to modify places.py to their results? Now, I have "dataset/my_test_256/*.jpg" (input rgb images) and "dataset/my_mask_256/.*jpg" (the masks of input rgb images). Then I try to run "python test.py --snapshot ./1000000.pth --root dataset", and it does not work. I cannot fine any parameter specifying the mask directory. So help me. Very thank you.

commented

@naoto0804 In other words, if I have a random image (my own) and its mask where I want to repair, then how to use this code to repair the missing region of the input image? Note that this input random image is considered as ground truth.

It's hard to help, just saying it does not work is not informative to me. Again, you should edit whole places2.py since it is designed for the structure of Places2 dataset