def restore_from_objects(self, fine_tune_checkpoint_type='detection'):
    "Returns a map of Trackable objects to load from a foreign checkpoint.\n\n    Returns a dictionary of Tensorflow 2 Trackable objects (e.g. tf.Module\n    or Checkpoint). This enables the model to initialize based on weights from\n    another task. For example, the feature extractor variables from a\n    classification model can be used to bootstrap training of an object\n    detector. When loading from an object detection model, the checkpoint model\n    should have the same parameters as this detection model with exception of\n    the num_classes parameter.\n\n    Note that this function is intended to be used to restore Keras-based\n    models when running Tensorflow 2, whereas restore_map (not implemented\n    in CenterNet) is intended to be used to restore Slim-based models when\n    running Tensorflow 1.x.\n\n    TODO(jonathanhuang): Make this function consistent with other\n    meta-architectures.\n\n    Args:\n      fine_tune_checkpoint_type: whether to restore from a full detection\n        checkpoint (with compatible variable names) or to restore from a\n        classification checkpoint for initialization prior to training.\n        Valid values: `detection`, `classification`, `fine_tune`.\n        Default 'detection'.\n        'detection': used when loading models pre-trained on other detection\n          tasks. With this checkpoint type the weights of the feature extractor\n          are expected under the attribute 'feature_extractor'.\n        'classification': used when loading models pre-trained on an image\n          classification task. Note that only the encoder section of the network\n          is loaded and not the upsampling layers. With this checkpoint type,\n          the weights of only the encoder section are expected under the\n          attribute 'feature_extractor'.\n        'fine_tune': used when loading the entire CenterNet feature extractor\n          pre-trained on other tasks. The checkpoints saved during CenterNet\n          model training can be directly loaded using this type. With this\n          checkpoint type, the weights of the feature extractor are expected\n          under the attribute 'model._feature_extractor'.\n        For more details, see the tensorflow section on Loading mechanics.\n        https://www.tensorflow.org/guide/checkpoint#loading_mechanics\n\n    Returns:\n      A dict mapping keys to Trackable objects (tf.Module or Checkpoint).\n    "
    supported_types = self._feature_extractor.supported_sub_model_types
    supported_types += ['fine_tune']
    if (fine_tune_checkpoint_type not in supported_types):
        message = 'Checkpoint type "{}" not supported for {}. Supported types are {}'
        raise ValueError(message.format(fine_tune_checkpoint_type, self._feature_extractor.__class__.__name__, supported_types))
    elif (fine_tune_checkpoint_type == 'fine_tune'):
        feature_extractor_model = tf.train.Checkpoint(_feature_extractor=self._feature_extractor)
        return {'model': feature_extractor_model}
    else:
        return {'feature_extractor': self._feature_extractor.get_sub_model(fine_tune_checkpoint_type)}
Returns a map of Trackable objects to load from a foreign checkpoint.

Returns a dictionary of Tensorflow 2 Trackable objects (e.g. tf.Module
or Checkpoint). This enables the model to initialize based on weights from
another task. For example, the feature extractor variables from a
classification model can be used to bootstrap training of an object
detector. When loading from an object detection model, the checkpoint model
should have the same parameters as this detection model with exception of
the num_classes parameter.

Note that this function is intended to be used to restore Keras-based
models when running Tensorflow 2, whereas restore_map (not implemented
in CenterNet) is intended to be used to restore Slim-based models when
running Tensorflow 1.x.

TODO(jonathanhuang): Make this function consistent with other
meta-architectures.

Args:
  fine_tune_checkpoint_type: whether to restore from a full detection
    checkpoint (with compatible variable names) or to restore from a
    classification checkpoint for initialization prior to training.
    Valid values: `detection`, `classification`, `fine_tune`.
    Default 'detection'.
    'detection': used when loading models pre-trained on other detection
      tasks. With this checkpoint type the weights of the feature extractor
      are expected under the attribute 'feature_extractor'.
    'classification': used when loading models pre-trained on an image
      classification task. Note that only the encoder section of the network
      is loaded and not the upsampling layers. With this checkpoint type,
      the weights of only the encoder section are expected under the
      attribute 'feature_extractor'.
    'fine_tune': used when loading the entire CenterNet feature extractor
      pre-trained on other tasks. The checkpoints saved during CenterNet
      model training can be directly loaded using this type. With this
      checkpoint type, the weights of the feature extractor are expected
      under the attribute 'model._feature_extractor'.
    For more details, see the tensorflow section on Loading mechanics.
    https://www.tensorflow.org/guide/checkpoint#loading_mechanics

Returns:
  A dict mapping keys to Trackable objects (tf.Module or Checkpoint).
def restore_from_objects(self, fine_tune_checkpoint_type='detection'):
    "Returns a map of Trackable objects to load from a foreign checkpoint.\n\n    Returns a dictionary of Tensorflow 2 Trackable objects (e.g. tf.Module\n    or Checkpoint). This enables the model to initialize based on weights from\n    another task. For example, the feature extractor variables from a\n    classification model can be used to bootstrap training of an object\n    detector. When loading from an object detection model, the checkpoint model\n    should have the same parameters as this detection model with exception of\n    the num_classes parameter.\n\n    Note that this function is intended to be used to restore Keras-based\n    models when running Tensorflow 2, whereas restore_map (not implemented\n    in CenterNet) is intended to be used to restore Slim-based models when\n    running Tensorflow 1.x.\n\n    TODO(jonathanhuang): Make this function consistent with other\n    meta-architectures.\n\n    Args:\n      fine_tune_checkpoint_type: whether to restore from a full detection\n        checkpoint (with compatible variable names) or to restore from a\n        classification checkpoint for initialization prior to training.\n        Valid values: `detection`, `classification`, `fine_tune`.\n        Default 'detection'.\n        'detection': used when loading models pre-trained on other detection\n          tasks. With this checkpoint type the weights of the feature extractor\n          are expected under the attribute 'feature_extractor'.\n        'classification': used when loading models pre-trained on an image\n          classification task. Note that only the encoder section of the network\n          is loaded and not the upsampling layers. With this checkpoint type,\n          the weights of only the encoder section are expected under the\n          attribute 'feature_extractor'.\n        'fine_tune': used when loading the entire CenterNet feature extractor\n          pre-trained on other tasks. The checkpoints saved during CenterNet\n          model training can be directly loaded using this type. With this\n          checkpoint type, the weights of the feature extractor are expected\n          under the attribute 'model._feature_extractor'.\n        For more details, see the tensorflow section on Loading mechanics.\n        https://www.tensorflow.org/guide/checkpoint#loading_mechanics\n\n    Returns:\n      A dict mapping keys to Trackable objects (tf.Module or Checkpoint).\n    "
    supported_types = self._feature_extractor.supported_sub_model_types
    supported_types += ['fine_tune']
    if (fine_tune_checkpoint_type not in supported_types):
        message = 'Checkpoint type "{}" not supported for {}. Supported types are {}'
        raise ValueError(message.format(fine_tune_checkpoint_type, self._feature_extractor.__class__.__name__, supported_types))
    elif (fine_tune_checkpoint_type == 'fine_tune'):
        feature_extractor_model = tf.train.Checkpoint(_feature_extractor=self._feature_extractor)
        return {'model': feature_extractor_model}
    else:
        return {'feature_extractor': self._feature_extractor.get_sub_model(fine_tune_checkpoint_type)}