Make `classifier_activation` accessible for NASNet models
@@ -328,7 +328,8 @@ def NASNetMobile(input_shape=None,
weights='imagenet',
input_tensor=None,
pooling=None,
- classes=1000):
+ classes=1000,
+ classifier_activation='softmax'):
"""Instantiates a Mobile NASNet model in ImageNet mode.
Reference:
@@ -373,6 +374,11 @@ def NASNetMobile(input_shape=None,
classes: Optional number of classes to classify images
into, only to be specified if `include_top` is True, and
if no `weights` argument is specified.
+ classifier_activation: A `str` or callable. The activation function to use
+ on the "top" layer. Ignored unless `include_top=True`. Set
+ `classifier_activation=None` to return the logits of the "top" layer.
+ When loading pretrained weights, `classifier_activation` can only
+ be `None` or `"softmax"`.
Returns:
A Keras model instance.
@@ -395,7 +401,8 @@ def NASNetMobile(input_shape=None,
input_tensor=input_tensor,
pooling=pooling,
classes=classes,
- default_size=224)
+ default_size=224,
+ classifier_activation=classifier_activation)
@keras_export('keras.applications.nasnet.NASNetLarge',
@@ -405,7 +412,8 @@ def NASNetLarge(input_shape=None,
weights='imagenet',
input_tensor=None,
pooling=None,
- classes=1000):
+ classes=1000,
+ classifier_activation='softmax'):
"""Instantiates a NASNet model in ImageNet mode.
Reference:
@@ -450,6 +458,11 @@ def NASNetLarge(input_shape=None,
classes: Optional number of classes to classify images
into, only to be specified if `include_top` is True, and
if no `weights` argument is specified.
+ classifier_activation: A `str` or callable. The activation function to use
+ on the "top" layer. Ignored unless `include_top=True`. Set
+ `classifier_activation=None` to return the logits of the "top" layer.
+ When loading pretrained weights, `classifier_activation` can only
+ be `None` or `"softmax"`.
Returns:
A Keras model instance.
@@ -472,7 +485,8 @@ def NASNetLarge(input_shape=None,
input_tensor=input_tensor,
pooling=pooling,
classes=classes,
- default_size=331)
+ default_size=331,
+ classifier_activation=classifier_activation)
def _separable_conv_block(ip,
