SemanticSegmentation¶
- class flash.image.segmentation.model.SemanticSegmentation(num_classes, backbone='resnet50', backbone_kwargs=None, head='fpn', head_kwargs=None, pretrained=True, loss_fn=None, optimizer='Adam', lr_scheduler=None, metrics=None, learning_rate=None, multi_label=False, output_transform=None)[source]¶
SemanticSegmentation
is aTask
for semantic segmentation of images. For more details, see Semantic Segmentation.- Parameters
backbone¶ (
Union
[str
,Module
]) – A string or model to use to compute image features.backbone_kwargs¶ (
Optional
[Dict
]) – Additional arguments for the backbone configuration.head¶ (
str
) – A string or (model, num_features) tuple to use to compute image features.head_kwargs¶ (
Optional
[Dict
]) – Additional arguments for the head configuration.loss_fn¶ (
Optional
[TypeVar
(LOSS_FN_TYPE
,Callable
,Mapping
,Sequence
,None
)]) – Loss function for training.optimizer¶ (
TypeVar
(OPTIMIZER_TYPE
,str
,Callable
,Tuple
[str
,Dict
[str
,Any
]],None
)) – Optimizer to use for training.lr_scheduler¶ (
Optional
[TypeVar
(LR_SCHEDULER_TYPE
,str
,Callable
,Tuple
[str
,Dict
[str
,Any
]],Tuple
[str
,Dict
[str
,Any
],Dict
[str
,Any
]],None
)]) – The LR scheduler to use during training.metrics¶ (
Optional
[TypeVar
(METRICS_TYPE
,Metric
,Mapping
,Sequence
,None
)]) – Metrics to compute for training and evaluation. Can either be an metric from the torchmetrics package, a custom metric inherenting from torchmetrics.Metric, a callable function or a list/dict containing a combination of the aforementioned. In all cases, each metric needs to have the signature metric(preds,target) and return a single scalar tensor. Defaults totorchmetrics.IOU
.learning_rate¶ (
Optional
[float
]) – Learning rate to use for training. IfNone
(the default) then the default LR for your chosen optimizer will be used.multi_label¶ (
bool
) – Whether the targets are multi-label or not.output¶ – The
Output
to use when formatting prediction outputs.output_transform¶ (
Optional
[TypeVar
(OUTPUT_TRANSFORM_TYPE
, flash.core.data.io.output_transform.OutputTransform,None
)]) –OutputTransform
use for post processing samples.
- classmethod available_finetuning_strategies(cls)¶
Returns a list containing the keys of the available Finetuning Strategies.
- classmethod available_lr_schedulers(cls)¶
Returns a list containing the keys of the available LR schedulers.