diff --git a/keras/src/applications/mobilenet.py b/keras/src/applications/mobilenet.py index 7c01779405f..ea1b5d58137 100644 --- a/keras/src/applications/mobilenet.py +++ b/keras/src/applications/mobilenet.py @@ -30,6 +30,7 @@ def MobileNet( pooling=None, classes=1000, classifier_activation="softmax", + name=None, ): """Instantiates the MobileNet architecture. @@ -101,6 +102,7 @@ def MobileNet( Set `classifier_activation=None` to return the logits of the "top" layer. When loading pretrained weights, `classifier_activation` can only be `None` or `"softmax"`. + name: String, the name of the model. Returns: A model instance. @@ -237,7 +239,9 @@ def MobileNet( inputs = img_input # Create model. - model = Functional(inputs, x, name=f"mobilenet_{alpha:0.2f}_{rows}") + if name is None: + name = f"mobilenet_{alpha:0.2f}_{rows}" + model = Functional(inputs, x, name=name) # Load weights. if weights == "imagenet": diff --git a/keras/src/applications/mobilenet_v2.py b/keras/src/applications/mobilenet_v2.py index 3a6a8f0e14d..1b4c3a1df1a 100644 --- a/keras/src/applications/mobilenet_v2.py +++ b/keras/src/applications/mobilenet_v2.py @@ -28,6 +28,7 @@ def MobileNetV2( pooling=None, classes=1000, classifier_activation="softmax", + name=None, ): """Instantiates the MobileNetV2 architecture. @@ -103,6 +104,7 @@ def MobileNetV2( Set `classifier_activation=None` to return the logits of the "top" layer. When loading pretrained weights, `classifier_activation` can only be `None` or `"softmax"`. + name: String, the name of the model. Returns: A model instance. @@ -359,7 +361,9 @@ def MobileNetV2( inputs = img_input # Create model. - model = Functional(inputs, x, name=f"mobilenetv2_{alpha:0.2f}_{rows}") + if name is None: + name = f"mobilenetv2_{alpha:0.2f}_{rows}" + model = Functional(inputs, x, name=name) # Load weights. if weights == "imagenet": diff --git a/keras/src/applications/mobilenet_v3.py b/keras/src/applications/mobilenet_v3.py index 6d02d5eab24..972ae8d4323 100644 --- a/keras/src/applications/mobilenet_v3.py +++ b/keras/src/applications/mobilenet_v3.py @@ -135,6 +135,7 @@ be `None` or `"softmax"`. include_preprocessing: Boolean, whether to include the preprocessing layer (`Rescaling`) at the bottom of the network. Defaults to `True`. + name: String, the name of the model. Call arguments: inputs: A floating point `numpy.array` or backend-native tensor,