switchablenorms / DeepFashion_Try_On

Official code for "Towards Photo-Realistic Virtual Try-On by Adaptively Generating↔Preserving Image Content",CVPR‘20 https://arxiv.org/abs/2003.05863
825 stars 252 forks source link

Facing index out of range error while testing? Please help #49

Closed chethan-reddy2 closed 3 years ago

chethan-reddy2 commented 4 years ago

Can you please help with this error?

chethan@ex5820:~/DeepFashion_Try_On/ACGPN_inference$ python3 test.py ? ------------ Options ------------- batchSize: 1 beta1: 0.5 checkpoints_dir: ./checkpoints continue_train: False data_type: 32 dataroot: ../Data_preprocessing/ debug: False display_freq: 100 display_winsize: 512 fineSize: 512 gpu_ids: [0] input_nc: 3 isTrain: True label_nc: 20 lambda_feat: 10.0 loadSize: 512 load_pretrain: ./checkpoints/label2city lr: 0.0002 max_dataset_size: inf model: pix2pixHD nThreads: 2 n_blocks_global: 4 n_blocks_local: 3 n_downsample_global: 4 n_layers_D: 3 n_local_enhancers: 1 name: label2city ndf: 64 netG: global ngf: 64 niter: 100 niter_decay: 100 niter_fix_global: 0 no_flip: False no_ganFeat_loss: False no_html: False no_lsgan: False no_vgg_loss: False norm: instance num_D: 2 output_nc: 3 phase: test pool_size: 0 print_freq: 100 resize_or_crop: scale_width save_epoch_freq: 10 save_latest_freq: 1000 serial_batches: False tf_log: False use_dropout: False verbose: False which_epoch: latest -------------- End ---------------- CustomDatasetDataLoader dataset [AlignedDataset] was created ../Data_preprocessing/test_label label ../Data_preprocessing/test_label label ../Data_preprocessing/test_img img ../Data_preprocessing/test_img img ../Data_preprocessing/test_edge edge ../Data_preprocessing/test_edge edge ../Data_preprocessing/test_mask mask ../Data_preprocessing/test_mask mask ../Data_preprocessing/test_colormask colormask ../Data_preprocessing/test_colormask colormask ../Data_preprocessing/test_color color ../Data_preprocessing/test_color color

Inference images = 10 latest_net_U.pth latest_net_G1.pth latest_net_G2.pth latest_net_G.pth /home/chethan/.local/lib/python3.6/site-packages/torchvision/transforms/transforms.py:188: UserWarning: The use of the transforms.Scale transform is deprecated, please use transforms.Resize instead. "please use transforms.Resize instead.") /home/chethan/.local/lib/python3.6/site-packages/torchvision/transforms/transforms.py:188: UserWarning: The use of the transforms.Scale transform is deprecated, please use transforms.Resize instead. "please use transforms.Resize instead.") Traceback (most recent call last): File "test.py", line 104, in for i, data in enumerate(dataset, start=epoch_iter): File "/home/chethan/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 336, in next return self._process_next_batch(batch) File "/home/chethan/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 357, in _process_next_batch raise batch.exc_type(batch.exc_msg) IndexError: Traceback (most recent call last): File "/home/chethan/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 106, in _worker_loop samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/chethan/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 106, in samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/chethan/DeepFashion_Try_On/ACGPN_inference/data/aligned_dataset.py", line 160, in getitem C_path = self.C_paths[test] IndexError: list index out of range

josearangos commented 4 years ago

I have the same error @switchablenorms,

change

test = np.random.randint(9)

chethan-reddy2 commented 4 years ago

I have the same error @switchablenorms,

change

test = np.random.randint(9)

Thanks @josearangos I changed it but after that, I am facing an error

chethan@ex5820:~/DeepFashion_Try_On/ACGPN_inference$ python3 test.py ? ------------ Options ------------- batchSize: 1 beta1: 0.5 checkpoints_dir: ./checkpoints continue_train: False data_type: 32 dataroot: ../Data_preprocessing/ debug: False display_freq: 100 display_winsize: 512 fineSize: 512 gpu_ids: [0] input_nc: 3 isTrain: True label_nc: 20 lambda_feat: 10.0 loadSize: 512 load_pretrain: ./checkpoints/label2city lr: 0.0002 max_dataset_size: inf model: pix2pixHD nThreads: 2 n_blocks_global: 4 n_blocks_local: 3 n_downsample_global: 4 n_layers_D: 3 n_local_enhancers: 1 name: label2city ndf: 64 netG: global ngf: 64 niter: 100 niter_decay: 100 niter_fix_global: 0 no_flip: False no_ganFeat_loss: False no_html: False no_lsgan: False no_vgg_loss: False norm: instance num_D: 2 output_nc: 3 phase: test pool_size: 0 print_freq: 100 resize_or_crop: scale_width save_epoch_freq: 10 save_latest_freq: 1000 serial_batches: False tf_log: False use_dropout: False verbose: False which_epoch: latest -------------- End ---------------- CustomDatasetDataLoader dataset [AlignedDataset] was created ../Data_preprocessing/test_label label ../Data_preprocessing/test_label label ../Data_preprocessing/test_img img ../Data_preprocessing/test_img img ../Data_preprocessing/test_edge edge ../Data_preprocessing/test_edge edge ../Data_preprocessing/test_mask mask ../Data_preprocessing/test_mask mask ../Data_preprocessing/test_colormask colormask ../Data_preprocessing/test_colormask colormask ../Data_preprocessing/test_color color ../Data_preprocessing/test_color color

Inference images = 2032

latest_net_U.pth latest_net_G1.pth latest_net_G2.pth latest_net_G.pth /home/chethan/.local/lib/python3.6/site-packages/torchvision/transforms/transforms.py:257: UserWarning: The use of the transforms.Scale transform is deprecated, please use transforms.Resize instead. "please use transforms.Resize instead.") /home/chethan/.local/lib/python3.6/site-packages/torchvision/transforms/transforms.py:257: UserWarning: The use of the transforms.Scale transform is deprecated, please use transforms.Resize instead. "please use transforms.Resize instead.") Traceback (most recent call last): File "test.py", line 104, in for i, data in enumerate(dataset, start=epoch_iter): File "/home/chethan/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 363, in next data = self._next_data() File "/home/chethan/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 989, in _next_data return self._process_data(data) File "/home/chethan/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 1014, in _process_data data.reraise() File "/home/chethan/.local/lib/python3.6/site-packages/torch/_utils.py", line 395, in reraise raise self.exc_type(msg) RuntimeError: Caught RuntimeError in DataLoader worker process 0. Original Traceback (most recent call last): File "/home/chethan/.local/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 185, in _worker_loop data = fetcher.fetch(index) File "/home/chethan/.local/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/chethan/.local/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/chethan/DeepFashion_Try_On/ACGPN_inference/data/aligned_dataset.py", line 162, in getitem C_tensor = transformB(C) File "/home/chethan/.local/lib/python3.6/site-packages/torchvision/transforms/transforms.py", line 61, in call img = t(img) File "/home/chethan/.local/lib/python3.6/site-packages/torchvision/transforms/transforms.py", line 212, in call return F.normalize(tensor, self.mean, self.std, self.inplace) File "/home/chethan/.local/lib/python3.6/site-packages/torchvision/transforms/functional.py", line 298, in normalize tensor.sub(mean).div_(std) RuntimeError: output with shape [1, 256, 192] doesn't match the broadcast shape [3, 256, 192]