Deep Learning Fluorescence Denoising - jeanollion/bacmman GitHub Wiki
Use Neural-Network-Based Denoising
This tutorial is based on the work described in this publication. This is a neural-network-based method that allows a very efficient denoising, without needing clean data. The drawback is that when it is train on a dataset, it can only be used on this dataset (or dataset with same acquisition parameters and same type of samples). Another limitation of this method is that noise cannot be structured. However, you will see that the sample images of this tutorial have strong banding noise, but as it is removed before applying denoising, the method still works, with limited performances though.
We will see how to:
- Create a dataset from the Online Configuration Library
- Configure neural-network-based denoising using the Online DL Model Library
- Download the trained weights of the denoising module from the Online DL Model Library
If necessary, install bacmman, along with Tensorflow 2. If you do not know which option to choose between CPU and GPU, choose CPU.
Create a Dataset
Important: If using bacmman for the first time: choose a working directory through right-click on the panel below Working Directory
.
We will start by creating a dataset using the default template of BACMMAN:
Choose menu command: Dataset > New Dataset from Online Library
.
Set jeanollion
as username
in the Github Credentials
panel, and select the configuration ExampleDatasets > fluo_denoising
Click OK
: this will create a new dataset and open it.
In BACMMAN a dataset is a configuration associated to multi-position/multi-channel/muti-frame input images.
The configuration can be checked in the Configuration
tab.
Download Example Dataset and Import Images
A subset of 49 frames of fluorescence images of mother machine data can be downloaded directly from BACMMAN. To do so, choose menu command: Import > Sample Datasets > Mother Machine > Fluorescence
, and select the directory where it will be downloaded.
Import the downloaded images into the open dataset, by choosing the menu command Run > Import/re-link Images
:
An element will appear in the Position panel
.
To visualize the images right click-on the position and choose Open Input Images
Add DL-based Denoising in the pre-processing
In BACMMAN, the first processing step is called pre-processing. It's goal is mainly to perform transformations of the input images, such as rotation, cropping, registrations etc... As denoising requires to be performed before any operation that involves interpolation (such as rotation), we need to add the denoising as a pre-processing step. If there was no rotation, we could also use it as a pre-filter step within the processing pipeline of an object class.
Go to the Configuration Test
tab.
All the transformations performed during pre-processing are listed.
We will add the denoising of the RFP channel just after the second item named RemoveStripesSignalExclusion
.
To to so, right-click on it and choose Add
:
This will add an item in the list. Then select DLFilterSimple
in the Available Modules
panel:
This module simply run a neural-network-based filter on one channel. To configure it:
Set Channel on which apply transformation
to RFP
.
The model
parameter allows to define which neural-network framework will be used to run the model.
Click on it an choose TF2Engine
(which corresponds to the Tensorflow v2.x framework):
Configure DL-based Denoising
To further configure it, we will use the Online DL Model Library, which contains the model weights as well as associated metadata. BACMMAN can use this metadata to configure the parameters of the module, and download the trained weights.
To do so, right-click on Tensorflow model
and choose Configure from Library
:
Set jeanollion
as username
in the Github Credentials
panel, select the model Denoising > RFP_201016
and click on Configure Parameter
This will configure the selected parameter. In particular, it filled the parameter called Model ID
(under the parameter Tensorflow model
) and this allows BACMMAN to download the model weights. You can see that the model weights are not on the disk because the parameter Model file
appears in red.
To do download the model weights:
- Create a folder to download the weights to (for instance a folder named DLModels in the working directory)
- Right-click on the
Model file
parameter and select the folder you juste created. - Right-click on
Tensorflow model
and chooseDownload Model
We can now test the transformation. To do so right-click on the item you created called Transformation: DLFIlterSimple
and choose Test Transformation
Those two images should be displayed:
Configure DL-based Denoising for the other channel:
Follow the same steps to add a filter for the other channel:
- Add the transformation after
CopyTo
- Set
Channel on which apply transformation
toYFP_denoised
. - In the model library choose
Denoising > YFP_201016