def get_context_feature_length(model_config):
  """Returns context feature length from a given config.

  Args:
    model_config: A model config file.

  Returns:
    An integer specifying the fixed length of each feature in context_features.
  """
  meta_architecture = model_config.WhichOneof("model")
  meta_architecture_config = getattr(model_config, meta_architecture)

  if hasattr(meta_architecture_config, "context_config"):
    return meta_architecture_config.context_config.context_feature_length
Returns context feature length from a given config.

  Args:
    model_config: A model config file.

  Returns:
    An integer specifying the fixed length of each feature in context_features.
  
inference_api/src/main/object_detection/utils/config_util.py