-
Notifications
You must be signed in to change notification settings - Fork 0
FineTune DistNet
EDIT 07/2024: DiSTNet is now deprecated. Please use DiSTNet2D, that performs much better event for mother machine data.
DistNet is described in this publication. In order to segment and track bacteria whose aspect differ substantially from the bacteria DistNet was trained on, a training is necessary to get optimal performances. It is either possible to train DistNet from scratch or to fine-tune it. The second option requires a smaller dataset than the first one. In this tutorial we will show how to extract a dataset for training with BACMMAN, and to fine-tune DistNet using google drive and google colab (that provides a free GPU).
BACMMAN allows to extract large datasets to single compressed .h5 files, that are very handy to use with cloud computing solutions such as google colab. In a future version .n5 files will also be supported.
The first step is to generate a selection of microchannel that contains bacteria that are already segmented and tracked. More generally, it should be a selection of the parent of the object class to be processed. To segment and track bacteria, one can use a pre-trained version of DistNet or the algorithm of BACMMAN, and correct manually the errors. We advise to generate two microchannel selections: one for training and one for validation (containing 4 times less microchannels)
There are several ways to generate microchannel selections, described in this page
In the Home tab, right click on the Tasks to execute
pannel and choose Add new dataset extraction task to list

The dataset extraction window will open; in the right pannel, select the training (and the validation) selection(s).
In the left panel, right click on Output file and choose a file to extract data to. It can be either a .h5 file that already contains data, or to create a new file, simply type its name, followed by .h5 extension. Unfold Features>Feature #0
, and choose RawImage
as Feature
and selected the bacteria object class. Right-click on Feature #0
and choose duplicate two times. In Feature #1
choose Labels
as feature and Feature #2
choose PreviousLabels
.

Right-click in the Tasks to execute
panel and choose Run All Tasks
Dataset structure will be:
.
├── ...
├── dataset1 *train dataset name*
│ ├── train *training selection name*
│ │ ├── raw *feature name (raw images)*
│ │ └── regionLabels *feature name (labels)*
│ │ └── prevRegionLabels *feature name (labels of previous cell)*
│ ├── test *validation selection name*
│ │ ├── raw *feature name (raw images)*
│ │ └── regionLabels *feature name (labels)*
│ │ └── prevRegionLabels *feature name (labels of previous cell)*
└── ...
Upload the dataset file to a google drive.
Open this notebook In Colab:
Create a local copy by choosing
Copy Notebook
from the File
menu.
Follow the instructions on the notebook to perform fine-tuning.
Download the model, unzip it and replace the previous version. See this page for prediction with DistNet in BACMMAN.