'Returns a map of variables to load from a foreign checkpoint.
Args:
first_stage_feature_extractor_scope: A scope name for the first stage
feature extractor.
second_stage_feature_extractor_scope: A scope name for the second stage
feature extractor.
Returns:
A dict mapping variable names (to load from a checkpoint) to variables in
the model graph.'

def restore_from_classification_checkpoint_fn(self, first_stage_feature_extractor_scope, second_stage_feature_extractor_scope):

    variables_to_restore = {}
    for variable in tf.global_variables():
        for scope_name in [first_stage_feature_extractor_scope, second_stage_feature_extractor_scope]:
            if variable.op.name.startswith(scope_name):
                var_name = variable.op.name.replace((scope_name + '/'), '')
                variables_to_restore[var_name] = variable
    return variables_to_restore
