Skip to content

lacss.modules

lacss.modules.Lacss

Bases: Module, DefaultUnpicklerMixin

Main class for LACSS model

Attributes:

Name Type Description
backbone Module

CNN backbone

detector Module

detection head to predict cell locations

segmentor Module | None

The segmentation head

__call__(image, *, image_mask=None, video_refs=None)

Parameters:

Name Type Description Default
image ArrayLike

[H, W, C] or [D, H, W, C]

required

Returns: a dict of model outputs

lacss.modules.LPN

Bases: Module, DefaultUnpicklerMixin

Location detection head

Attributes:

Name Type Description
nms_threshold float

non-max-supression threshold, if performing nms on detected locations.

pre_nms_topk int

max number of detections to be processed regardless of nms, ignored if negative

max_output int

number of detection outputs

lacss.modules.Segmentor

Bases: Module, DefaultUnpicklerMixin

LACSS segmentation head.

Attributes:

Name Type Description
n_cls

num of classes

feature_scale int

the spatail scale of the feature level

instance_crop_size int

Crop size for segmentation.

pos_emb_shape Sequence[int]

Dim of the learned position encoder.

__call__(feature, locations)

Parameters:

Name Type Description Default
features

[H, W, C] features from the backbone.

required
locations ArrayLike

[N, 2]

required

Returns:

Type Description
dict

A nested dictionary of values representing segmentation outputs. * segmentor/logits: all segment logits * predictions/segmentations: logits of designated class [N, D, ps, ps] * predictions/segmentation_y0_coord: y coord of patch top-left corner [N] * predictions/segmentation_x0_coord: x coord of patch top-left corner [N] * predictions/segmentation_is_valid: mask for valid patches [N]