A napari plugin performing joint denoising and segmentation
of microscopy images using DenoiSeg.

View the Project on GitHub juglab/napari-denoiseg


napari-denoiseg is based on the original algorithm from the Jug lab: DenoiSeg, and uses CSBDeep. DenoiSeg is an algorithm allowing the joint denoising and segmentation of microscopy data using little ground-truth annotation. DenoiSeg is an offshoot of Noise2Void.

napari-denoiseg contains three different napari plugins: DenoiSeg train, DenoiSeg optimize and DenoiSeg predict.

  1. DenoiSeg train
  2. DenoiSeg optimize
  3. DenoiSeg predict

DenoiSeg train


  1. GPU availability
  2. Data loading
  3. Training parameters
  4. Expert training parameters
  5. Training
  6. Training progress
  7. Model saving

1 - GPU availability

This small widget checks whether a GPU device is available to TensorFlow. If the GPU is available, then you will see the following:


If the GPU is not available, the widget will show a yellow CPU.

GPU availability does not ensure that the code will run on the GPU, but it is a necessary condition.

2 - Data loading

The data loading panel has two tabs: From layers and From disk :

  1. From layers: Choose among the available napari layers data for the Train and Val. Note that if Val is empty or equal to Train, a portion of the training data will be extracted as validation data.
  2. From disk: Use the choose button to point to folders containing images. The images can be of different dimensions but should have the same axes (e.g. TXY). Note that if Val is empty or equal to Train, a portion of the training data will be extracted as validation data. When selecting a folder for the Train set, the first image will be loaded as sample into napari to estimate the axes (see Axes in the next section).

3 - Training parameters


The training parameters are the basic settings you can use to tune your DenoiSeg training:

4 - Expert training parameters

The expert training parameters can be set by clicking on the gear button, modifying the relevant settings and closing the window.

expert settings

5 - Training

Depending on the stage of the training, the Training panel has different buttons:


Important: at the beginning of the training, the patches are created. This process can take some time and might appear as hanging while it is running.

Note: continuing training will train with the same parameters as before, to the exception of the number of epochs, which can be updated.

Note: During training, the log and the weights are saved to a hidden folder in your /home/, under .napari/DenoiSeg/models.

6 - Training progress


The training progress panel shows the following:

7 - Model saving


After training, the model can be saved to the location of your choice. Aside from saving the model weights, the plugin also saves a config.json file containing all the parameters of the training.. The model weights can be saved in two formats:

DenoiSeg optimize

The optimize threshold helps you determine the best threshold for prediction based on images with ground-truth (e.g. validation set).

Important: it is better to use the validation set or new data to run the optimize threshold, rather than the training data. Indeed the model has been trained to perform specifically well on the training set, and the best threshold obtained with training data might not generalize well to data unseen during training.

The plugin works loads images and labels from the napari or from the disk. It then predicts results for all images using a trained model, thresholds the resulting foreground image and measure a metrics (accuracy, similar to Jaccard).

Use the threshold with the best accuracy in the prediction.

DenoiSeg predict


Multiple aspects of the DenoiSeg - predict plugin are similar to the DenoiSeg - train plugin, refer to the latter one for missing information.

  1. Data loading
  2. Parameters
  3. Tiling
  4. Threshold
  5. Prediction

1 - Data loading

Data can be loaded directly from napari layers or from the disk.

Note that if you select a training folder, the plugin will try to load the first image it finds in order to assert the axes.

2 - Parameters

The parameters Axes and Enable 3D are similar to the corresponding ones in DenoiSeg - Train. In addition, model weights should be loaded from the disk and should correspond to a config.json file in the same folder. The plugin throws an error if no configuration is found.

3 - Tiling

4 - Threshold

Select Apply threshold to automatically threshold the probability maps (background, foreground and border) using the Threshold.

Note: you can determine an appropriate threshold using ground-truth data and the optimize plugin.

5 - Predict

Apply the model to the images. See the previous sections for details about the prediction modalities.