Lornatang / SRGAN-PyTorch

A simple and complete implementation of super-resolution paper.
Apache License 2.0
410 stars 105 forks source link

TypeError: discriminator_for_vgg() got an unexpected keyword argument 'in_channels' #80

Closed numanashraf closed 1 year ago

numanashraf commented 1 year ago

Traceback (most recent call last): File "/home/drfarooq/numan/SRGAN-PyTorch-main/train_gan.py", line 507, in main() File "/home/drfarooq/numan/SRGAN-PyTorch-main/train_gan.py", line 75, in main g_model, ema_g_model, d_model = build_model(config, device) File "/home/drfarooq/numan/SRGAN-PyTorch-main/train_gan.py", line 248, in build_model d_model = model.dict[config["MODEL"]["D"]["NAME"]](in_channels=config["MODEL"]["D"]["IN_CHANNELS"], TypeError: discriminator_for_vgg() got an unexpected keyword argument 'in_channels'

numanashraf commented 1 year ago

Thanks for your quick response.

numanashraf commented 1 year ago

Now facing another error: FileNotFoundError: Model weight file not found. Traceback (most recent call last):

File "/home/drfarooq/numan/SRGAN-PyTorch-main/train_gan.py", line 507, in main() File "/home/drfarooq/numan/SRGAN-PyTorch-main/train_gan.py", line 76, in main pixel_criterion, content_criterion, adversarial_criterion = define_loss(config, device) File "/home/drfarooq/numan/SRGAN-PyTorch-main/train_gan.py", line 282, in define_loss content_criterion = model.ContentLoss( File "/home/drfarooq/numan/SRGAN-PyTorch-main/model.py", line 298, in init raise FileNotFoundError("Model weight file not found") FileNotFoundError: Model weight file not found

Lornatang commented 1 year ago
  1. Download https://download.pytorch.org/models/vgg19-dcbb9e9d.pth to results/pretrained_models/
  2. Comment out model_weights in ContentLoss
numanashraf commented 1 year ago

I have followed your above instructions but when I try to run the test using script: !python3 test.py --config_path ./configs/test/SRGAN_X4.yaml I got the error: Traceback (most recent call last): File "/home/drfarooq/numan/SRGAN-PyTorch-main/test.py", line 190, in main() File "/home/drfarooq/numan/SRGAN-PyTorch-main/test.py", line 169, in main config["ONLY_TEST_Y_CHANNEL"], KeyError: 'ONLY_TEST_Y_CHANNEL'