Mid-Push / santa

Unpaired Image-to-Image Translation with Shortest Path Regularization
MIT License
43 stars 1 forks source link

The train process error #2

Open YangBo0411 opened 9 months ago

YangBo0411 commented 9 months ago

First of all, thank you for your outstanding work. When I was training, I encountered the following error: Traceback (most recent call last): File "train.py", line 18, in fix_b = torch.stack([test_loader_b.dataset[i]['A'] for i in range(opt.display_size)]).cuda() File "train.py", line 18, in fix_b = torch.stack([test_loader_b.dataset[i]['A'] for i in range(opt.display_size)]).cuda() File "E:\Github project\santa-main\data\single_dataset.py", line 33, in getitem A_path = self.A_paths[index] IndexError: list index out of range

The training command I used was ’python train.py --dataroot=datasets/multidataset --direction=AtoB --lambda_path=0.1 --tag=santa‘

There are four sub folders under the multidataset folder: trainA, trainB, testA, and testB. The images in the folder are unaligned.

Can you tell me what the problem is?

ojasvi1450 commented 8 months ago

@YangBo0411 did you get a solution? I am facing the same issue.

Henry-GongZY commented 7 months ago

First of all, thank you for your outstanding work. When I was training, I encountered the following error: Traceback (most recent call last): File "train.py", line 18, in fix_b = torch.stack([test_loader_b.dataset[i]['A'] for i in range(opt.display_size)]).cuda() File "train.py", line 18, in fix_b = torch.stack([test_loader_b.dataset[i]['A'] for i in range(opt.display_size)]).cuda() File "E:\Github project\santa-main\data\single_dataset.py", line 33, in getitem A_path = self.A_paths[index] IndexError: list index out of range

The training command I used was ’python train.py --dataroot=datasets/multidataset --direction=AtoB --lambda_path=0.1 --tag=santa‘

There are four sub folders under the multidataset folder: trainA, trainB, testA, and testB. The images in the folder are unaligned.

Can you tell me what the problem is?

They use a test dataloader in training procedure, mind your path and dir name.

LT1st commented 6 months ago

Do you have a solution? I faced a similar error.

(epoch: 5, iters: 5000, time: 0.348, data: 0.002) G_GAN: 0.222 D_real: 0.411 D_fake: 0.198 G_rec: 0.092 G_idt: 0.042 G_kl: 1.145 G_path: 0.391 d1: 0.402 d2: 0.252 energy_0: 0.002 energy_3: 0.007 energy_6: 0.111 energy_10: 0.198 energy_14: 1.638 
saving the latest model (epoch 5, total_iters 25000)
santa/FLIR_AtoB/lam0.1_layers0,3,6,10,14_dim8_rec5_idt5.0_pool0_noise1.0_kl0.01
saving the model at the end of epoch 5, iters 25000
Traceback (most recent call last):
  File "/home/customer/Desktop/LT/gan/santa-main/train.py", line 86, in <module>
    results = eval_loader(model, test_loader_a, test_loader_b, opt.run_dir, opt)
  File "/root/usr/anaconda3/envs/mamba/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/home/customer/Desktop/LT/gan/santa-main/models/utils.py", line 88, in eval_loader
    fake = model.translate(data['A'].cuda(), acc_data['A'].cuda())
  File "/root/usr/anaconda3/envs/mamba/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
TypeError: SANTAModel.translate() takes 2 positional arguments but 3 were given
Hans-digit commented 1 month ago

I just replace like below.

# fake = model.translate(data['A'].cuda(), acc_data['A'].cuda())
fake = model.translate(data['A'].cuda())