Common Model Architectures¶
The follow are common model “architectures”. i.e. They are generic, non-application-specific models that may be applied to a variety of ML problems.
NOTE: You may find additional model architectures at tf.keras.applications
ARM DepthwiseConv2D¶
ARM DepthwiseConv2D for Keyword Spotting
See also
- Return type:
Model
- Parameters:
input_shape (tuple) –
num_classes (int) –
Fully Connected Auto-encoder¶
Fully Connected Auto-encoder
See also
- Return type:
Model
- Parameters:
input_shape (tuple) –
dense_units (int) –
latent_units (int) –
MobileNet v1¶
MobileNet v1
See also
- Return type:
Model
- Parameters:
input_shape (tuple) –
MobileNet v2¶
Instantiates the MobileNetV2 architecture.
Optionally loads weights pre-trained on ImageNet.
Note: each Keras Application expects a specific kind of input preprocessing. For MobileNetV2, call
tf.keras.applications.mobilenet_v2.preprocess_input
on your inputs before passing them to the model.- Parameters:
input_shape – shape tuple, to be specified if you would like to use a model with an input image resolution that is not (224, 224, 3). It should have exactly 3 inputs channels (224, 224, 3).
alpha –
Float between 0 and 1. controls the width of the network. This is known as the width multiplier in the MobileNetV2 paper, but the name is kept for consistency with
applications.MobileNetV1
model in Keras.- If
alpha
< 1.0, proportionally decreases the number of filters in each layer.
- If
- If
alpha
> 1.0, proportionally increases the number of filters in each layer.
- If
- If
alpha
= 1, default number of filters from the paper are used at each layer.
- If
include_top – Boolean, whether to include the fully-connected layer at the top of the network. Defaults to
True
.pooling –
String, optional pooling mode for feature extraction when
include_top
isFalse
.None
means that the output of the modelwill be the 4D tensor output of the last convolutional block.
avg
means that global average poolingwill be applied to the output of the last convolutional block, and thus the output of the model will be a 2D tensor.
max
means that global max pooling willbe applied.
classes – Integer, optional number of classes to classify images into, only to be specified if
include_top
is True, and if noweights
argument is specified.classifier_activation – A
str
or callable. The activation function to use on the “top” layer. Ignored unlessinclude_top=True
. Setclassifier_activation=None
to return the logits of the “top” layer.last_block_filters – The number of filters to use in the last block of the model. If omitted, default to 1280 which the standard model uses. Due to hardware constraints, this value must be decreased (< 1024) to be fully optimized by the MVP hardare.
**kwargs – For backwards compatibility only.
- Returns:
A keras.Model instance.
- Raises:
ValueError – in case of invalid argument for
weights
, or invalid input shape or invalid alpha, rows when weights=’imagenet’ValueError – if
classifier_activation
is notsoftmax
orNone
when using a pretrained top layer.
ResNetv1-10¶
ResNetv1-10
See also
- Return type:
Model
- Parameters:
input_shape (tuple) –
num_classes (int) –
num_filters (int) –
TENet¶
Temporal efficient neural network (TENet)
A network for processing spectrogram data using temporal and depthwise convolutions. The network treats the [T, F] spectrogram as a timeseries shaped [T, 1, F].
Note
When building the model, make sure that the input shape is concrete, i.e. explicitly reshape the samples to [T, 1, F] in the preprocessing pipeline.
See also
- Parameters:
classes (
int
) – Number of classes the network is built to categorizechannels (
int
) – Base number of channels in the networkblocks (
int
) – Number of (StridedIBB -> IBB -> …) blocks in the networksblock_depth (
int
) – Number of IBBs inside each (StridedIBB -> IBB -> …) block, including the strided IBBscales (
List
[int
]) – The multitemporal convolution filter widths. Should be odd numbers >= 3.channel_increase (
float
) – If nonzero, the network increases the channel size each time there is a strided IBB block. The increase (each time) is given by channels * channel_increase.include_head – If true, add a classifier head to the model
return_model – If true, return a Keras model
input_layer (
Input
) – Use the given layer as the input to the model. If None, the create a layer using the given input shapedropout (
float
) – The dropout to use when include_head=Trueinput_shape (Union[List[int], Tuple[int]]) –
- Return type:
Union[Model, Layer]
- Return type:
Union
[Model
,Layer
]- Parameters:
input_shape (Union[List[int], Tuple[int]]) –
classes (int) –
channels (int) –
blocks (int) –
block_depth (int) –
scales (List[int]) –
channel_increase (float) –
input_layer (Input) –
dropout (float) –