'Returns a map of variables to load from a foreign checkpoint.
See parent class for details.
Args:
from_detection_checkpoint: whether to restore from a full detection
checkpoint (with compatible variable names) or to restore from a
classification checkpoint for initialization prior to training.
Returns:
A dict mapping variable names (to load from a checkpoint) to variables in
the model graph.'

def restore_map(self, from_detection_checkpoint=True):

    variables_to_restore = {}
    for variable in tf.all_variables():
        if variable.op.name.startswith(self._extract_features_scope):
            var_name = variable.op.name
            if (not from_detection_checkpoint):
                var_name = re.split((('^' + self._extract_features_scope) + '/'), var_name)[(-1)]
            variables_to_restore[var_name] = variable
    return variables_to_restore
