Skip to content

Commit

Permalink
Adding new/updated io.github.betaseg_stardist_train_0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Scaramir committed Dec 28, 2023
1 parent 33afdd5 commit cde05d0
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 18 deletions.
Binary file modified album_catalog_index.db
Binary file not shown.
2 changes: 1 addition & 1 deletion solutions/io.github.betaseg/stardist_train/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.0] - 2023-06-28
## [0.1.0] - 2023-12-28

89 changes: 73 additions & 16 deletions solutions/io.github.betaseg/stardist_train/README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,94 @@
# StarDist train album solution
# StarDist Model Training Solution for Album

This album solution can be used to train a StarDist model from the command line.
## Introduction
This is an album solution designed to train a StarDist model directly from the command line. The primary goal of this solution is to facilitate the training of models to segment structures using the StarDist approach.

## documentation
Please refer to the detailed documentation of [StarDist](https://github.com/stardist/stardist) for in-depth understanding and guidelines.

The extensive documentation of StarDist can be found at https://github.com/stardist/stardist.
<details>
<summary><h2>Example: Training a 3D StarDist Model for Secretory Granules Segmentation</h2></summary>

## Example: 3D segmentation of secretory granules with 3D stardist
![Sample Image of Secretory Granules](granules.png)

![](granules.png)

This demonstrates how to use this solution to train a Stardist model to segment secretory granules from 3D FIB-SEM data.
The procedure is described in the paper:
The purpose of this example is to guide users on training a StarDist model to segment secretory granules from 3D FIB-SEM data. The training procedure and its significance are elaborated in the paper:

Müller, Andreas, et al. "3D FIB-SEM reconstruction of microtubule–organelle interaction in whole primary mouse β cells." Journal of Cell Biology 220.2 (2021).

Download the example data (or adapt your own data into the same format)

### Dataset Preparation
Download the sample data (or you can prepare your own data in a similar format).
```bash
wget https://syncandshare.desy.de/index.php/s/5SJFRtAckjBg5gx/download/data_granules.zip
unzip data_granules.zip
which should result in the following folder structure:
```

After extracting, your data should be structured as follows:

```bash
data_granules
├── train
│ ├── images
│ └── masks
└── val
├── images
└── masks
```
</details>

## Installation
Make sure album is already installed. If not, download and install it as described [here](https://album.solutions/).
Also, don't forget to add the catalog to your album installation, so you can install the solutions from the catalog.

Install the `stardist_train` and `stardist_predict` solution by using the graphical user interface (GUI) of album or by running the following command in the terminal:
```bash
album install io.github.betaseg:stardist_train:0.1.0
album install io.github.betaseg:stardist_predict:0.1.0
```

## How to use
<details open>
<summary><h2>Training</h2></summary>
To start the training process, provide the root directory of the data (using the "root" argument) and the desired output directory (using the "out" argument). By default, the solution will train a 3D stardist model for 100 epochs.

The parameters can be set and run using either the GUI, or by adapting this example for command line usage:
```bash
album run stardist_train --root /data/stardist_train/data_granules --out /data/stardist_train/data_granules_out --epochs 10 --steps_per_epoch 15
```

During training, a _TensorBoard_ will be opened in your browser. You can monitor the training process and the model performance using the _TensorBoard_. The solution terminates when the training is finished and _TensorBoard_ is closed.

The trained model will be saved in the specified output directory and contains the date and time of the run. The model can be used for inference using the `stardist_predict` solution.
</details>

<details>
<summary><h2>Predict</h2></summary>
For inference, provide the path to an input file (TIF) or directory containing multiple files (TIF) using the `fname_input` argument.
State the `model_name` and its corresponding directory `model_dir`.
The output directory must be specified using the `output_dir` argument.

```bash
album run stardist_predict --fname_input /data/stardist_train/data_granules/val/images/high_c1_raw_region_2.tif --model_name 2023_06_28-17_45_35_stardist --model_basedir /data/stardist_train/data_granules_out/ --output_dir /data/stardist_train/predictions
```
</details>

### Further documentation:
For further options, parameters and default values, please refer to the info page of the solution:
```bash
album info stardist_train
```

Start the solution by only providing the root folder of the data (argument named "root")
and the output folder (argument named "out") to reproduce the results of the paper.
This way the solution trains a 3D stardist model for 100 epochs.
## Hardware Requirements
Ensure that your hardware meets the specific requirements of [StarDist](https://stardist.net/docs/faq.html#what-hardware-do-you-recommend) for efficient training. For training a 3D model, we recommend to use a GPU with at least 8GB of memory.

# todo: reproducable call
## Citation & License
Stardist is licensed under the [BSD 3-Clause License](https://github.com/stardist/stardist/blob/master/LICENSE.txt).

If you use this solution, please cite the following paper:
```
title: Cell Detection with Star-Convex Polygons,
doi: 10.1007/978-3-030-00934-2_30
```
and
```
title: Star-convex Polyhedra for 3D Object Detection and Segmentation in Microscopy,
doi: 10.1109/WACV45572.2020.9093435
```
2 changes: 1 addition & 1 deletion solutions/io.github.betaseg/stardist_train/solution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,6 @@ solution_creators:
tags:
- StarDist
- machine learning
timestamp: '2023-06-28T16:56:30.305786'
timestamp: '2023-12-28T20:35:10.961171'
title: StarDist Train
version: 0.1.0

0 comments on commit cde05d0

Please sign in to comment.