StarDist

Wavelet thresholding detector
class byotrack.implementation.detector.stardist.StarDistDetector(model: StarDist2D, **kwargs)

Bases: BatchDetector

Runs stardist as a detector.

Wraps the official implementation at https://github.com/stardist/stardist, following the paper: Uwe Schmidt, Martin Weigert, Coleman Broaddus, and Gene Myers. Cell Detection with Star-convex Polygons. International Conference on Medical Image Computing and Computer-Assisted Intervention (MICCAI), Granada, Spain, September 2018.

We do not provide any code to train the stardist model. You can only use a trained or pretrained model.

Note

This module requires stardist lib to be installed (with tensorflow). Please follow the instruction of the official implementation to install it.

model

Underlying StarDist model

Type:

StarDist2D

prob_threshold

Threshold on probability

Type:

float

nms_threshold

Threshold for Non Maximum Suppression

Type:

float

detect(batch: ndarray) List[Detections]

Apply the detection on a batch of frames

By default, the frame ids are set from 0 to n-1 with n the size of the batch. The aggregattion of batches and frame ids correction is automatically handled when called the run method.

Parameters:

batch (np.ndarray) – Batch of video frames Shape: (B, H, W, C)

Returns:

Detections for each given frame

Return type:

Sequence[byotrack.Detections]

static from_pretrained(name: str, **kwargs) StarDistDetector

Load a pretrained StarDist from the paper

Parameters:
  • name (str) – A valid identifier (From the official github)

  • **kwargs – Additional detector arguments. (See byotrack.BatchDetector)

Returns:

StarDistDetector

static from_trained(train_dir: str | PathLike, **kwargs) StarDistDetector

Load a trained StarDist from a local folder

Parameters:
  • train_dir (str | os.PathLike) – The training folder of the model

  • **kwargs – Additional detector arguments. (See byotrack.BatchDetector)

Returns:

StarDistDetector