ncalab.models.applications.segmentation
Submodules
Classes
Model used for image segmentation. |
Package Contents
- class ncalab.models.applications.segmentation.SegmentationNCAModel(device: torch.device, num_image_channels: int = 3, num_hidden_channels: int = 16, num_classes: int = 1, fire_rate: float = 0.8, hidden_size: int = 128, num_learned_filters: int = 2, pad_noise: bool = True, filter_padding: str = 'reflect', **kwargs)
Bases:
ncalab.models.basicNCA.BasicNCAModelModel used for image segmentation.
Uses Dice score as the default validation metric. Currently, only binary segmentation masks are supported.
- Parameters:
[torch.device] (device) – Compute device.
[int] (learned_filters) – Number of image channels. Defaults to 3.
[int] – Number of hidden channels. Defaults to 16.
[int] – Number of classes. Defaults to 1.
[float] (fire_rate) – NCA fire rate. Defaults to 0.8.
[int] – Number of neurons in hidden layer. Defaults to 128.
[int] – Number of learned filters. If 0, use sobel. Defaults to 2.
[bool] (pad_noise) – Whether to pad input images with noise. Defaults to True.
[str] (filter_padding) – Padding type to use. Might affect reliance on spatial cues. Defaults to “circular”.
- num_classes = 1
- loss(pred: ncalab.prediction.Prediction, label: torch.Tensor) Dict[str, torch.Tensor]
Compute Dice + BCE loss.
- Parameters:
pred – Prediction.
label – Ground truth.
- Returns:
Dictionary of identifiers mapped to computed losses.
- metrics(pred: ncalab.prediction.Prediction, label: torch.Tensor) Dict[str, float]
Return dict of standard evaluation metrics.
- Parameters:
[torch.Tensor] (label) – Predicted image.
[torch.Tensor] – Ground truth label.