pyrovision.models#

The models subpackage contains definitions of models for addressing different tasks, including: image classification, object detection, and semantic segmentation.

RexNet#

pyrovision.models.rexnet1_0x(pretrained: bool = False, progress: bool = True, **kwargs: Any) ReXNet[source]#

ReXNet-1.0x from “ReXNet: Diminishing Representational Bottleneck on Convolutional Neural Network”.

Parameters:
  • pretrained (bool) – If True, returns a model pre-trained on ImageNet

  • progress (bool) – If True, displays a progress bar of the download to stderr

Returns:

classification model

Return type:

torch.nn.Module

pyrovision.models.rexnet1_3x(pretrained: bool = False, progress: bool = True, **kwargs: Any) ReXNet[source]#

ReXNet-1.3x from “ReXNet: Diminishing Representational Bottleneck on Convolutional Neural Network”.

Parameters:
  • pretrained (bool) – If True, returns a model pre-trained on ImageNet

  • progress (bool) – If True, displays a progress bar of the download to stderr

Returns:

classification model

Return type:

torch.nn.Module

pyrovision.models.rexnet1_5x(pretrained: bool = False, progress: bool = True, **kwargs: Any) ReXNet[source]#

ReXNet-1.5x from “ReXNet: Diminishing Representational Bottleneck on Convolutional Neural Network”.

Parameters:
  • pretrained (bool) – If True, returns a model pre-trained on ImageNet

  • progress (bool) – If True, displays a progress bar of the download to stderr

Returns:

classification model

Return type:

torch.nn.Module

ResNet#

pyrovision.models.resnet18(pretrained: bool = False, progress: bool = True, **kwargs: Any) ResNet[source]#

ResNet-18 from “Deep Residual Learning for Image Recognition”.

Parameters:
  • pretrained (bool) – If True, returns a model pre-trained on ImageNet

  • progress (bool) – If True, displays a progress bar of the download to stderr

Returns:

classification model

Return type:

torch.nn.Module

pyrovision.models.resnet34(pretrained: bool = False, progress: bool = True, **kwargs: Any) ResNet[source]#

ResNet-34 from “Deep Residual Learning for Image Recognition”.

Parameters:
  • pretrained (bool) – If True, returns a model pre-trained on ImageNet

  • progress (bool) – If True, displays a progress bar of the download to stderr

Returns:

classification model

Return type:

torch.nn.Module

MobileNet v3#

pyrovision.models.mobilenet_v3_small(pretrained: bool = False, progress: bool = True, **kwargs: Any) MobileNetV3[source]#

MobileNetV3 model from “Searching for MobileNetV”.

Parameters:
  • pretrained (bool) – If True, returns a model pre-trained on ImageNet

  • progress (bool) – If True, displays a progress bar of the download to stderr

Returns:

classification model

Return type:

torch.nn.Module

pyrovision.models.mobilenet_v3_large(pretrained: bool = False, progress: bool = True, **kwargs: Any) MobileNetV3[source]#

MobileNetV3 model from “Searching for MobileNetV”.

Parameters:
  • pretrained (bool) – If True, returns a model pre-trained on ImageNet

  • progress (bool) – If True, displays a progress bar of the download to stderr

Returns:

classification model

Return type:

torch.nn.Module

Utils#

pyrovision.models.utils.model_from_hf_hub(repo_id: str, **kwargs: Any) Module[source]#

Instantiate & load a pretrained model from HF hub.

Parameters:
  • repo_id – HuggingFace model hub repo

  • kwargs – kwargs of hf_hub_download

Returns:

Model loaded with the checkpoint