Skip to content

Commit

Permalink
Add name to MobileNetV3 to allow multiple instances in one model
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Carpenter authored and jeffcarp committed May 11, 2024
1 parent da83683 commit 14caa78
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion keras/src/applications/mobilenet_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ def MobileNetV3(
dropout_rate=0.2,
classifier_activation="softmax",
include_preprocessing=True,
name=None,
):
if not (weights in {"imagenet", None} or file_utils.exists(weights)):
raise ValueError(
Expand Down Expand Up @@ -373,7 +374,7 @@ def MobileNetV3(
inputs = img_input

# Create model.
model = Functional(inputs, x, name="MobilenetV3" + model_type)
model = Functional(inputs, x, name=name)

# Load weights.
if weights == "imagenet":
Expand Down Expand Up @@ -412,6 +413,7 @@ def MobileNetV3Small(
dropout_rate=0.2,
classifier_activation="softmax",
include_preprocessing=True,
name="MobileNetV3Small",
):
def stack_fn(x, kernel, activation, se_ratio):
def depth(d):
Expand Down Expand Up @@ -461,6 +463,7 @@ def depth(d):
dropout_rate,
classifier_activation,
include_preprocessing,
name=name,
)


Expand All @@ -477,6 +480,7 @@ def MobileNetV3Large(
dropout_rate=0.2,
classifier_activation="softmax",
include_preprocessing=True,
name="MobileNetV3Large",
):
def stack_fn(x, kernel, activation, se_ratio):
def depth(d):
Expand Down Expand Up @@ -524,6 +528,7 @@ def depth(d):
dropout_rate,
classifier_activation,
include_preprocessing,
name=name,
)


Expand Down

0 comments on commit 14caa78

Please sign in to comment.