I was having the problem of training 11788 images in google colab (I had GPU limitations). So I decided to run the same code using 10 species instead of 200 which resulted in 543 images after making necessary changes in datasets.
After running the pretrain STREAM.py, I got image encoder.pth and text encoder.pth.
Then the problem occured after running the second command, "python main.py --cfg cfg/bird_cycle.yaml --gpu 0"
Traceback (most recent call last):
File "/content/drive/MyDrive/BPI_V2 - Copy/cycle-image-gan-master/main.py", line 141, in
algo.train()
File "/content/drive/MyDrive/BPI_V2 - Copy/cycle-image-gan-master/trainer.py", line 701, in train
errD = discriminator_loss(netsD[i], imgs[i], fake_imgs[i],
File "/content/drive/MyDrive/BPI_V2 - Copy/cycle-image-gan-master/miscc/losses.py", line 153, in discriminator_loss
cond_real_logits = netD.COND_DNET(real_features, conditions)
File "/usr/local/lib/python3.9/dist-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/content/drive/MyDrive/BPI_V2 - Copy/cycle-image-gan-master/model.py", line 829, in forward
h_c_code = torch.cat((h_code, c_code), 1)
RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 18 but got size 4 for tensor number 1 in the list.
** I printed the size of h_code and c_code
h_code.shape = torch.Size([20, 512, 18, 18])
c_code.shape = torch.Size([20, 768, 4, 4])
I was having the problem of training 11788 images in google colab (I had GPU limitations). So I decided to run the same code using 10 species instead of 200 which resulted in 543 images after making necessary changes in datasets.
After running the pretrain STREAM.py, I got image encoder.pth and text encoder.pth.
Then the problem occured after running the second command, "python main.py --cfg cfg/bird_cycle.yaml --gpu 0"
Traceback (most recent call last):
File "/content/drive/MyDrive/BPI_V2 - Copy/cycle-image-gan-master/main.py", line 141, in
algo.train()
File "/content/drive/MyDrive/BPI_V2 - Copy/cycle-image-gan-master/trainer.py", line 701, in train
errD = discriminator_loss(netsD[i], imgs[i], fake_imgs[i],
File "/content/drive/MyDrive/BPI_V2 - Copy/cycle-image-gan-master/miscc/losses.py", line 153, in discriminator_loss
cond_real_logits = netD.COND_DNET(real_features, conditions)
File "/usr/local/lib/python3.9/dist-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/content/drive/MyDrive/BPI_V2 - Copy/cycle-image-gan-master/model.py", line 829, in forward
h_c_code = torch.cat((h_code, c_code), 1)
RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 18 but got size 4 for tensor number 1 in the list.
** I printed the size of h_code and c_code
h_code.shape = torch.Size([20, 512, 18, 18])
c_code.shape = torch.Size([20, 768, 4, 4])