Toloka documentation

ImageAnnotationFieldV1

toloka.client.project.template_builder.fields.ImageAnnotationFieldV1 | Source code

ImageAnnotationFieldV1(
    self,
    data: Optional[BaseComponent] = None,
    image: Optional[Union[BaseComponent, str]] = None,
    *,
    disabled: Optional[Union[BaseComponent, bool]] = None,
    full_height: Optional[Union[BaseComponent, bool]] = None,
    labels: Optional[Union[BaseComponent, List[Union[BaseComponent, Label]]]] = None,
    min_width: Optional[Union[BaseComponent, float]] = None,
    ratio: Optional[Union[BaseComponent, List[Union[BaseComponent, float]]]] = None,
    shapes: Optional[Union[BaseComponent, Dict[Union[BaseComponent, Shape], Union[BaseComponent, bool]]]] = None,
    hint: Optional[Any] = None,
    label: Optional[Any] = None,
    validation: Optional[BaseComponent] = None,
    version: Optional[str] = '1.0.0'
)

Adds an interface for selecting areas in images.

If you need to select different types of objects, classify the areas using the labels property.

You can select areas using points, polygons, and rectangles. In the shapes property, you can keep some of the selection modes and hide the rest.

Parameters Description

Parameters Type Description
data Optional[BaseComponent]

Data with values that will be processed or changed.

image Optional[Union[BaseComponent, str]]

The image you want to select areas in.

disabled Optional[Union[BaseComponent, bool]]

Determines whether adding and deleting areas is allowed:

  • false (default) — Allowed.
  • true — Not allowed. You can use this feature when creating an interface to check whether the selection is correct, or if you need to allow selection only when a certain condition is met.
full_height Optional[Union[BaseComponent, bool]]

If true, the element takes up all the vertical free space. The element is set to a minimum height of 400 pixels.

labels Optional[Union[BaseComponent, List[Union[BaseComponent, Label]]]]

Used to classify areas. You can add several area types. When adding an area type, a button to select it appears in the interface, and when setting a new value, a new area selection color is added. This feature is instrumental if you need to select different types of objects: you can use one color to select cars and a different one for pedestrians.

min_width Optional[Union[BaseComponent, float]]

Minimum width of the element in pixels. Takes priority over max_width.

ratio Optional[Union[BaseComponent, List[Union[BaseComponent, float]]]]

An array of two numbers that sets the relative dimensions of the sides: width (first number) to height (second number). Not valid if full_height=true.

shapes Optional[Union[BaseComponent, Dict[Union[BaseComponent, Shape], Union[BaseComponent, bool]]]]

Used to add and hide selection modes: points, polygons, and rectangles. All three modes are available by default. Use this property if you only need to keep certain modes. Modes with the true value are available.

hint Optional[Any]

Hint text.

label Optional[Any]

Label above the component.

validation Optional[BaseComponent]

Validation based on condition.