-
Notifications
You must be signed in to change notification settings - Fork 1
DistNet
This tutorial is based on the work described in this publication. DiSTNet is a deep learning-based method that simultaneously segment and track bacteria.
We will see how to:
- Use the Online Configuration Library to use DiSTNet in BACMMAN
- Download the trained weights of DiSNet from the Online DL Model Library
- Perform pre-processing, segmentation & tracking of microchannels and visualize image and results
- Use DiSNet
If necessary, install bacmman, along with Tensorflow 2. If you do not know which option to choose between CPU and GPU, choose CPU.
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 > dataset1

Click OK, it 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.
A subset of 50 of the example dataset 1 can be downloaded directly from BACMMAN. To do so, choose menu command: Import > Sample Datasets > Mother Machine > Phase Contrast, 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

In this case pre-processing consist of an automatic rotation of the images to have microchannels vertically aligned with the open end towards the lower part of the image. The images are also cropped to remove the bright line and useless area of the image.
To run pre-processing and microchannel segmentation & tracking,
- Select the position (when no position is selected, all positions are processed)
- Select the tasks:
Pre-ProcessingandSegmentation & Tracking - Choose the menu command
Run > Run Selected Tasks

To visualize the pre-processed images right-click on the position and choose Open Pre-Processed Images

To visualize the result of microchannel segmentation and tracking:
- Go to the
Data Browsingtab - Right-click on the position and choose
Open Hyperstack > Microchannels

The pre-processed images will open as a interactive hyperstack (multi-channel & multi-frames image stack), on which microchannels can be selected.
- To display all segmented microchannels object use the shortcut
crtl + A - To display all microchannels tracks use the shortcut
crtl + Q. Tracks will be displayed as colored contours, each colour corresponding to one track. - Note that the shortcut are available from the menu
Help > Display Shortcut tableand that a shortcut preset adapted for QWERTY keyboards can be chosen from the menuHelp > Shortcut Presets
The configuration template we used do not use DiSTNet to segmente & track bacteria.
- Open the Configuration Library from the menu
Import > Online Configuration Library - Set
jeanollionasusernameif necessary - Select the
StepnamedProcessing - Select the following configuration
ExampleDatasets > dataset1_distnet [Bacteria]in theRemote Configuration Filepanel - In the
Local object classpanel, selectBacteria
The configuration associated to the Bacteria object class of the open dataset will be displayed in the Local Configuration panel, and the configuration loacted on the server in Remote Configuration panel, with differences displayed in blue.
Click on the Copy to Local button to copy the remote configuration (containing DiSTNet) to the open dataset.

As DiSTNet is a deep-learning based method, it requires trained weights of the model. To download them:
- Go to the
Configuration Testtab - In the
Steppannel selectProcessing - Select the
Bacteriaobject class : it's configuration will be displayed below - Unfold the parameters
Tracker>Model > Tensorflow Model. The sub-parameterModel Fileappears in red if the model weights are not there. However it is possible to download them directly from BACMMAN. - Right-click on
Tensorflow Modeland chooseDownload Model. The model weights will be downloaded at the path selected in theModel Fileparameter, that should not appear in red anymore after the download.

- Set the
Frame Rangeto0-49 - Right-click on the parameter named
Trackerand chooseTest Segmentation and Tracking
Several interactive kymograph will be displayed, corresponding to the input image and intermediate images. Bacteria objects and Tracks can be displayed on those kymograph using the shortcuts.

Refer to the hint of the DiSTNet module to parametrize it using the intermediate kymographs.