GithubHelp home page GithubHelp logo

Comments (10)

Lornatang avatar Lornatang commented on May 30, 2024

The input channel is changed from 3 to 1, and the output channel is also modified to ensure that the loaded image is grayscale.

from srgan-pytorch.

ozturkoktay avatar ozturkoktay commented on May 30, 2024

Ok, I've changed the output layer too and passed that step. Now I get RuntimeError: The size of tensor a (192) must match the size of tensor b (96) at non-singleton dimension 3

from srgan-pytorch.

Lornatang avatar Lornatang commented on May 30, 2024

This error seems to be a discriminator problem. Can you give the details of the error code line.

from srgan-pytorch.

ozturkoktay avatar ozturkoktay commented on May 30, 2024

Of course:

Traceback (most recent call last):
  File "train.py", line 609, in <module>
    main()
  File "train.py", line 152, in main
    main_worker(args.gpu, ngpus_per_node, args)
  File "train.py", line 361, in main_worker
    psnr_optimizer, epoch, psnr_writer, scaler, args)
  File "train.py", line 443, in train_psnr
    mse_loss = pixel_criterion(sr, hr)
  File "/home/naldwig/Desktop/Files/SRGAN-PyTorch/env/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/naldwig/Desktop/Files/SRGAN-PyTorch/env/lib/python3.7/site-packages/torch/nn/modules/loss.py", line 528, in forward
    return F.mse_loss(input, target, reduction=self.reduction)
  File "/home/naldwig/Desktop/Files/SRGAN-PyTorch/env/lib/python3.7/site-packages/torch/nn/functional.py", line 2928, in mse_loss
    expanded_input, expanded_target = torch.broadcast_tensors(input, target)
  File "/home/naldwig/Desktop/Files/SRGAN-PyTorch/env/lib/python3.7/site-packages/torch/functional.py", line 74, in broadcast_tensors
    return _VF.broadcast_tensors(tensors)  # type: ignore
RuntimeError: The size of tensor a (192) must match the size of tensor b (96) at non-singleton dimension 3

from srgan-pytorch.

Lornatang avatar Lornatang commented on May 30, 2024

SR image size is 192, But HR image size is 96.

from srgan-pytorch.

ozturkoktay avatar ozturkoktay commented on May 30, 2024

Cause of error the upscale factor. When I changed the upscale factor to 2 throws an error, default parameter (4) causes no error. Do you have any idea?

from srgan-pytorch.

Lornatang avatar Lornatang commented on May 30, 2024

you set --arch srgan_2x2?

from srgan-pytorch.

ozturkoktay avatar ozturkoktay commented on May 30, 2024

Problem solved, thanks! Maybe grayscale parameter can be added.

from srgan-pytorch.

ozturkoktay avatar ozturkoktay commented on May 30, 2024

Ok, new but similar error when calculating gmsd after first epoch:

Error:

Traceback (most recent call last):
  File "train.py", line 612, in <module>
    main()
  File "train.py", line 152, in main
    main_worker(args.gpu, ngpus_per_node, args)
  File "train.py", line 370, in main_worker
    dataloader=test_dataloader, model=generator, gpu=args.gpu)
  File "/home/naldwig/Desktop/Files/SRGAN-PyTorch/srgan_pytorch/utils/estimate.py", line 94, in test
    total_gmsd_value += gmsd_loss(sr, hr)
  File "/home/naldwig/Desktop/Files/SRGAN-PyTorch/venv/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/naldwig/Desktop/Files/SRGAN-PyTorch/srgan_pytorch/utils/image_quality_assessment/calculate_gmsd.py", line 66, in forward
    out = torch.mean(self.gmsd(source * 255, target * 255))
  File "/home/naldwig/Desktop/Files/SRGAN-PyTorch/srgan_pytorch/utils/image_quality_assessment/calculate_gmsd.py", line 40, in gmsd
    stride=2, padding=0, groups=3)
RuntimeError: Given groups=3, weight of size [3, 1, 2, 2], expected input[19, 1, 96, 96] to have 3 channels, but got 1 channels instead

from srgan-pytorch.

Lornatang avatar Lornatang commented on May 30, 2024

GMSD support RGB image, not support gray image.

from srgan-pytorch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.