def ResNet18(inputs, blocks=None, include_top=True, classes=1000, *args, **kwargs):
"""
Constructs a `keras.models.Model` according to the ResNet18 specifications.
:param inputs: input tensor (e.g. an instance of `keras.layers.Input`)
:param blocks: the network’s residual architecture
:param include_top: if true, includes classification layers
:param classes: number of classes to classify (include_top must be true)
:return model: ResNet model with encoding output (if `include_top=False`) or classification output (if `include_top=True`)
Usage:
>>> import keras_resnet.models
>>> shape, classes = (224, 224, 3), 1000
>>> x = keras.layers.Input(shape)
>>> model = keras_resnet.models.ResNet18(x, classes=classes)
>>> model.compile("adam", "categorical_crossentropy", ["accuracy"])
"""
if blocks is None:
blocks = [2, 2, 2, 2]
return ResNet(inputs, blocks, block=keras_resnet.blocks.basic_2d, include_top=include_top, classes=classes, *args, **kwargs)
评论列表
文章目录