stouputils 1.14.0__py3-none-any.whl → 1.14.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- stouputils/__init__.pyi +15 -0
- stouputils/_deprecated.pyi +12 -0
- stouputils/all_doctests.pyi +46 -0
- stouputils/applications/__init__.pyi +2 -0
- stouputils/applications/automatic_docs.py +3 -0
- stouputils/applications/automatic_docs.pyi +106 -0
- stouputils/applications/upscaler/__init__.pyi +3 -0
- stouputils/applications/upscaler/config.pyi +18 -0
- stouputils/applications/upscaler/image.pyi +109 -0
- stouputils/applications/upscaler/video.pyi +60 -0
- stouputils/archive.pyi +67 -0
- stouputils/backup.pyi +109 -0
- stouputils/collections.pyi +86 -0
- stouputils/continuous_delivery/__init__.pyi +5 -0
- stouputils/continuous_delivery/cd_utils.pyi +129 -0
- stouputils/continuous_delivery/github.pyi +162 -0
- stouputils/continuous_delivery/pypi.pyi +52 -0
- stouputils/continuous_delivery/pyproject.pyi +67 -0
- stouputils/continuous_delivery/stubs.pyi +39 -0
- stouputils/ctx.pyi +211 -0
- stouputils/data_science/config/get.py +51 -51
- stouputils/data_science/data_processing/image/__init__.py +66 -66
- stouputils/data_science/data_processing/image/auto_contrast.py +79 -79
- stouputils/data_science/data_processing/image/axis_flip.py +58 -58
- stouputils/data_science/data_processing/image/bias_field_correction.py +74 -74
- stouputils/data_science/data_processing/image/binary_threshold.py +73 -73
- stouputils/data_science/data_processing/image/blur.py +59 -59
- stouputils/data_science/data_processing/image/brightness.py +54 -54
- stouputils/data_science/data_processing/image/canny.py +110 -110
- stouputils/data_science/data_processing/image/clahe.py +92 -92
- stouputils/data_science/data_processing/image/common.py +30 -30
- stouputils/data_science/data_processing/image/contrast.py +53 -53
- stouputils/data_science/data_processing/image/curvature_flow_filter.py +74 -74
- stouputils/data_science/data_processing/image/denoise.py +378 -378
- stouputils/data_science/data_processing/image/histogram_equalization.py +123 -123
- stouputils/data_science/data_processing/image/invert.py +64 -64
- stouputils/data_science/data_processing/image/laplacian.py +60 -60
- stouputils/data_science/data_processing/image/median_blur.py +52 -52
- stouputils/data_science/data_processing/image/noise.py +59 -59
- stouputils/data_science/data_processing/image/normalize.py +65 -65
- stouputils/data_science/data_processing/image/random_erase.py +66 -66
- stouputils/data_science/data_processing/image/resize.py +69 -69
- stouputils/data_science/data_processing/image/rotation.py +80 -80
- stouputils/data_science/data_processing/image/salt_pepper.py +68 -68
- stouputils/data_science/data_processing/image/sharpening.py +55 -55
- stouputils/data_science/data_processing/image/shearing.py +64 -64
- stouputils/data_science/data_processing/image/threshold.py +64 -64
- stouputils/data_science/data_processing/image/translation.py +71 -71
- stouputils/data_science/data_processing/image/zoom.py +83 -83
- stouputils/data_science/data_processing/image_augmentation.py +118 -118
- stouputils/data_science/data_processing/image_preprocess.py +183 -183
- stouputils/data_science/data_processing/prosthesis_detection.py +359 -359
- stouputils/data_science/data_processing/technique.py +481 -481
- stouputils/data_science/dataset/__init__.py +45 -45
- stouputils/data_science/dataset/dataset.py +292 -292
- stouputils/data_science/dataset/dataset_loader.py +135 -135
- stouputils/data_science/dataset/grouping_strategy.py +296 -296
- stouputils/data_science/dataset/image_loader.py +100 -100
- stouputils/data_science/dataset/xy_tuple.py +696 -696
- stouputils/data_science/metric_dictionnary.py +106 -106
- stouputils/data_science/mlflow_utils.py +206 -206
- stouputils/data_science/models/abstract_model.py +149 -149
- stouputils/data_science/models/all.py +85 -85
- stouputils/data_science/models/keras/all.py +38 -38
- stouputils/data_science/models/keras/convnext.py +62 -62
- stouputils/data_science/models/keras/densenet.py +50 -50
- stouputils/data_science/models/keras/efficientnet.py +60 -60
- stouputils/data_science/models/keras/mobilenet.py +56 -56
- stouputils/data_science/models/keras/resnet.py +52 -52
- stouputils/data_science/models/keras/squeezenet.py +233 -233
- stouputils/data_science/models/keras/vgg.py +42 -42
- stouputils/data_science/models/keras/xception.py +38 -38
- stouputils/data_science/models/keras_utils/callbacks/__init__.py +20 -20
- stouputils/data_science/models/keras_utils/callbacks/colored_progress_bar.py +219 -219
- stouputils/data_science/models/keras_utils/callbacks/learning_rate_finder.py +148 -148
- stouputils/data_science/models/keras_utils/callbacks/model_checkpoint_v2.py +31 -31
- stouputils/data_science/models/keras_utils/callbacks/progressive_unfreezing.py +249 -249
- stouputils/data_science/models/keras_utils/callbacks/warmup_scheduler.py +66 -66
- stouputils/data_science/models/keras_utils/losses/__init__.py +12 -12
- stouputils/data_science/models/keras_utils/losses/next_generation_loss.py +56 -56
- stouputils/data_science/models/keras_utils/visualizations.py +416 -416
- stouputils/data_science/models/sandbox.py +116 -116
- stouputils/data_science/range_tuple.py +234 -234
- stouputils/data_science/utils.py +285 -285
- stouputils/decorators.pyi +242 -0
- stouputils/image.pyi +172 -0
- stouputils/installer/__init__.py +18 -18
- stouputils/installer/__init__.pyi +5 -0
- stouputils/installer/common.pyi +39 -0
- stouputils/installer/downloader.pyi +24 -0
- stouputils/installer/linux.py +144 -144
- stouputils/installer/linux.pyi +39 -0
- stouputils/installer/main.py +223 -223
- stouputils/installer/main.pyi +57 -0
- stouputils/installer/windows.py +136 -136
- stouputils/installer/windows.pyi +31 -0
- stouputils/io.pyi +213 -0
- stouputils/parallel.py +13 -10
- stouputils/parallel.pyi +211 -0
- stouputils/print.pyi +136 -0
- stouputils/py.typed +1 -1
- stouputils/stouputils/parallel.pyi +4 -4
- stouputils/version_pkg.pyi +15 -0
- {stouputils-1.14.0.dist-info → stouputils-1.14.1.dist-info}/METADATA +1 -1
- stouputils-1.14.1.dist-info/RECORD +171 -0
- stouputils-1.14.0.dist-info/RECORD +0 -140
- {stouputils-1.14.0.dist-info → stouputils-1.14.1.dist-info}/WHEEL +0 -0
- {stouputils-1.14.0.dist-info → stouputils-1.14.1.dist-info}/entry_points.txt +0 -0
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
""" DenseNet models implementation.
|
|
2
|
-
|
|
3
|
-
This module provides wrapper classes for the DenseNet family of models from the Keras applications.
|
|
4
|
-
DenseNet models utilize dense connections between layers, where each layer obtains additional inputs
|
|
5
|
-
from all preceding layers and passes on its feature-maps to all subsequent layers.
|
|
6
|
-
|
|
7
|
-
Available models:
|
|
8
|
-
|
|
9
|
-
- DenseNet121: Smallest variant with 121 layers
|
|
10
|
-
- DenseNet169: Medium-sized variant with 169 layers
|
|
11
|
-
- DenseNet201: Largest variant with 201 layers
|
|
12
|
-
|
|
13
|
-
All models support transfer learning from ImageNet pre-trained weights.
|
|
14
|
-
"""
|
|
15
|
-
# pyright: reportUnknownVariableType=false
|
|
16
|
-
# pyright: reportMissingTypeStubs=false
|
|
17
|
-
|
|
18
|
-
# Imports
|
|
19
|
-
from __future__ import annotations
|
|
20
|
-
|
|
21
|
-
from keras.models import Model
|
|
22
|
-
from keras.src.applications.densenet import DenseNet121 as DenseNet121_keras
|
|
23
|
-
from keras.src.applications.densenet import DenseNet169 as DenseNet169_keras
|
|
24
|
-
from keras.src.applications.densenet import DenseNet201 as DenseNet201_keras
|
|
25
|
-
|
|
26
|
-
from ....decorators import simple_cache
|
|
27
|
-
from ..base_keras import BaseKeras
|
|
28
|
-
from ..model_interface import CLASS_ROUTINE_DOCSTRING, MODEL_DOCSTRING
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
# Classes
|
|
32
|
-
class DenseNet121(BaseKeras):
|
|
33
|
-
def _get_base_model(self) -> Model:
|
|
34
|
-
return DenseNet121_keras(include_top=False, classes=self.num_classes)
|
|
35
|
-
|
|
36
|
-
class DenseNet169(BaseKeras):
|
|
37
|
-
def _get_base_model(self) -> Model:
|
|
38
|
-
return DenseNet169_keras(include_top=False, classes=self.num_classes)
|
|
39
|
-
|
|
40
|
-
class DenseNet201(BaseKeras):
|
|
41
|
-
def _get_base_model(self) -> Model:
|
|
42
|
-
return DenseNet201_keras(include_top=False, classes=self.num_classes)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
# Docstrings
|
|
46
|
-
for model in [DenseNet121, DenseNet169, DenseNet201]:
|
|
47
|
-
model.__doc__ = MODEL_DOCSTRING.format(model=model.__name__)
|
|
48
|
-
model.class_routine = simple_cache(model.class_routine)
|
|
49
|
-
model.class_routine.__doc__ = CLASS_ROUTINE_DOCSTRING.format(model=model.__name__)
|
|
50
|
-
|
|
1
|
+
""" DenseNet models implementation.
|
|
2
|
+
|
|
3
|
+
This module provides wrapper classes for the DenseNet family of models from the Keras applications.
|
|
4
|
+
DenseNet models utilize dense connections between layers, where each layer obtains additional inputs
|
|
5
|
+
from all preceding layers and passes on its feature-maps to all subsequent layers.
|
|
6
|
+
|
|
7
|
+
Available models:
|
|
8
|
+
|
|
9
|
+
- DenseNet121: Smallest variant with 121 layers
|
|
10
|
+
- DenseNet169: Medium-sized variant with 169 layers
|
|
11
|
+
- DenseNet201: Largest variant with 201 layers
|
|
12
|
+
|
|
13
|
+
All models support transfer learning from ImageNet pre-trained weights.
|
|
14
|
+
"""
|
|
15
|
+
# pyright: reportUnknownVariableType=false
|
|
16
|
+
# pyright: reportMissingTypeStubs=false
|
|
17
|
+
|
|
18
|
+
# Imports
|
|
19
|
+
from __future__ import annotations
|
|
20
|
+
|
|
21
|
+
from keras.models import Model
|
|
22
|
+
from keras.src.applications.densenet import DenseNet121 as DenseNet121_keras
|
|
23
|
+
from keras.src.applications.densenet import DenseNet169 as DenseNet169_keras
|
|
24
|
+
from keras.src.applications.densenet import DenseNet201 as DenseNet201_keras
|
|
25
|
+
|
|
26
|
+
from ....decorators import simple_cache
|
|
27
|
+
from ..base_keras import BaseKeras
|
|
28
|
+
from ..model_interface import CLASS_ROUTINE_DOCSTRING, MODEL_DOCSTRING
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# Classes
|
|
32
|
+
class DenseNet121(BaseKeras):
|
|
33
|
+
def _get_base_model(self) -> Model:
|
|
34
|
+
return DenseNet121_keras(include_top=False, classes=self.num_classes)
|
|
35
|
+
|
|
36
|
+
class DenseNet169(BaseKeras):
|
|
37
|
+
def _get_base_model(self) -> Model:
|
|
38
|
+
return DenseNet169_keras(include_top=False, classes=self.num_classes)
|
|
39
|
+
|
|
40
|
+
class DenseNet201(BaseKeras):
|
|
41
|
+
def _get_base_model(self) -> Model:
|
|
42
|
+
return DenseNet201_keras(include_top=False, classes=self.num_classes)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
# Docstrings
|
|
46
|
+
for model in [DenseNet121, DenseNet169, DenseNet201]:
|
|
47
|
+
model.__doc__ = MODEL_DOCSTRING.format(model=model.__name__)
|
|
48
|
+
model.class_routine = simple_cache(model.class_routine)
|
|
49
|
+
model.class_routine.__doc__ = CLASS_ROUTINE_DOCSTRING.format(model=model.__name__)
|
|
50
|
+
|
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
""" EfficientNetV2 models implementation.
|
|
2
|
-
|
|
3
|
-
This module provides wrapper classes for the EfficientNetV2 family of models from the Keras applications.
|
|
4
|
-
EfficientNetV2 models are a family of convolutional neural networks that achieve better
|
|
5
|
-
parameter efficiency and faster training speed compared to prior models.
|
|
6
|
-
|
|
7
|
-
Available models:
|
|
8
|
-
|
|
9
|
-
- EfficientNetV2M: Medium-sized variant balancing performance and computational cost
|
|
10
|
-
- EfficientNetV2L: Large variant with higher capacity for complex tasks
|
|
11
|
-
|
|
12
|
-
All models support transfer learning from ImageNet pre-trained weights.
|
|
13
|
-
"""
|
|
14
|
-
# pyright: reportUnknownVariableType=false
|
|
15
|
-
# pyright: reportMissingTypeStubs=false
|
|
16
|
-
|
|
17
|
-
# Imports
|
|
18
|
-
from __future__ import annotations
|
|
19
|
-
|
|
20
|
-
from keras.models import Model
|
|
21
|
-
from keras.src.applications.efficientnet import EfficientNetB0 as EfficientNetB0_keras
|
|
22
|
-
from keras.src.applications.efficientnet_v2 import EfficientNetV2B0 as EfficientNetV2B0_keras
|
|
23
|
-
from keras.src.applications.efficientnet_v2 import EfficientNetV2L as EfficientNetV2L_keras
|
|
24
|
-
from keras.src.applications.efficientnet_v2 import EfficientNetV2M as EfficientNetV2M_keras
|
|
25
|
-
from keras.src.applications.efficientnet_v2 import EfficientNetV2S as EfficientNetV2S_keras
|
|
26
|
-
|
|
27
|
-
from ....decorators import simple_cache
|
|
28
|
-
from ..base_keras import BaseKeras
|
|
29
|
-
from ..model_interface import CLASS_ROUTINE_DOCSTRING, MODEL_DOCSTRING
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
# Classes
|
|
33
|
-
class EfficientNetV2M(BaseKeras):
|
|
34
|
-
def _get_base_model(self) -> Model:
|
|
35
|
-
return EfficientNetV2M_keras(include_top=False, classes=self.num_classes)
|
|
36
|
-
|
|
37
|
-
class EfficientNetV2L(BaseKeras):
|
|
38
|
-
def _get_base_model(self) -> Model:
|
|
39
|
-
return EfficientNetV2L_keras(include_top=False, classes=self.num_classes)
|
|
40
|
-
|
|
41
|
-
class EfficientNetV2B0(BaseKeras):
|
|
42
|
-
def _get_base_model(self) -> Model:
|
|
43
|
-
return EfficientNetV2B0_keras(include_top=False, classes=self.num_classes)
|
|
44
|
-
|
|
45
|
-
class EfficientNetV2S(BaseKeras):
|
|
46
|
-
def _get_base_model(self) -> Model:
|
|
47
|
-
return EfficientNetV2S_keras(include_top=False, classes=self.num_classes)
|
|
48
|
-
|
|
49
|
-
# Classes for original EfficientNet models
|
|
50
|
-
class EfficientNetB0(BaseKeras):
|
|
51
|
-
def _get_base_model(self) -> Model:
|
|
52
|
-
return EfficientNetB0_keras(include_top=False, classes=self.num_classes)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
# Docstrings
|
|
56
|
-
for model in [EfficientNetV2M, EfficientNetV2L, EfficientNetV2B0, EfficientNetV2S, EfficientNetB0]:
|
|
57
|
-
model.__doc__ = MODEL_DOCSTRING.format(model=model.__name__)
|
|
58
|
-
model.class_routine = simple_cache(model.class_routine)
|
|
59
|
-
model.class_routine.__doc__ = CLASS_ROUTINE_DOCSTRING.format(model=model.__name__)
|
|
60
|
-
|
|
1
|
+
""" EfficientNetV2 models implementation.
|
|
2
|
+
|
|
3
|
+
This module provides wrapper classes for the EfficientNetV2 family of models from the Keras applications.
|
|
4
|
+
EfficientNetV2 models are a family of convolutional neural networks that achieve better
|
|
5
|
+
parameter efficiency and faster training speed compared to prior models.
|
|
6
|
+
|
|
7
|
+
Available models:
|
|
8
|
+
|
|
9
|
+
- EfficientNetV2M: Medium-sized variant balancing performance and computational cost
|
|
10
|
+
- EfficientNetV2L: Large variant with higher capacity for complex tasks
|
|
11
|
+
|
|
12
|
+
All models support transfer learning from ImageNet pre-trained weights.
|
|
13
|
+
"""
|
|
14
|
+
# pyright: reportUnknownVariableType=false
|
|
15
|
+
# pyright: reportMissingTypeStubs=false
|
|
16
|
+
|
|
17
|
+
# Imports
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
from keras.models import Model
|
|
21
|
+
from keras.src.applications.efficientnet import EfficientNetB0 as EfficientNetB0_keras
|
|
22
|
+
from keras.src.applications.efficientnet_v2 import EfficientNetV2B0 as EfficientNetV2B0_keras
|
|
23
|
+
from keras.src.applications.efficientnet_v2 import EfficientNetV2L as EfficientNetV2L_keras
|
|
24
|
+
from keras.src.applications.efficientnet_v2 import EfficientNetV2M as EfficientNetV2M_keras
|
|
25
|
+
from keras.src.applications.efficientnet_v2 import EfficientNetV2S as EfficientNetV2S_keras
|
|
26
|
+
|
|
27
|
+
from ....decorators import simple_cache
|
|
28
|
+
from ..base_keras import BaseKeras
|
|
29
|
+
from ..model_interface import CLASS_ROUTINE_DOCSTRING, MODEL_DOCSTRING
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# Classes
|
|
33
|
+
class EfficientNetV2M(BaseKeras):
|
|
34
|
+
def _get_base_model(self) -> Model:
|
|
35
|
+
return EfficientNetV2M_keras(include_top=False, classes=self.num_classes)
|
|
36
|
+
|
|
37
|
+
class EfficientNetV2L(BaseKeras):
|
|
38
|
+
def _get_base_model(self) -> Model:
|
|
39
|
+
return EfficientNetV2L_keras(include_top=False, classes=self.num_classes)
|
|
40
|
+
|
|
41
|
+
class EfficientNetV2B0(BaseKeras):
|
|
42
|
+
def _get_base_model(self) -> Model:
|
|
43
|
+
return EfficientNetV2B0_keras(include_top=False, classes=self.num_classes)
|
|
44
|
+
|
|
45
|
+
class EfficientNetV2S(BaseKeras):
|
|
46
|
+
def _get_base_model(self) -> Model:
|
|
47
|
+
return EfficientNetV2S_keras(include_top=False, classes=self.num_classes)
|
|
48
|
+
|
|
49
|
+
# Classes for original EfficientNet models
|
|
50
|
+
class EfficientNetB0(BaseKeras):
|
|
51
|
+
def _get_base_model(self) -> Model:
|
|
52
|
+
return EfficientNetB0_keras(include_top=False, classes=self.num_classes)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
# Docstrings
|
|
56
|
+
for model in [EfficientNetV2M, EfficientNetV2L, EfficientNetV2B0, EfficientNetV2S, EfficientNetB0]:
|
|
57
|
+
model.__doc__ = MODEL_DOCSTRING.format(model=model.__name__)
|
|
58
|
+
model.class_routine = simple_cache(model.class_routine)
|
|
59
|
+
model.class_routine.__doc__ = CLASS_ROUTINE_DOCSTRING.format(model=model.__name__)
|
|
60
|
+
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
""" MobileNet models implementation.
|
|
2
|
-
|
|
3
|
-
This module provides wrapper classes for the MobileNet family of models from the Keras applications.
|
|
4
|
-
MobileNet models are designed for mobile and embedded vision applications,
|
|
5
|
-
offering efficient architectures that deliver high accuracy with low computational requirements.
|
|
6
|
-
|
|
7
|
-
Available models:
|
|
8
|
-
|
|
9
|
-
- MobileNet: Original MobileNet architecture using depthwise separable convolutions
|
|
10
|
-
- MobileNetV2: Lightweight architecture using inverted residuals and linear bottlenecks
|
|
11
|
-
- MobileNetV3Small: Compact variant of MobileNetV3 optimized for mobile devices
|
|
12
|
-
- MobileNetV3Large: Larger variant of MobileNetV3 with higher capacity
|
|
13
|
-
|
|
14
|
-
All models support transfer learning from ImageNet pre-trained weights.
|
|
15
|
-
"""
|
|
16
|
-
# pyright: reportUnknownVariableType=false
|
|
17
|
-
# pyright: reportMissingTypeStubs=false
|
|
18
|
-
|
|
19
|
-
# Imports
|
|
20
|
-
from __future__ import annotations
|
|
21
|
-
|
|
22
|
-
from keras.models import Model
|
|
23
|
-
from keras.src.applications.mobilenet import MobileNet as MobileNet_keras
|
|
24
|
-
from keras.src.applications.mobilenet_v2 import MobileNetV2 as MobileNetV2_keras
|
|
25
|
-
from keras.src.applications.mobilenet_v3 import MobileNetV3Large as MobileNetV3Large_keras
|
|
26
|
-
from keras.src.applications.mobilenet_v3 import MobileNetV3Small as MobileNetV3Small_keras
|
|
27
|
-
|
|
28
|
-
from ....decorators import simple_cache
|
|
29
|
-
from ..base_keras import BaseKeras
|
|
30
|
-
from ..model_interface import CLASS_ROUTINE_DOCSTRING, MODEL_DOCSTRING
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
# Classes
|
|
34
|
-
class MobileNet(BaseKeras):
|
|
35
|
-
def _get_base_model(self) -> Model:
|
|
36
|
-
return MobileNet_keras(include_top=False, classes=self.num_classes)
|
|
37
|
-
|
|
38
|
-
class MobileNetV2(BaseKeras):
|
|
39
|
-
def _get_base_model(self) -> Model:
|
|
40
|
-
return MobileNetV2_keras(include_top=False, classes=self.num_classes)
|
|
41
|
-
|
|
42
|
-
class MobileNetV3Small(BaseKeras):
|
|
43
|
-
def _get_base_model(self) -> Model:
|
|
44
|
-
return MobileNetV3Small_keras(include_top=False, classes=self.num_classes)
|
|
45
|
-
|
|
46
|
-
class MobileNetV3Large(BaseKeras):
|
|
47
|
-
def _get_base_model(self) -> Model:
|
|
48
|
-
return MobileNetV3Large_keras(include_top=False, classes=self.num_classes)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
# Docstrings
|
|
52
|
-
for model in [MobileNet, MobileNetV2, MobileNetV3Small, MobileNetV3Large]:
|
|
53
|
-
model.__doc__ = MODEL_DOCSTRING.format(model=model.__name__)
|
|
54
|
-
model.class_routine = simple_cache(model.class_routine)
|
|
55
|
-
model.class_routine.__doc__ = CLASS_ROUTINE_DOCSTRING.format(model=model.__name__)
|
|
56
|
-
|
|
1
|
+
""" MobileNet models implementation.
|
|
2
|
+
|
|
3
|
+
This module provides wrapper classes for the MobileNet family of models from the Keras applications.
|
|
4
|
+
MobileNet models are designed for mobile and embedded vision applications,
|
|
5
|
+
offering efficient architectures that deliver high accuracy with low computational requirements.
|
|
6
|
+
|
|
7
|
+
Available models:
|
|
8
|
+
|
|
9
|
+
- MobileNet: Original MobileNet architecture using depthwise separable convolutions
|
|
10
|
+
- MobileNetV2: Lightweight architecture using inverted residuals and linear bottlenecks
|
|
11
|
+
- MobileNetV3Small: Compact variant of MobileNetV3 optimized for mobile devices
|
|
12
|
+
- MobileNetV3Large: Larger variant of MobileNetV3 with higher capacity
|
|
13
|
+
|
|
14
|
+
All models support transfer learning from ImageNet pre-trained weights.
|
|
15
|
+
"""
|
|
16
|
+
# pyright: reportUnknownVariableType=false
|
|
17
|
+
# pyright: reportMissingTypeStubs=false
|
|
18
|
+
|
|
19
|
+
# Imports
|
|
20
|
+
from __future__ import annotations
|
|
21
|
+
|
|
22
|
+
from keras.models import Model
|
|
23
|
+
from keras.src.applications.mobilenet import MobileNet as MobileNet_keras
|
|
24
|
+
from keras.src.applications.mobilenet_v2 import MobileNetV2 as MobileNetV2_keras
|
|
25
|
+
from keras.src.applications.mobilenet_v3 import MobileNetV3Large as MobileNetV3Large_keras
|
|
26
|
+
from keras.src.applications.mobilenet_v3 import MobileNetV3Small as MobileNetV3Small_keras
|
|
27
|
+
|
|
28
|
+
from ....decorators import simple_cache
|
|
29
|
+
from ..base_keras import BaseKeras
|
|
30
|
+
from ..model_interface import CLASS_ROUTINE_DOCSTRING, MODEL_DOCSTRING
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# Classes
|
|
34
|
+
class MobileNet(BaseKeras):
|
|
35
|
+
def _get_base_model(self) -> Model:
|
|
36
|
+
return MobileNet_keras(include_top=False, classes=self.num_classes)
|
|
37
|
+
|
|
38
|
+
class MobileNetV2(BaseKeras):
|
|
39
|
+
def _get_base_model(self) -> Model:
|
|
40
|
+
return MobileNetV2_keras(include_top=False, classes=self.num_classes)
|
|
41
|
+
|
|
42
|
+
class MobileNetV3Small(BaseKeras):
|
|
43
|
+
def _get_base_model(self) -> Model:
|
|
44
|
+
return MobileNetV3Small_keras(include_top=False, classes=self.num_classes)
|
|
45
|
+
|
|
46
|
+
class MobileNetV3Large(BaseKeras):
|
|
47
|
+
def _get_base_model(self) -> Model:
|
|
48
|
+
return MobileNetV3Large_keras(include_top=False, classes=self.num_classes)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
# Docstrings
|
|
52
|
+
for model in [MobileNet, MobileNetV2, MobileNetV3Small, MobileNetV3Large]:
|
|
53
|
+
model.__doc__ = MODEL_DOCSTRING.format(model=model.__name__)
|
|
54
|
+
model.class_routine = simple_cache(model.class_routine)
|
|
55
|
+
model.class_routine.__doc__ = CLASS_ROUTINE_DOCSTRING.format(model=model.__name__)
|
|
56
|
+
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
""" ResNet models implementation.
|
|
2
|
-
|
|
3
|
-
This module provides wrapper classes for the ResNet family of models from the Keras applications.
|
|
4
|
-
It includes both ResNetV2 models with pre-activation residual blocks and ResNetRS
|
|
5
|
-
(ResNet with Revisited Scaling) models that offer improved performance
|
|
6
|
-
through various scaling techniques.
|
|
7
|
-
|
|
8
|
-
Available models:
|
|
9
|
-
|
|
10
|
-
- ResNetV2 family: Improved ResNet architectures with pre-activation blocks
|
|
11
|
-
- ResNet50V2
|
|
12
|
-
- ResNet101V2
|
|
13
|
-
- ResNet152V2
|
|
14
|
-
|
|
15
|
-
All models support transfer learning from ImageNet pre-trained weights.
|
|
16
|
-
"""
|
|
17
|
-
# pyright: reportUnknownVariableType=false
|
|
18
|
-
# pyright: reportMissingTypeStubs=false
|
|
19
|
-
|
|
20
|
-
# Imports
|
|
21
|
-
from __future__ import annotations
|
|
22
|
-
|
|
23
|
-
from keras.models import Model
|
|
24
|
-
from keras.src.applications.resnet_v2 import ResNet50V2 as ResNet50V2_keras
|
|
25
|
-
from keras.src.applications.resnet_v2 import ResNet101V2 as ResNet101V2_keras
|
|
26
|
-
from keras.src.applications.resnet_v2 import ResNet152V2 as ResNet152V2_keras
|
|
27
|
-
|
|
28
|
-
from ....decorators import simple_cache
|
|
29
|
-
from ..base_keras import BaseKeras
|
|
30
|
-
from ..model_interface import CLASS_ROUTINE_DOCSTRING, MODEL_DOCSTRING
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
# Classes
|
|
34
|
-
class ResNet50V2(BaseKeras):
|
|
35
|
-
def _get_base_model(self) -> Model:
|
|
36
|
-
return ResNet50V2_keras(include_top=False, classes=self.num_classes)
|
|
37
|
-
|
|
38
|
-
class ResNet101V2(BaseKeras):
|
|
39
|
-
def _get_base_model(self) -> Model:
|
|
40
|
-
return ResNet101V2_keras(include_top=False, classes=self.num_classes)
|
|
41
|
-
|
|
42
|
-
class ResNet152V2(BaseKeras):
|
|
43
|
-
def _get_base_model(self) -> Model:
|
|
44
|
-
return ResNet152V2_keras(include_top=False, classes=self.num_classes)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
# Docstrings
|
|
48
|
-
for model in [ResNet50V2, ResNet101V2, ResNet152V2]:
|
|
49
|
-
model.__doc__ = MODEL_DOCSTRING.format(model=model.__name__)
|
|
50
|
-
model.class_routine = simple_cache(model.class_routine)
|
|
51
|
-
model.class_routine.__doc__ = CLASS_ROUTINE_DOCSTRING.format(model=model.__name__)
|
|
52
|
-
|
|
1
|
+
""" ResNet models implementation.
|
|
2
|
+
|
|
3
|
+
This module provides wrapper classes for the ResNet family of models from the Keras applications.
|
|
4
|
+
It includes both ResNetV2 models with pre-activation residual blocks and ResNetRS
|
|
5
|
+
(ResNet with Revisited Scaling) models that offer improved performance
|
|
6
|
+
through various scaling techniques.
|
|
7
|
+
|
|
8
|
+
Available models:
|
|
9
|
+
|
|
10
|
+
- ResNetV2 family: Improved ResNet architectures with pre-activation blocks
|
|
11
|
+
- ResNet50V2
|
|
12
|
+
- ResNet101V2
|
|
13
|
+
- ResNet152V2
|
|
14
|
+
|
|
15
|
+
All models support transfer learning from ImageNet pre-trained weights.
|
|
16
|
+
"""
|
|
17
|
+
# pyright: reportUnknownVariableType=false
|
|
18
|
+
# pyright: reportMissingTypeStubs=false
|
|
19
|
+
|
|
20
|
+
# Imports
|
|
21
|
+
from __future__ import annotations
|
|
22
|
+
|
|
23
|
+
from keras.models import Model
|
|
24
|
+
from keras.src.applications.resnet_v2 import ResNet50V2 as ResNet50V2_keras
|
|
25
|
+
from keras.src.applications.resnet_v2 import ResNet101V2 as ResNet101V2_keras
|
|
26
|
+
from keras.src.applications.resnet_v2 import ResNet152V2 as ResNet152V2_keras
|
|
27
|
+
|
|
28
|
+
from ....decorators import simple_cache
|
|
29
|
+
from ..base_keras import BaseKeras
|
|
30
|
+
from ..model_interface import CLASS_ROUTINE_DOCSTRING, MODEL_DOCSTRING
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# Classes
|
|
34
|
+
class ResNet50V2(BaseKeras):
|
|
35
|
+
def _get_base_model(self) -> Model:
|
|
36
|
+
return ResNet50V2_keras(include_top=False, classes=self.num_classes)
|
|
37
|
+
|
|
38
|
+
class ResNet101V2(BaseKeras):
|
|
39
|
+
def _get_base_model(self) -> Model:
|
|
40
|
+
return ResNet101V2_keras(include_top=False, classes=self.num_classes)
|
|
41
|
+
|
|
42
|
+
class ResNet152V2(BaseKeras):
|
|
43
|
+
def _get_base_model(self) -> Model:
|
|
44
|
+
return ResNet152V2_keras(include_top=False, classes=self.num_classes)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
# Docstrings
|
|
48
|
+
for model in [ResNet50V2, ResNet101V2, ResNet152V2]:
|
|
49
|
+
model.__doc__ = MODEL_DOCSTRING.format(model=model.__name__)
|
|
50
|
+
model.class_routine = simple_cache(model.class_routine)
|
|
51
|
+
model.class_routine.__doc__ = CLASS_ROUTINE_DOCSTRING.format(model=model.__name__)
|
|
52
|
+
|