clinicadl.networks.nn.ResNet18¶
- class clinicadl.networks.nn.ResNet18(num_outputs: int | None, output_act: ActFunction | tuple[ActFunction, dict[str, Any]] | None = None, pretrained: bool = False) None[source]¶
ResNet-18, from Deep Residual Learning for Image Recognition.
Only the last fully connected layer will be changed to match
num_outputs.The user can use the pretrained models from
torchvision. Note that the last fully connected layer will not use pretrained weights, as it is task specific.Warning
Only works with 2D images with 3 channels.
- Parameters:
num_outputs (Optional[int]) – Number of output variables after the last linear layer. If
None, the feature map before the last fully connected layer will be returned.output_act (Optional[ActivationParameters], default=None) –
A potential activation layer applied to the output of the network, and optionally its arguments. Must be passed as
activation_nameor(activation_name, arguments), whereargumentsis a dictionary. IfNone, no activation will be used.activation_namecan be any value in {"celu","elu","gelu","leakyrelu","logsoftmax","mish","prelu","relu","relu6","selu","sigmoid","softmax","tanh"}. Please refer to PyTorch activation functions to know the arguments for each of them.pretrained (bool, default=False) – Whether to use pretrained weights. The pretrained weights used are the default ones from
torchvision.models.resnet18().