sangyun884 / HR-VITON

Official PyTorch implementation for the paper High-Resolution Virtual Try-On with Misalignment and Occlusion-Handled Conditions (ECCV 2022).
817 stars 172 forks source link

Error while running the test_generator.py script #63

Open ds-nat-j opened 1 year ago

ds-nat-j commented 1 year ago

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!

OliverVarnce commented 1 year ago

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.

dibdutta commented 1 year ago

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

Quoctrung26042000 commented 10 months ago

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

kodecraft-sam commented 7 months ago

Did you guys fix this?

Quoctrung26042000 commented 7 months ago

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

ahadihamide commented 3 months ago

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

ahadihamide commented 3 months ago

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
Quoctrung26042000 commented 3 months ago

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

Manish989927 commented 3 months ago

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