// Message to store the mapping from class label strings to class id. Datasets
// use string labels to represent classes while the object detection framework
// works with class ids. This message maps them so they can be converted back
// and forth as needed.
syntax = "proto2";

package object_detection.protos;

// LVIS frequency:
enum LVISFrequency {
  UNSPECIFIED = 0;
  FREQUENT = 1;
  COMMON = 2;
  RARE = 3;
}

message StringIntLabelMapItem {
  // String name. The most common practice is to set this to a MID or synsets
  // id.
  optional string name = 1;

  // Integer id that maps to the string name above. Label ids should start from
  // 1.
  optional int32 id = 2;

  // Human readable string label.
  optional string display_name = 3;

  // Name of class specific keypoints for each class object and their respective
  // keypoint IDs.
  message KeypointMap {
    // Id for the keypoint. Id must be unique within a given class, however, it
    // could be shared across classes. For example "nose" keypoint can occur
    // in both "face" and "person" classes. Hence they can be mapped to the same
    // id.
    //
    // Note: It is advised to assign ids in range [1, num_unique_keypoints] to
    // encode keypoint targets efficiently.
    optional int32 id = 1;
    // Label for the keypoint.
    optional string label = 2;
  }
  repeated KeypointMap keypoints = 4;

  // Label ids for the elements that are connected in the hierarchy with the
  // current element. Value should correspond to another label id element.
  repeated int32 ancestor_ids = 5;
  repeated int32 descendant_ids = 6;

  // LVIS specific label map fields
  optional LVISFrequency frequency = 7;
  optional int32 instance_count = 8;
};

message StringIntLabelMap {
  repeated StringIntLabelMapItem item = 1;
};
