cyto_dl.nn.head.res_blocks_head module#
- class cyto_dl.nn.head.res_blocks_head.ResBlocksHead(loss, in_channels: int, out_channels: int, final_act: ~typing.Callable = Identity(), postprocess={'input': <function detach>, 'prediction': <function detach>}, resolution='lr', spatial_dims=3, n_convs=1, dropout=0.0, upsample_method='pixelshuffle', upsample_ratio=None, first_layer=Identity(), dense: bool = False)[source]#
Bases:
BaseHead
Task head for doing task-specific convolution and optional upsampling.
- Parameters:
in_channels (int) – Number of input channels (same as number of output channels from backbone)
out_channels (int) – Number of output channels
final_act (Callable=torch.nn.Identity()) – Final activation applied to logits
postprocess={“input” (detach, “prediction”: detach}) – Postprocessing functions for ground truth and model predictions
resolution=”lr” – Resolution of output image. If lr, no upsampling is done. If hr, upsample_method and upsample_ratio are used to determine how to perform upsampling.
spatial_dims=3 – Spatial dimension of data after first_layer
n_convs=1 – Number of convolutional layers
dropout=0.0 – Dropout ratio
upsample_method=”pixelshuffle” – Method of upsampling. See the [monai upsampling docs](https://docs.monai.io/en/stable/networks.html#monai.networks.blocks.Upsample) for options
upsample_ratio=None – Amount to upsample. If not None, should be array of length spatial_dims
first_layer=torch.nn.Identity() – Initial layer to apply to backbone outputs. For example, ConvProjectionLayer for transforming 3D->2D output.
dense=False – Whether to use dense connections between convolutional layers