The goal is to remove noise from an image. Our library includes Noise2Void [KBJ19] using any of the U-Net versions provided. The main advantage of Noise2Void is neither relying on noise image pairs nor clean target images since frequently clean images are simply unavailable.

  • Input:

    • Noisy image (single-channel or multi-channel). E.g. image with shape (500, 500, 1) (y, x, channels) in 2D or (100, 500, 500, 1) (z, y, x, channels) in 3D.

  • Output:

    • Image without noise.

In the figure below an example of this workflow’s input is depicted:


Input image. Obtained from Noise2Void project.

Data preparation

To ensure the proper operation of the library the data directory tree should be something like this:

Expand directory tree
├── train
│   └── x
│       ├── training-0001.tif
│       ├── training-0002.tif
│       ├── . . .
│       ├── training-9999.tif
└── test
    └── x
       ├── testing-0001.tif
       ├── testing-0002.tif
       ├── . . .
       ├── testing-9999.tif

Configuration file

Find in templates/denoising folder of BiaPy a few YAML configuration templates for this workflow.

Special workflow configuration

Please refer to Noise2Void to understand the method functionality. These variables can be set:

  • PROBLEM.DENOISING.N2V_PERC_PIX controls the percentage of pixels per input patch to be manipulated. This is the n2v_perc_pix in their code.

  • PROBLEM.DENOISING.N2V_MANIPULATOR controls how the pixels will be replaced. This is the n2v_manipulator in their code.

  • PROBLEM.DENOISING.N2V_NEIGHBORHOOD_RADIUS controls the radius of the neighborhood. This is the n2v_neighborhood_radius in their code.

  • PROBLEM.DENOISING.N2V_STRUCTMASK whether to use Struct Noise2Void.


Select denoising workflow during the creation of a new configuration file:


The results are placed in results folder under --result_dir directory with the --name given. An example of this workflow is depicted below:


Example of denoising model prediction.

Following the example, you should see that the directory /home/user/exp_results/my_2d_denoising has been created. If the same experiment is run 5 times, varying --run_id argument only, you should find the following directory tree:

Expand directory tree
├── config_files/
│   └── my_2d_denoising.yaml
├── checkpoints
|   ├── my_2d_denoising_1-checkpoint-best.pth
|   ├── normalization_mean_value.npy
│   └── normalization_std_value.npy
└── results
   ├── my_2d_denoising
    ├── . . .
    └── my_2d_denoising
        ├── cell_counter.csv
        ├── aug
           └── .tif files
       ├── charts
           ├── my_2d_denoising_1_n2v_mse.png
           ├── my_2d_denoising_1_loss.png
           └── model_plot_my_2d_denoising_1.png
       ├── per_image
           └── .tif files
        ├── train_logs
        └── tensorboard

  • config_files: directory where the .yaml filed used in the experiment is stored.

    • my_2d_denoising.yaml: YAML configuration file used (it will be overwrited every time the code is run).

  • checkpoints: directory where model’s weights are stored.

    • my_2d_denoising_1-checkpoint-best.pth: checkpoint file (best in validation) where the model’s weights are stored among other information.

    • normalization_mean_value.npy: normalization mean value (only created if DATA.NORMALIZATION.TYPE is custom). Is saved to not calculate it everytime and to use it in inference.

    • normalization_std_value.npy: normalization std value (only created if DATA.NORMALIZATION.TYPE is custom). Is saved to not calculate it everytime and to use it in inference.

  • results: directory where all the generated checks and results will be stored. There, one folder per each run are going to be placed.

    • my_2d_denoising_1: run 1 experiment folder.

      • cell_counter.csv: file with a counter of detected objects for each test sample.

      • aug: image augmentation samples.

      • charts:

        • my_2d_denoising_1_*.png: Plot of each metric used during training.

        • my_2d_denoising_1_loss.png: Loss over epochs plot (when training is done).

        • model_plot_my_2d_denoising_1.png: plot of the model.

      • per_image:

        • .tif files: reconstructed images from patches.

      • train_logs: each row represents a summary of each epoch stats. Only avaialable if training was done.

      • tensorboard: Tensorboard logs.


Here, for visualization purposes, only my_2d_denoising_1 has been described but my_2d_denoising_2, my_2d_denoising_3, my_2d_denoising_4 and my_2d_denoising_5 will follow the same structure.