Skip to content

Latest commit

 

History

History
134 lines (76 loc) · 3.29 KB

README.md

File metadata and controls

134 lines (76 loc) · 3.29 KB

DNCnnV

Introduction

This is a PyTorch implementation of DNCnn for image denoising and de-blurring. Dncnn is a deep convolutional neural network for image denoising. It is a fully convolutional network with residual learning and batch normalization. The network is trained end-to-end with mean squared error (MSE) loss.

Requirements

main requirements of this project is

  1. python >= 3.6
  2. pytorch >= 1.6 (2.0 recommended)
  3. torchvision >= 0.7

please read through the pytorch installation guide here to install pytorch and torchvision according to your system requirements.

Propose model structures

Alt text

Note : while training the model we have used the same architecture as shown in the above figure. But there are something to keep in mind while using this architecture.

model config contain up_scale parameter. this parameter is used to scale the image after feeding it to the network. Every up_scale layer will scale the image by 2.Example : input --> 64x64x3 image --> after 1st up_scale --> 128x128x3 image --> after 2nd up_scale --> 256x256x3 image.you need to change the transform t2 image size 256,256 to match the output size of the network.

installation and setup for training

  1. Clone the repository
git clone <repo url>
  1. create conda environment
conda create -n <env name> python>=3.6 -y
  1. activate the environment
conda activate <env name>
  1. install the requirements
pip install -r requirements.txt
  1. install the package
pip install -e .
  1. Update Device configuration in the config file
Open the  config/config.yaml file and update the device parameter to match your system configuration. 

Train_Config: device: if you have a gpu then set it to 'cuda' else set it to 'cpu'


## dataset setup 

for this project we have used the BSDS500 dataset for training and testing. The dataset can be downloaded from [here](https://www2.eecs.berkeley.edu/Research/Projects/CS/vision/grouping/resources.html#bsds500). 


dataset images demon 
--> dataset demo image 



  1. create train and val and test folders inside the dataset folder 
  2. paste the images inside the train and val and test folders accordingly . recommended to create hr inside the train and val and test     folders and paste the images accordingly.

folder structure should be like this 

```bash
dataset 
    |__ train 
    |    |__ hr 
    |    |    |__ 1.png 
    |    |    |__ 2.png 

    |__ val
    |    |__ hr
    |    |    |__ 1.png
    |    |    |__ 2.png

    |__ test
    |    |__ hr
    |    |    |__ 1.png
    |    |    |__ 2.png

Note : following this structure is not mandatory. you can change the structure according to your needs. but you have to change the paths accordingly in the config file.

training

before training you can change the parameters in the config file according to your needs. please chang the directory paths accordingly in the config file.

cd dncnn/components/
python python trainer.py 
    

results

demo training results

validation loss vs training loss

demo testing results

prediction

Alt textAlt text