REST Resource: projects.datasets.annotatedDatasets.examples

Resource: Example

An Example is a piece of data and its annotation. For example, an image with label "house".

JSON representation
{
  "name": string,
  "annotations": [
    {
      object (Annotation)
    }
  ],

  // Union field payload can be only one of the following:
  "imagePayload": {
    object (ImagePayload)
  },
  "textPayload": {
    object (TextPayload)
  },
  "videoPayload": {
    object (VideoPayload)
  }
  // End of list of possible types for union field payload.
}
Fields
name

string

Output only. Name of the example, in format of: projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/ {annotated_dataset_id}/examples/{example_id}

annotations[]

object (Annotation)

Output only. Annotations for the piece of data in Example. One piece of data can have multiple annotations.

Union field payload. Output only. The data part of Example. payload can be only one of the following:
imagePayload

object (ImagePayload)

The image payload, a container of the image bytes/uri.

textPayload

object (TextPayload)

The text payload, a container of the text content.

videoPayload

object (VideoPayload)

The video payload, a container of the video uri.

Annotation

Annotation for Example. Each example may have one or more annotations. For example in image classification problem, each image might have one or more labels. We call labels binded with this image an Annotation.

JSON representation
{
  "name": string,
  "annotationSource": enum (AnnotationSource),
  "annotationValue": {
    object (AnnotationValue)
  },
  "annotationMetadata": {
    object (AnnotationMetadata)
  },
  "annotationSentiment": enum (AnnotationSentiment)
}
Fields
name

string

Output only. Unique name of this annotation, format is:

projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/{annotatedDataset}/examples/{example_id}/annotations/{annotation_id}

annotationSource

enum (AnnotationSource)

Output only. The source of the annotation.

annotationValue

object (AnnotationValue)

Output only. This is the actual annotation value, e.g classification, bounding box values are stored here.

annotationMetadata

object (AnnotationMetadata)

Output only. Annotation metadata, including information like votes for labels.

annotationSentiment

enum (AnnotationSentiment)

Output only. Sentiment for this annotation.

AnnotationValue

Annotation value for an example.

JSON representation
{

  // Union field value_type can be only one of the following:
  "imageClassificationAnnotation": {
    object (ImageClassificationAnnotation)
  },
  "imageBoundingPolyAnnotation": {
    object (ImageBoundingPolyAnnotation)
  },
  "imagePolylineAnnotation": {
    object (ImagePolylineAnnotation)
  },
  "imageSegmentationAnnotation": {
    object (ImageSegmentationAnnotation)
  },
  "textClassificationAnnotation": {
    object (TextClassificationAnnotation)
  },
  "textEntityExtractionAnnotation": {
    object (TextEntityExtractionAnnotation)
  },
  "videoClassificationAnnotation": {
    object (VideoClassificationAnnotation)
  },
  "videoObjectTrackingAnnotation": {
    object (VideoObjectTrackingAnnotation)
  },
  "videoEventAnnotation": {
    object (VideoEventAnnotation)
  }
  // End of list of possible types for union field value_type.
}
Fields

Union field value_type.

value_type can be only one of the following:

imageClassificationAnnotation

object (ImageClassificationAnnotation)

Annotation value for image classification case.

imageBoundingPolyAnnotation

object (ImageBoundingPolyAnnotation)

Annotation value for image bounding box, oriented bounding box and polygon cases.

imagePolylineAnnotation

object (ImagePolylineAnnotation)

Annotation value for image polyline cases. Polyline here is different from BoundingPoly. It is formed by line segments connected to each other but not closed form(Bounding Poly). The line segments can cross each other.

imageSegmentationAnnotation

object (ImageSegmentationAnnotation)

Annotation value for image segmentation.

textClassificationAnnotation

object (TextClassificationAnnotation)

Annotation value for text classification case.

textEntityExtractionAnnotation

object (TextEntityExtractionAnnotation)

Annotation value for text entity extraction case.

videoClassificationAnnotation

object (VideoClassificationAnnotation)

Annotation value for video classification case.

videoObjectTrackingAnnotation

object (VideoObjectTrackingAnnotation)

Annotation value for video object detection and tracking case.

videoEventAnnotation

object (VideoEventAnnotation)

Annotation value for video event case.

ImageClassificationAnnotation

Image classification annotation definition.

JSON representation
{
  "annotationSpec": {
    object (AnnotationSpec)
  }
}
Fields
annotationSpec

object (AnnotationSpec)

Label of image.

ImageBoundingPolyAnnotation

Image bounding poly annotation. It represents a polygon including bounding box in the image.

JSON representation
{
  "annotationSpec": {
    object (AnnotationSpec)
  },

  // Union field bounded_area can be only one of the following:
  "boundingPoly": {
    object (BoundingPoly)
  },
  "normalizedBoundingPoly": {
    object (NormalizedBoundingPoly)
  }
  // End of list of possible types for union field bounded_area.
}
Fields
annotationSpec

object (AnnotationSpec)

Label of object in this bounding polygon.

Union field bounded_area. The region of the polygon. If it is a bounding box, it is guaranteed to be four points. bounded_area can be only one of the following:
boundingPoly

object (BoundingPoly)

normalizedBoundingPoly

object (NormalizedBoundingPoly)

BoundingPoly

A bounding polygon in the image.

JSON representation
{
  "vertices": [
    {
      object (Vertex)
    }
  ]
}
Fields
vertices[]

object (Vertex)

The bounding polygon vertices.

Vertex

A vertex represents a 2D point in the image. NOTE: the vertex coordinates are in the same scale as the original image.

JSON representation
{
  "x": number,
  "y": number
}
Fields
x

number

X coordinate.

y

number

Y coordinate.

NormalizedBoundingPoly

Normalized bounding polygon.

JSON representation
{
  "normalizedVertices": [
    {
      object (NormalizedVertex)
    }
  ]
}
Fields
normalizedVertices[]

object (NormalizedVertex)

The bounding polygon normalized vertices.

NormalizedVertex

A vertex represents a 2D point in the image. NOTE: the normalized vertex coordinates are relative to the original image and range from 0 to 1.

JSON representation
{
  "x": number,
  "y": number
}
Fields
x

number

X coordinate.

y

number

Y coordinate.

ImagePolylineAnnotation

A polyline for the image annotation.

JSON representation
{
  "annotationSpec": {
    object (AnnotationSpec)
  },

  // Union field poly can be only one of the following:
  "polyline": {
    object (Polyline)
  },
  "normalizedPolyline": {
    object (NormalizedPolyline)
  }
  // End of list of possible types for union field poly.
}
Fields
annotationSpec

object (AnnotationSpec)

Label of this polyline.

Union field poly.

poly can be only one of the following:

polyline

object (Polyline)

normalizedPolyline

object (NormalizedPolyline)

Polyline

A line with multiple line segments.

JSON representation
{
  "vertices": [
    {
      object (Vertex)
    }
  ]
}
Fields
vertices[]

object (Vertex)

The polyline vertices.

NormalizedPolyline

Normalized polyline.

JSON representation
{
  "normalizedVertices": [
    {
      object (NormalizedVertex)
    }
  ]
}
Fields
normalizedVertices[]

object (NormalizedVertex)

The normalized polyline vertices.

ImageSegmentationAnnotation

Image segmentation annotation.

JSON representation
{
  "annotationColors": {
    string: {
      object(AnnotationSpec)
    },
    ...
  },
  "mimeType": string,
  "imageBytes": string
}
Fields
annotationColors

map (key: string, value: object (AnnotationSpec))

The mapping between rgb color and annotation spec. The key is the rgb color represented in format of rgb(0, 0, 0). The value is the AnnotationSpec.

mimeType

string

Image format.

imageBytes

string (bytes format)

A byte string of a full image's color map.

A base64-encoded string.

TextClassificationAnnotation

Text classification annotation.

JSON representation
{
  "annotationSpec": {
    object (AnnotationSpec)
  }
}
Fields
annotationSpec

object (AnnotationSpec)

Label of the text.

TextEntityExtractionAnnotation

Text entity extraction annotation.

JSON representation
{
  "annotationSpec": {
    object (AnnotationSpec)
  },
  "sequentialSegment": {
    object (SequentialSegment)
  }
}
Fields
annotationSpec

object (AnnotationSpec)

Label of the text entities.

sequentialSegment

object (SequentialSegment)

Position of the entity.

SequentialSegment

Start and end position in a sequence (e.g. text segment).

JSON representation
{
  "start": number,
  "end": number
}
Fields
start

number

Start position (inclusive).

end

number

End position (exclusive).

VideoClassificationAnnotation

Video classification annotation.

JSON representation
{
  "timeSegment": {
    object (TimeSegment)
  },
  "annotationSpec": {
    object (AnnotationSpec)
  }
}
Fields
timeSegment

object (TimeSegment)

The time segment of the video to which the annotation applies.

annotationSpec

object (AnnotationSpec)

Label of the segment specified by timeSegment.

TimeSegment

A time period inside of an example that has a time dimension (e.g. video).

JSON representation
{
  "startTimeOffset": string,
  "endTimeOffset": string
}
Fields
startTimeOffset

string (Duration format)

Start of the time segment (inclusive), represented as the duration since the example start.

A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

endTimeOffset

string (Duration format)

End of the time segment (exclusive), represented as the duration since the example start.

A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

VideoObjectTrackingAnnotation

Video object tracking annotation.

JSON representation
{
  "annotationSpec": {
    object (AnnotationSpec)
  },
  "timeSegment": {
    object (TimeSegment)
  },
  "objectTrackingFrames": [
    {
      object (ObjectTrackingFrame)
    }
  ]
}
Fields
annotationSpec

object (AnnotationSpec)

Label of the object tracked in this annotation.

timeSegment

object (TimeSegment)

The time segment of the video to which object tracking applies.

objectTrackingFrames[]

object (ObjectTrackingFrame)

The list of frames where this object track appears.

ObjectTrackingFrame

Video frame level annotation for object detection and tracking.

JSON representation
{
  "timeOffset": string,

  // Union field bounded_area can be only one of the following:
  "boundingPoly": {
    object (BoundingPoly)
  },
  "normalizedBoundingPoly": {
    object (NormalizedBoundingPoly)
  }
  // End of list of possible types for union field bounded_area.
}
Fields
timeOffset

string (Duration format)

The time offset of this frame relative to the beginning of the video.

A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

Union field bounded_area. The bounding box location of this object track for the frame. bounded_area can be only one of the following:
boundingPoly

object (BoundingPoly)

normalizedBoundingPoly

object (NormalizedBoundingPoly)

VideoEventAnnotation

Video event annotation.

JSON representation
{
  "annotationSpec": {
    object (AnnotationSpec)
  },
  "timeSegment": {
    object (TimeSegment)
  }
}
Fields
annotationSpec

object (AnnotationSpec)

Label of the event in this annotation.

timeSegment

object (TimeSegment)

The time segment of the video to which the annotation applies.

AnnotationMetadata

Additional information associated with the annotation.

JSON representation
{
  "operatorMetadata": {
    object (OperatorMetadata)
  }
}
Fields
operatorMetadata

object (OperatorMetadata)

Metadata related to human labeling.

OperatorMetadata

General information useful for labels coming from contributors.

JSON representation
{
  "score": number,
  "totalVotes": number,
  "labelVotes": number,
  "comments": [
    string
  ]
}
Fields
score

number

Confidence score corresponding to a label. For examle, if 3 contributors have answered the question and 2 of them agree on the final label, the confidence score will be 0.67 (2/3).

totalVotes

number

The total number of contributors that answer this question.

labelVotes

number

The total number of contributors that choose this label.

comments[]

string

Comments from contributors.

AnnotationSentiment

Enums
ANNOTATION_SENTIMENT_UNSPECIFIED
NEGATIVE This annotation describes negatively about the data.
POSITIVE This label describes positively about the data.

Methods

get

Gets an example by resource name, including both data and annotation.

list

Lists examples in an annotated dataset.