HR-VITON icon indicating copy to clipboard operation
HR-VITON copied to clipboard

Error while running the test_generator.py script

Open ds-nat-j opened this issue 1 year ago • 9 comments

python3 test_generator.py --occlusion --test_name 'test1' --tocg_checkpoint "/dbfs/nathan/VTON-test/mtviton.pth" --gen_checkpoint "/dbfs/nathan/VTON-test/gen.pth" --datasetting unpaired --dataroot "/dbfs/nathan/VTON-test" --data_list "/dbfs/nathan/VTON-test/test_pairs.txt"

Error message:

File "/databricks/driver/HR-VITON/test_generator.py", line 278, in <module>
    main()
  File "/databricks/driver/HR-VITON/test_generator.py", line 272, in main
    test(opt, test_loader, tocg, generator)
  File "/databricks/driver/HR-VITON/test_generator.py", line 116, in test
    for inputs in test_loader.data_loader:
  File "/databricks/python/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 681, in __next__
    data = self._next_data()
  File "/databricks/python/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 1376, in _next_data
    return self._process_data(data)
  File "/databricks/python/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 1402, in _process_data
    data.reraise()
  File "/databricks/python/lib/python3.9/site-packages/torch/_utils.py", line 461, in reraise
    raise exception
FileNotFoundError: Caught FileNotFoundError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "/databricks/python/lib/python3.9/site-packages/torch/utils/data/_utils/worker.py", line 302, in _worker_loop
    data = fetcher.fetch(index)
  File "/databricks/python/lib/python3.9/site-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/databricks/python/lib/python3.9/site-packages/torch/utils/data/_utils/fetch.py", line 49, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/databricks/driver/HR-VITON/cp_dataset_test.py", line 121, in __getitem__
    c[key] = Image.open(osp.join(self.data_path, 'cloth', c_name[key])).convert('RGB')
  File "/local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.9/site-packages/PIL/Image.py", line 3227, in open
    fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: '/dbfs/nathan/VTON-test/test/cloth/08909_00.jpg'

While it's true that the image '08909_00.jpg' doesn't exist in '/VTON-test/test/cloth/', it exists in '/VTON-test/test/image/'. The issue seems to be with reading test_pairs.txt

Currently test_pairs.txt --> 08909_00.jpg 02783_00.jpg 00891_00.jpg 01430_00.jpg 03615_00.jpg 09933_00.jpg 07445_00.jpg 06429_00.jpg 07573_00.jpg 11791_00.jpg 10549_00.jpg 01260_00.jpg

But even if I reverse it and use this as test_pairs.txt--> 02783_00.jpg 08909_00.jpg 01430_00.jpg 00891_00.jpg 09933_00.jpg 03615_00.jpg 06429_00.jpg 07445_00.jpg 11791_00.jpg 07573_00.jpg 01260_00.jpg 10549_00.jpg

Even this fails. It seems somewhere in the code the location is hardcoded and is trying to read both sides of test_pairs.txt as /test/cloth folder, when ideally it should be reading one side of test_pairs.txt as /test/image and other as /test/cloth but .

Please fix this bug!

ds-nat-j avatar Mar 27 '23 17:03 ds-nat-j

You paths specifying in arguments are wrong. Change default value in args (opt) or specify custom directory in args when you are trying to execute script.

OliverVarnce avatar Mar 29 '23 15:03 OliverVarnce

@OliverVarnce An example will greatly help here pls. I am also facing same issue.

dibdutta avatar May 07 '23 16:05 dibdutta

Hi ,I am also facing the same problem now, please help me

Quoctrung26042000 avatar Sep 20 '23 07:09 Quoctrung26042000

Did you guys fix this?

kodecraft-sam avatar Nov 29 '23 09:11 kodecraft-sam

sure, i know this problem and fixed , tks for u

Quoctrung26042000 avatar Nov 30 '23 08:11 Quoctrung26042000

I have the same problem. how did you fix it? @Quoctrung26042000

ahadihamide avatar Mar 26 '24 09:03 ahadihamide

You paths specifying in arguments are wrong. Change default value in args (opt) or specify custom directory in args when you are trying to execute script.

I specified the data directory, but it did not resolve the issue. I read the code and am curious why CPDatasetTest placed the image file names in self.c_names['paired']

self.c_names['paired'] = im_names
self.c_names['unpaired'] = c_names

ahadihamide avatar Mar 26 '24 09:03 ahadihamide

because it been a long time, so i forget resole this problem, but if i have free time i will check for you, im sorry, i cannt help you immeditaly

Quoctrung26042000 avatar Mar 26 '24 09:03 Quoctrung26042000

https://colab.research.google.com/drive/1BG-4G6MYmwRZlqctbVVSMC-lj27Cycoh?usp=sharing

see this colab notebook it may help you to understand the code running process

Manish989927 avatar Apr 05 '24 12:04 Manish989927