stouputils.data_science.models.keras.mobilenet module#

MobileNet models implementation.

This module provides wrapper classes for the MobileNet family of models from the Keras applications. MobileNet models are designed for mobile and embedded vision applications, offering efficient architectures that deliver high accuracy with low computational requirements.

Available models:

  • MobileNet: Original MobileNet architecture using depthwise separable convolutions

  • MobileNetV2: Lightweight architecture using inverted residuals and linear bottlenecks

  • MobileNetV3Small: Compact variant of MobileNetV3 optimized for mobile devices

  • MobileNetV3Large: Larger variant of MobileNetV3 with higher capacity

All models support transfer learning from ImageNet pre-trained weights.

class MobileNet(num_classes: int, kfold: int = 0, transfer_learning: str = 'imagenet', **override_params: Any)[source]#

Bases: BaseKeras

MobileNet implementation using advanced model class with common functionality. For information, refer to the ModelInterface class.

class_routine(kfold: int = 0, transfer_learning: str = 'imagenet', verbose: int = 0, **override_params: Any) ModelInterface#

Run the full routine for MobileNet model.

Parameters:
  • dataset (Dataset) – Dataset to use for training and evaluation.

  • kfold (int) – K-fold cross validation index.

  • transfer_learning (str) – Pre-trained weights to use, can be “imagenet” or a dataset path like ‘data/pizza_not_pizza’.

  • verbose (int) – Verbosity level.

  • **kwargs (Any) – Additional arguments.

Returns:

Trained model instance.

Return type:

MobileNet

class MobileNetV2(num_classes: int, kfold: int = 0, transfer_learning: str = 'imagenet', **override_params: Any)[source]#

Bases: BaseKeras

MobileNetV2 implementation using advanced model class with common functionality. For information, refer to the ModelInterface class.

class_routine(kfold: int = 0, transfer_learning: str = 'imagenet', verbose: int = 0, **override_params: Any) ModelInterface#

Run the full routine for MobileNetV2 model.

Parameters:
  • dataset (Dataset) – Dataset to use for training and evaluation.

  • kfold (int) – K-fold cross validation index.

  • transfer_learning (str) – Pre-trained weights to use, can be “imagenet” or a dataset path like ‘data/pizza_not_pizza’.

  • verbose (int) – Verbosity level.

  • **kwargs (Any) – Additional arguments.

Returns:

Trained model instance.

Return type:

MobileNetV2

class MobileNetV3Small(num_classes: int, kfold: int = 0, transfer_learning: str = 'imagenet', **override_params: Any)[source]#

Bases: BaseKeras

MobileNetV3Small implementation using advanced model class with common functionality. For information, refer to the ModelInterface class.

class_routine(kfold: int = 0, transfer_learning: str = 'imagenet', verbose: int = 0, **override_params: Any) ModelInterface#

Run the full routine for MobileNetV3Small model.

Parameters:
  • dataset (Dataset) – Dataset to use for training and evaluation.

  • kfold (int) – K-fold cross validation index.

  • transfer_learning (str) – Pre-trained weights to use, can be “imagenet” or a dataset path like ‘data/pizza_not_pizza’.

  • verbose (int) – Verbosity level.

  • **kwargs (Any) – Additional arguments.

Returns:

Trained model instance.

Return type:

MobileNetV3Small

class MobileNetV3Large(num_classes: int, kfold: int = 0, transfer_learning: str = 'imagenet', **override_params: Any)[source]#

Bases: BaseKeras

MobileNetV3Large implementation using advanced model class with common functionality. For information, refer to the ModelInterface class.

class_routine(kfold: int = 0, transfer_learning: str = 'imagenet', verbose: int = 0, **override_params: Any) ModelInterface#

Run the full routine for MobileNetV3Large model.

Parameters:
  • dataset (Dataset) – Dataset to use for training and evaluation.

  • kfold (int) – K-fold cross validation index.

  • transfer_learning (str) – Pre-trained weights to use, can be “imagenet” or a dataset path like ‘data/pizza_not_pizza’.

  • verbose (int) – Verbosity level.

  • **kwargs (Any) – Additional arguments.

Returns:

Trained model instance.

Return type:

MobileNetV3Large

model#

alias of MobileNetV3Large