TobiasSunderdiek / cartoon-gan

Implementation of cartoon GAN [Chen et al., CVPR18] with pytorch
https://tobiassunderdiek.github.io/cartoon-gan/
MIT License
61 stars 22 forks source link

Can't get around this problem occuring right when I train it.. #10

Closed vonrafael closed 1 year ago

vonrafael commented 1 year ago

ValueError: Using a target size (torch.Size([10, 1, 64, 64])) that is different to the input size (torch.Size([16, 1, 64, 64])) is deprecated. Please ensure they have the same size.

TobiasSunderdiek commented 1 year ago

Hi,

looks like one of the loss functions causes this error due to a batch of 10 and a batch of 16 as inputs. May I ask if this error occurs right at the beginning or at the end of an epoch...I guess this happens at the end of an epoch, with the last batch? I tried to avoid getting this kind of error by getting the size of the actual batch dynamically, in case there are fewer images in the last batch than in the configured batch size. But seems to be a still a problem. If my assumption is right, training with a batch size of 1 should work and training is possible without error. That's not a solution to the problem, I know, but maybe we can trace to the error.

BR!

TobiasSunderdiek commented 1 year ago

Hi,

after thinking about it again: Can you please have a look, if all image folders(photo/cartoon) contain the same amount of images after download?

Thanks and best regards!

TobiasSunderdiek commented 1 year ago

Hi, as this issue has no activity since a while, I'll close it. I hope this is okay, otherwise you're welcome to open it again! Thank you for adding this issue in general, every issue helps me to make this repo better, so thank you again! Best regards