StarDist
- class byotrack.implementation.detector.stardist.StarDistDetector(model: StarDist2D | StarDist3D, **kwargs: Any)
Bases:
BatchDetectorRuns 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. We currently only wraps the 2D model of stardist.
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
- 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, [D, ]H, W, C)
- Returns:
Detections for each given frame
- Return type:
Sequence[byotrack.Detections]
- static from_pretrained(name: str, dim=2, **kwargs: Any) StarDistDetector
Load a pretrained StarDist from the paper.
- static from_trained(train_dir: str | os.PathLike, dim=2, **kwargs: Any) StarDistDetector
Load a trained StarDist from a local folder.
- Parameters:
train_dir (str | os.PathLike) – The training folder of the model
dim (int) – Image dimension (2d or 3d). Will load the model using the correct StarDist class. Default: 2 (Use StarDist2D)
**kwargs – Additional detector arguments. (See byotrack.BatchDetector)
- Returns:
StarDistDetector