Vision data
Prediction to mask
pred_to_multiclass_mask
pred_to_multiclass_mask (pred:torch.Tensor)
*Apply Softmax on the predicted tensor to rescale the values in the range [0, 1] and sum to 1. Then apply argmax to get the indices of the maximum value of all elements in the predicted Tensor.
Args: pred: [C,W,H,D] activation tensor.
Returns: Predicted mask.*
batch_pred_to_multiclass_mask
batch_pred_to_multiclass_mask (pred:torch.Tensor)
*Convert a batch of predicted activation tensors to masks.
Args: pred: [B, C, W, H, D] batch of activations.
Returns: Tuple of batch of predicted masks and number of classes.*
pred_to_binary_mask
pred_to_binary_mask (pred:torch.Tensor)
*Apply Sigmoid function that squishes activations into a range between 0 and 1. Then we classify all values greater than or equal to 0.5 to 1, and the values below 0.5 to 0.
Args: pred: [B, C, W, H, D] or [C, W, H, D] activation tensor
Returns: Predicted binary mask(s).*
MedDataBlock
MedDataBlock (blocks:list=None, dl_type:fastai.data.core.TfmdDL=None, getters:list=None, n_inp:int=None, item_tfms:list=None, batch_tfms:list=None, reorder:bool=False, resample:(<class'int'>,<class'list'>)=None, **kwargs)
Container to quickly build dataloaders.
TransformBlock
for segmentation
MedMaskBlock
MedMaskBlock ()
Create a TransformBlock for medical masks.
MedImageDataLoaders
MedImageDataLoaders (*loaders, path:str|pathlib.Path='.', device=None)
Higher-level MedDataBlock
API.