keras_retinanet.models package

Submodules

keras_retinanet.models.densenet module

keras_retinanet.models.mobilenet module

keras_retinanet.models.resnet module

keras_retinanet.models.retinanet module

keras_retinanet.models.vgg module

Module contents

class keras_retinanet.models.Backbone(backbone)[source]

Bases: object

This class stores additional information on backbones.

download_imagenet()[source]

Downloads ImageNet weights and returns path to weights file.

preprocess_image(inputs)[source]

Takes as input an image and prepares it for being passed through the network. Having this function in Backbone allows other backbones to define a specific preprocessing step.

retinanet(*args, **kwargs)[source]

Returns a retinanet model using the correct backbone.

validate()[source]

Checks whether the backbone string is correct.

keras_retinanet.models.assert_training_model(model)[source]

Assert that the model is a training model.

keras_retinanet.models.backbone(backbone_name)[source]

Returns a backbone object for the given backbone.

keras_retinanet.models.check_training_model(model)[source]

Check that model is a training model and exit otherwise.

keras_retinanet.models.convert_model(model, nms=True, class_specific_filter=True, anchor_params=None)[source]

Converts a training model to an inference model.

Args
model : A retinanet training model. nms : Boolean, whether to add NMS filtering to the converted model. class_specific_filter : Whether to use class specific filtering or filter for the best scoring class only. anchor_params : Anchor parameters object. If omitted, default values are used.
Returns
A keras.models.Model object.
Raises
ImportError: if h5py is not available. ValueError: In case of an invalid savefile.
keras_retinanet.models.load_model(filepath, backbone_name='resnet50')[source]

Loads a retinanet model using the correct custom objects.

Args
filepath: one of the following:
  • string, path to the saved model, or
  • h5py.File object from which to load the model

backbone_name : Backbone with which the model was trained.

Returns
A keras.models.Model object.
Raises
ImportError: if h5py is not available. ValueError: In case of an invalid savefile.