stouputils.data_science.models.keras.resnet module#

ResNet models implementation.

This module provides wrapper classes for the ResNet family of models from the Keras applications. It includes both ResNetV2 models with pre-activation residual blocks and ResNetRS (ResNet with Revisited Scaling) models that offer improved performance through various scaling techniques.

Available models:

  • ResNetV2 family: Improved ResNet architectures with pre-activation blocks
    • ResNet50V2

    • ResNet101V2

    • ResNet152V2

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

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

Bases: BaseKeras

ResNet50V2 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 ResNet50V2 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:

ResNet50V2

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

Bases: BaseKeras

ResNet101V2 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 ResNet101V2 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:

ResNet101V2

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

Bases: BaseKeras

ResNet152V2 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 ResNet152V2 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:

ResNet152V2

model#

alias of ResNet152V2