Giter Club home page Giter Club logo

image-super-resolution-1's Introduction

Image super resolution

Introduction

this project is a reproduction of the famous paper Learning a Deep Convolutional Network for Image Super-Resolution which was publish in 2014 using CNN to do super resolution work

Result

low-resolution high-resolution

Related work

Requirements

  • pytorch

  • pip install -r requirements.txt

Use

Step1: Prepare the dataset

download the standard dataset The 91-image(train set), Set5(test set) dataset converted to HDF5 can be downloaded from the links below.

Dataset Scale Type Link
91-image 2 Train Download
91-image 3 Train Download
91-image 4 Train Download
Set5 2 Eval Download
Set5 3 Eval Download
Set5 4 Eval Download

Download any one of 91-image and Set5 in the same Scale and then move them under ./datasets as ./datasets/91-image_x2.h5 and ./datasets/Set5_x2.h5

Step2: Train the model

  • easy run

    python train.py
  • about arguments

    • train-file eval-file 2/3/4, different datasets to choose
    • batch-size
    • num-workers
    • lr learning rate
    • epoch
    • f frequency to test the model
    • model-dir where the model was saved
    python train.py --train-file 4 --eval-file 4 --batch-size 64 --lr 1e-5 --num-workers 8 --epoch 500 --f 10 

    All model will be saved under ./model and the best model is ./model/best.pth

Step3: Download the pretrained model(**If you have trained your model, skip this part)

Move the model weights under ./model as ./model/best.pth or ./model/b.pth

Step4: Do super resolution

python use.py --weights-file ./model/best.pth --image x/xx/xxx.jpg

By default, the weights file is ./model/best.pth, if you want to use b.pth please replace it. A picture will be created named as xxx_srcnn.jpg

Conclusion

This is just a CNN try for me, to familiar with basic steps of machine learning, almost all code comes from here,I just follow his step and reapperance his job. The final result couldn't satisfy me, it actually should be called little super resolution haha. However, there's no doubt that idea of SRCNN was novelty in that period. If you want to improve the neural network, build a deeper model and try Resnet model.

If you are interested in it, you could see this great job and i strongly recommend it.

some errors you may occur

  • OSError: Unable to open file (file locking disabled on this file system (use HDF5_USE_FILE_LOCKING

    Solution:

    #linux
    nano ~/.brashrc

    Add export HDF5_USE_FILE_LOCKING='FALSE' in a line, use Ctrl-X to exit

    source ~/.barshrc
  • OSError: [WinError 1455] 页面文件太小,无法完成操作。 Error loading "C:\ProgramData\Anaconda3\envs\study_and_test\lib\site-packages\torch\lib\caffe2_detectron_ops_gpu.dll" or one of its dependencies. Solution:

    python train.py --num-workers 0

image-super-resolution-1's People

Contributors

luzhixing12345 avatar

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.