health_multimodal.image.model.resnet
Functions
|
ResNet-18 model from “Deep Residual Learning for Image Recognition”. |
|
ResNet-50 model from “Deep Residual Learning for Image Recognition”. |
Classes
|
Wrapper class of the original torchvision ResNet model. |
- class health_multimodal.image.model.resnet.ResNetHIML(**kwargs)[source]
Wrapper class of the original torchvision ResNet model.
The forward function is updated to return the penultimate layer activations, which are required to obtain image patch embeddings.
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- forward(x, return_intermediate_layers=False)[source]
ResNetHIML forward pass. Optionally returns intermediate layers using the
return_intermediate_layers
argument.- Parameters
return_intermediate_layers (
bool
) – IfTrue
, return layers x0-x4 as a tuple, otherwise return x4 only.- Return type
Union
[Tensor
,Tuple
[Tensor
,Tensor
,Tensor
,Tensor
,Tensor
]]
- health_multimodal.image.model.resnet.resnet18(pretrained=False, progress=True, **kwargs)[source]
ResNet-18 model from “Deep Residual Learning for Image Recognition”.
- Parameters
pretrained (
bool
) – IfTrue
, returns a model pre-trained on ImageNet.progress (
bool
) – IfTrue
, displays a progress bar of the download tostderr
.
- Return type
- health_multimodal.image.model.resnet.resnet50(pretrained=False, progress=True, **kwargs)[source]
ResNet-50 model from “Deep Residual Learning for Image Recognition”.
- Parameters
pretrained (
bool
) – IfTrue
, returns a model pre-trained on ImageNetprogress (
bool
) – IfTrue
, displays a progress bar of the download tostderr
.
- Return type