Giter Site home page Giter Site logo

lornatang / csnln-pytorch Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 2.0 652 KB

PyTorch implemnts `Image Super-Resolution with Cross-Scale Non-Local Attention and Exhaustive Self-Exemplars Mining` paper.

License: Apache License 2.0

Python 100.00%
pytorch reproducible-research super-resolution

csnln-pytorch's Introduction

Hi, my dear friend, I am committed to promoting the development of GAN.

Anurag's github stats

csnln-pytorch's People

Contributors

lornatang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

csnln-pytorch's Issues

PSNR-inf and SSIM nan

Excuse me, PSNR-inf and SSIM nan appear when I run the first 10 epoch. What should I do?

Pretrained model is not working

Hello,

When I tried to use your pre trained model, I have face this error.

validation mode

results/CSNLN_x3/best.pth.tar
Build CSNLN model successfully.
Traceback (most recent call last):
  File "validate.py", line 95, in <module>
    main()
  File "validate.py", line 34, in main
    model.load_state_dict(checkpoint["state_dict"])
KeyError: 'state_dict'

config.py

import random
from traceback import print_tb

import numpy as np
import torch
from torch.backends import cudnn

# Random seed to maintain reproducible results
random.seed(0)
torch.manual_seed(0)
np.random.seed(0)
# Use GPU for training by default
device = torch.device("cuda", 0)
# Turning on when the image size does not change during training can speed up training
cudnn.benchmark = True
# Image magnification factor
upscale_factor = 3
# Current configuration parameter method
mode = "valid"
# Experiment name, easy to save weights and log files
exp_name = "CSNLN_x" + str(upscale_factor)

if mode == "train":
    # Dataset
    train_image_dir = f"data/DIV2K/CSNLN/train"
    valid_image_dir = f"data/DIV2K/CSNLN/valid"
    test_lr_image_dir = f"data/Set5/LRbicx{upscale_factor}"
    test_hr_image_dir = f"data/Set5/GTmod12"

    image_size = int(upscale_factor * 48)
    batch_size = 16
    num_workers = 4

    # Incremental training and migration training
    start_epoch = 0
    resume = ""

    # Total num epochs
    epochs = 50

    # Adam optimizer parameter
    model_lr = 1e-4
    model_betas = (0.9, 0.999)

    # StepLR scheduler parameter
    lr_scheduler_step_size = 15
    lr_scheduler_gamma = 0.5

    print_frequency = 100

if mode == "valid":
    print("validation mode")
    # Test data address
    lr_dir = f"data/Set5/LRbicx{upscale_factor}"
    sr_dir = f"results/test/{exp_name}"
    hr_dir = f"data/Set5/GTmod12"
    
    model_path = f"results/{exp_name}/best.pth.tar"
    print(model_path)


how to train x4model

hi! the sever show out of memory when i train x4model. i should how to set bath_size and patch_size? my gpu gtx 24g

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.