yunjey / stargan

StarGAN - Official PyTorch Implementation (CVPR 2018)
MIT License
5.21k stars 967 forks source link

Testing Error #114

Open kanlions opened 4 years ago

kanlions commented 4 years ago

I trained on a custom dataset with the directory structure mentioned. The training was successful, Now I am getting this issue while testing

Error(s) in loading state_dict for Generator: size mismatch for main.0.weight: copying a param with shape torch.Size([64, 8, 7, 7]) from checkpoint, the shape in current model is torch.Size([64, 5, 7, 7])

Well the dataset is same only test and train images are different

yunjey commented 4 years ago

@kanlions Set the argument --c_dim to 8 when testing. The error message shows that you set --c_dim = 8 at training time but --c_dim = 5 at testing time.

kanlions commented 4 years ago

Thank you the author for immediate clarification. While training I used less number of classes and put c_dim as the number of classes not 8. I am not working with face images as your problem. The end goal will be image to multi image translation under different weather conditions. I intend to use natural architectures not faces. I have followed instructions as RaFD directory structure, for beginning I want to have 3 classes and number of classes will increase when we get more data. with c_dim = 3 how did I landup with 8 classes as I executed the following and also RafD train directory has 3 folders only (low med high) python main.py --mode train --dataset RaFD --image_size 256 --c_dim 3 --rafd_image_dir /home/user1/Desktop/GANS/stargan-master/jpg/data/RaFD/test --sample_dir stargan_custom/samples --log_dir stargan_custom/logs --model_save_dir stargan_custom/models --result_dir stargan_custom/results

yunjey commented 4 years ago

@kanlions If the number of classes is 3, set the argument --c_dim = 3 at training time. The argument setting of c_dim must be same at training and test time. As the number of classes increases (or decreases), you should retrain the model from scratch.

The RaFD dataset contains 8 classes/expressions i.e., neutral, angry, fearful, happy, sad, surprised, contemptuous, disgusted.