Implementation of paper: "Image Super-Resolution Using Dense Skip Connections" in PyTorch

Overview

SRDenseNet-pytorch

Implementation of paper: "Image Super-Resolution Using Dense Skip Connections" in PyTorch (http://openaccess.thecvf.com/content_ICCV_2017/papers/Tong_Image_Super-Resolution_Using_ICCV_2017_paper.pdf) image

Usage

Training

usage: main.py [-h] [--batchSize BATCHSIZE] [--nEpochs NEPOCHS] [--lr LR]
               [--step STEP] [--cuda] [--resume RESUME]
               [--start-epoch START_EPOCH] [--threads THREADS]
               [--pretrained PRETRAINED]

Pytorch SRDenseNet train

optional arguments:
  -h, --help            show this help message and exit
  --batchSize BATCHSIZE
                        training batch size
  --nEpochs NEPOCHS     number of epochs to train for
  --lr LR               Learning Rate. Default=1e-4
  --step STEP           Sets the learning rate to the initial LR decayed by
                        10 every n epochs, Default: n=30
  --cuda                Use cuda?
  --resume RESUME       Path to checkpoint (default: none)
  --start-epoch START_EPOCH
                        Manual epoch number (useful on restarts)
  --threads THREADS     Number of threads for data loader to use, Default: 1
  --pretrained PRETRAINED
                        path to pretrained model (default: none)

Test

usage: test.py [-h] [--cuda] [--model MODEL] [--imageset IMAGESET] [--scale SCALE]

Pytorch SRDenseNet Test

optional arguments:
  -h, --help     show this help message and exit
  --cuda         use cuda?
  --model MODEL  model path
  --imageset IMAGESET  imageset name
  --scale SCALE  scale factor, Default: 4

Prepare Training dataset

The training data is generated with Matlab Bicubic Interplotation, please refer Code for Data Generation for creating training files.

Prepare Test dataset

The test imageset is generated with Matlab Bicubic Interplotation, please refer Code for test for creating test imageset.

Performance

We provide a pretrained .SRDenseNet x4 model trained on DIV2K images from [DIV2K_train_HR] (http://data.vision.ee.ethz.ch/cvl/DIV2K/DIV2K_train_HR.zip).While I use the SR_DenseNet to train this model, so the performance is test based on this code.

Non-overlapping sub-images with a size of 96 × 96 were cropped in the HR space. Other settings is the same as the original paper

  • Performance in PSNR on Set5, Set14, and BSD100
DataSet/Method Paper PyTorch
Set5 32.02/0.893 31.57/0.883
Set14 28.50/0.778 28.11/0.771
BSD100 27.53/0.733 27.32/0.729
Comments
  • problem in training

    problem in training

    Thank you for you wonderful work! I want to train a model on my own dataset, but I meet a problem in the beginning of training, the error is described as below:

    ===> Setting GPU => loading model 'model_0.0001_epoch_60.pth' /home/weihq/anaconda3/lib/python3.6/site-packages/torch/serialization.py:368: SourceChangeWarning: source code of class 'torch.nn.parallel.data_parallel.DataParallel' has changed. you can retrieve the original source code by accessing the object's source attribute or set torch.nn.Module.dump_patches = True and use the patch tool to revert the changes. warnings.warn(msg, SourceChangeWarning) Traceback (most recent call last): File "train.py", line 89, in weights = torch.load(opt.pretrained) File "/home/weihq/anaconda3/lib/python3.6/site-packages/torch/serialization.py", line 304, in load return _load(f, map_location, pickle_module) File "/home/weihq/anaconda3/lib/python3.6/site-packages/torch/serialization.py", line 470, in _load result = unpickler.load() UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 918: ordinal not in range(128)

    It seems that this error is caused by the encode-decode, but I can't find a effective solution in the webside. hoping you can give me some suggestions. I am Sincerely grateful to your reading.

    opened by meroluo 6
  • about dataset

    about dataset

    Thanks for your code first! I‘d like to ask the input and out put, which puzzled me for a long time.

    1. Do you pre-process your input image? such as normalization.
    2. About the output scale. For instance, if the input image is 25 x 25, then i'll finally get 100 x 100 output only in Y channel. If i want to visualize the output, the Cb and Cr channel need to be concatenate with output, but Cb and Cr channel of input LR is 25 x 25. I guess you use the bicubic interpolation to resize the Cb Cr to 100 x 100, is that correct? I am a green hand in DL and CV, so maybe some question may stupid. I'll very appreciate if you can solve my problem. Thank you!
    opened by ShinoSpace 2
  • No module named SR_DenseNet

    No module named SR_DenseNet

    Hi: thanks for sharing your impressive job, I want to evaluate perfermance in test.py ,I have downloaded your shared model , I encounter a error"No module named SR_DenseNet",but I can't find this class in this repo,can you add it ?thanks very much

    opened by jeejeeli 2
  • the structure of SRDenseNet-pytorch

    the structure of SRDenseNet-pytorch

    the paper said:

    Figure 2. The structure of one DenseNet block. Each block consists of 8 convolution layers. The growth rate is set to 16 and the output of each block has 128 feature maps.

    It seems outChannels is from 16 to 128 in each dense block. denseblock1: 16 -> 128(16 x 8) denseblock2: 16 -> 128(16 x 8) ... ... denseblock8: 16 -> 128(16 x 8)

    but SRDenseNet-pytorch, the outChannels seems from (1 x 16) to (64 x 16), I think your model is different, and much bigger.

    opened by InsightDev 1
  • Undefined names in train.py

    Undefined names in train.py

    flake8 testing of https://github.com/wxywhu/SRDenseNet-pytorch on Python 3.6.3

    $ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics

    ./train.py:131:39: F821 undefined name 'testing_data_loader'
        for iteration, batch in enumerate(testing_data_loader,1):
                                          ^
    ./train.py:142:63: F821 undefined name 'testing_data_loader'
                print("({}/{}):psnr:{:.8f}".format(iteration, len(testing_data_loader),psnr))
                                                                  ^
    ./train.py:143:13: F821 undefined name 'writer'
                writer.add_scalar('psnr', psnr, (epoch-1)* 469 +iteration)
                ^
    ./train.py:145:13: F821 undefined name 'tf'
                tf.summary.scalar('psnr', psnr)
                ^
    ./train.py:146:18: F821 undefined name 'tf'
                op = tf.summary.merge_all()
                     ^
    ./train.py:147:27: F821 undefined name 'sess'
                summary_str = sess.run(op)
                              ^
    ./train.py:150:61: F821 undefined name 'testing_data_loader'
        print("===> Avg. PSNR: {:.8f} dB".format(avg_psnr / len(testing_data_loader)))
                                                                ^
    7     F821 undefined name 'testing_data_loader'
    7
    
    opened by cclauss 1
  • I cannot download pretrained model

    I cannot download pretrained model

    I cannot download your pretrained model from baidu.

    Because I have not baidu account.

    Could I get an alternative link for download your pretrained model?

    Thank you.

    opened by JunyoungPark95 0
  • About H5py

    About H5py

    Why use your code to make the H5 file in MATLAB, there will be the following error: TypeError: h5py objects cannot be pickled. What could be the reason? Looking forward to your answer

    opened by qiqiing 0
  • About Dense Net

    About Dense Net

    Does the code you implement have the same network structure as the item C in Fig. 1 suggested by the author of the paper? If so, may I ask what the meaning of Densely Skip Connection in the picture is?

    opened by Town-milk 0
  • modify scale factor

    modify scale factor

    I download the pretrained model and test it. Excellent work! I
    

    find the scale factor in the SRDensnet model is 4. what can I do if I want to use 2 or other scale factor ? Thank you for your reply !!!

    opened by piaohe111 0
Owner
wxy
wxy
HashNeRF-pytorch - Pure PyTorch Implementation of NVIDIA paper on Instant Training of Neural Graphics primitives

HashNeRF-pytorch Instant-NGP recently introduced a Multi-resolution Hash Encodin

Yash Sanjay Bhalgat 616 Jan 6, 2023
ALBERT-pytorch-implementation - ALBERT pytorch implementation

ALBERT-pytorch-implementation developing... 모델의 개념이해를 돕기 위한 구현물로 현재 변수명을 상세히 적었고

BG Kim 3 Oct 6, 2022
The LaTeX and Python code for generating the paper, experiments' results and visualizations reported in each paper is available (whenever possible) in the paper's directory

This repository contains the software implementation of most algorithms used or developed in my research. The LaTeX and Python code for generating the

João Fonseca 3 Jan 3, 2023
Official PyTorch implementation for paper Context Matters: Graph-based Self-supervised Representation Learning for Medical Images

Context Matters: Graph-based Self-supervised Representation Learning for Medical Images Official PyTorch implementation for paper Context Matters: Gra

null 49 Nov 23, 2022
A PyTorch re-implementation of the paper 'Exploring Simple Siamese Representation Learning'. Reproduced the 67.8% Top1 Acc on ImageNet.

Exploring simple siamese representation learning This is a PyTorch re-implementation of the SimSiam paper on ImageNet dataset. The results match that

Taojiannan Yang 72 Nov 9, 2022
This is a Pytorch implementation of the paper: Self-Supervised Graph Transformer on Large-Scale Molecular Data.

This is a Pytorch implementation of the paper: Self-Supervised Graph Transformer on Large-Scale Molecular Data.

null 212 Dec 25, 2022
Official pytorch implementation of paper "Image-to-image Translation via Hierarchical Style Disentanglement".

HiSD: Image-to-image Translation via Hierarchical Style Disentanglement Official pytorch implementation of paper "Image-to-image Translation

null 364 Dec 14, 2022
PyTorch implementation of paper "Neural Scene Flow Fields for Space-Time View Synthesis of Dynamic Scenes", CVPR 2021

Neural Scene Flow Fields PyTorch implementation of paper "Neural Scene Flow Fields for Space-Time View Synthesis of Dynamic Scenes", CVPR 20

Zhengqi Li 585 Jan 4, 2023
Official pytorch implementation of paper "Inception Convolution with Efficient Dilation Search" (CVPR 2021 Oral).

IC-Conv This repository is an official implementation of the paper Inception Convolution with Efficient Dilation Search. Getting Started Download Imag

Jie Liu 111 Dec 31, 2022
Official implementation of our paper "LLA: Loss-aware Label Assignment for Dense Pedestrian Detection" in Pytorch.

LLA: Loss-aware Label Assignment for Dense Pedestrian Detection This project provides an implementation for "LLA: Loss-aware Label Assignment for Dens

null 35 Dec 6, 2022
An implementation of Geoffrey Hinton's paper "How to represent part-whole hierarchies in a neural network" in Pytorch.

GLOM An implementation of Geoffrey Hinton's paper "How to represent part-whole hierarchies in a neural network" for MNIST Dataset. To understand this

null 50 Oct 19, 2022
Official implementation of our CVPR2021 paper "OTA: Optimal Transport Assignment for Object Detection" in Pytorch.

OTA: Optimal Transport Assignment for Object Detection This project provides an implementation for our CVPR2021 paper "OTA: Optimal Transport Assignme

null 217 Jan 3, 2023
This is the official PyTorch implementation of the paper "TransFG: A Transformer Architecture for Fine-grained Recognition" (Ju He, Jie-Neng Chen, Shuai Liu, Adam Kortylewski, Cheng Yang, Yutong Bai, Changhu Wang, Alan Yuille).

TransFG: A Transformer Architecture for Fine-grained Recognition Official PyTorch code for the paper: TransFG: A Transformer Architecture for Fine-gra

Ju He 307 Jan 3, 2023
[PyTorch] Official implementation of CVPR2021 paper "PointDSC: Robust Point Cloud Registration using Deep Spatial Consistency". https://arxiv.org/abs/2103.05465

PointDSC repository PyTorch implementation of PointDSC for CVPR'2021 paper "PointDSC: Robust Point Cloud Registration using Deep Spatial Consistency",

null 153 Dec 14, 2022
PyTorch implementation of the Deep SLDA method from our CVPRW-2020 paper "Lifelong Machine Learning with Deep Streaming Linear Discriminant Analysis"

Lifelong Machine Learning with Deep Streaming Linear Discriminant Analysis This is a PyTorch implementation of the Deep Streaming Linear Discriminant

Tyler Hayes 41 Dec 25, 2022
The official pytorch implementation of our paper "Is Space-Time Attention All You Need for Video Understanding?"

TimeSformer This is an official pytorch implementation of Is Space-Time Attention All You Need for Video Understanding?. In this repository, we provid

Facebook Research 1k Dec 31, 2022
PyTorch 1.5 implementation for paper DECOR-GAN: 3D Shape Detailization by Conditional Refinement.

DECOR-GAN PyTorch 1.5 implementation for paper DECOR-GAN: 3D Shape Detailization by Conditional Refinement, Zhiqin Chen, Vladimir G. Kim, Matthew Fish

Zhiqin Chen 72 Dec 31, 2022
Pytorch implementation of our paper under review — Lottery Jackpots Exist in Pre-trained Models

Lottery Jackpots Exist in Pre-trained Models (Paper Link) Requirements Python >= 3.7.4 Pytorch >= 1.6.1 Torchvision >= 0.4.1 Reproduce the Experiment

Yuxin Zhang 27 Jun 28, 2022
Official Pytorch Implementation of: "ImageNet-21K Pretraining for the Masses"(2021) paper

ImageNet-21K Pretraining for the Masses Paper | Pretrained models Official PyTorch Implementation Tal Ridnik, Emanuel Ben-Baruch, Asaf Noy, Lihi Zelni

null 574 Jan 2, 2023