RIDNet (Real Image Denoising with Feature Attention)

repository·master·Indexed 18 days ago

https://github.com/saeed-anwar/ridnet

A deep learning framework for single-stage blind real image denoising. RIDNet utilizes a Residual on the Residual structure and Feature Attention (EAM) to handle real-world noisy photographs. Developed using PyTorch 0.4.0/0.4.1, CUDA 9.0, and cuDNN 5.1.

Tokens
1.1K
Snippets
4
Records
5
Agent score
13%

What's inside RIDNet

  1. Overview of RIDNet (Real Image Denoising with Feature Attention)

    master

    RIDNet is a single-stage blind real image denoising network designed to handle real-noisy photographs. Unlike networks optimized for spatially invariant (synthetic) noise, RIDNet uses a modular architecture featuring:

    • Residual on the Residual structure: To facilitate the flow of low-frequency information.
    • Feature Attention (EAM): To exploit channel dependencies and select essential features.

    The model was originally developed using PyTorch 0.4.0/0.4.1 on Ubuntu environments with CUDA 9.0.

  2. Quick start: Test the RIDNet denoising model

    master

    To test the RIDNet algorithm on images, follow these steps:

    1. Download Models: Download the trained models and place them in the /TestCode/experiment directory.
    2. Navigate to Code: Change your working directory to /TestCode/code.
    3. Run Inference: Execute the main.py script using the command provided below.

    Ensure you have the necessary dependencies installed (PyTorch 0.4.0/0.4.1, CUDA 9.0, and cuDNN 5.1 are the tested environments).

    #RIDNET
    CUDA_VISIBLE_DEVICES=0 python main.py --data_test MyImage --noise_g 1 --model RIDNET --n_feats 64 --pre_train ../experiment/ridnet.pt --test_only --save_results --save 'RIDNET_RNI15' --testpath ../LR/LRBI/ --testset RNI15
  3. Setup the experiment directory with pre-trained models

    master

    To use the pre-trained models for the RIDNet experiments, download the model weights from the provided Google Drive link and replace the existing experiment directory in your local repository with the downloaded contents.

    # 1. Download the model from:
    # https://drive.google.com/open?id=1QxO6KFOVxaYYiwxliwngxhw_xCtInSHd
    
    # 2. Replace the local 'experiment' directory with the downloaded files
    rm -rf experiment
    mv /path/to/downloaded_model experiment
  4. Run the RIDNet denoising pipeline via main.py

    master

    The main.py script serves as the primary entrypoint for the RIDNet project. It orchestrates the entire lifecycle of the denoising process, including data loading, model initialization, loss calculation, and the training/testing loop.

    Depending on the configuration provided via args, the script can operate in either training mode or test-only mode.

    • Training Mode: Initializes a Trainer object that executes both t.train() and t.test() cycles until termination.
    • Test-Only Mode: If args.test_only is enabled, the loss function is bypassed, and the pipeline focuses on inference/testing.

    To use this entrypoint, you must provide a configuration (typically via command-line arguments parsed by option.args) that specifies the seed, checkpoint paths, and whether to run in test-only mode.

    # The script is executed as a standalone entrypoint
    # It relies on command-line arguments defined in 'option.py'
    python main.py --test_only --seed 42 ...
  5. Reference: RIDNet testing CLI arguments

    master

    The main.py script in /TestCode/code accepts several arguments for running the denoising test.

    Note: The following flags are used in the standard RIDNet test invocation:

    --data_test <name>       # Name of the test data
    --noise_g <int>          # Noise parameter
    --model <string>         # Model type (e.g., RIDNET)
    --n_feats <int>          # Number of features
    --pre_train <path>       # Path to the pre-trained model file (.pt)
    --test_only              # Run in test-only mode
    --save_results           # Flag to save results
    --save <string>          # Name/directory to save results
    --testpath <path>        # Path to the test images
    --testset <string>       # Name of the test set (e.g., RNI15)