Skip to content

Image

Base Image class

Bases: BaseModel

Represents an image within a Tenyks dataset.

Attributes:

Name Type Description
dataset_key str

Key of the dataset the image belongs to. Examples: my_dataset. Validation Aliases: dataset_key, dataset_name.

key str

Key of the image. Examples: img1. Validation Aliases: key, image_key.

filename str

Filename of the image. Examples: img1.jpg, subfolder/img1.png.

type str

Format of the image. Examples: .jpg, .png. Validation Aliases: type, image_type.

width PositiveInt

Width of the image in pixels. Examples: 1920, 1080.

height PositiveInt

Height of the image in pixels. Examples: 1080, 720.

raw_image_url HttpUrl

URL to the raw image (e.g., Presigned AWS S3 URL). Examples: https://example.com/image.jpg.

tags Optional[List[Tag]]

List of tags for the image. Defaults to an empty list. Examples: [ { "key": "colour", "name": "colour", "values": ["peach"] }, { "key": "daytime", "name": "daytime", "values": ["night", "snow"] } ].

annotations Optional[List[Annotation]]

List of annotations for the image. Defaults to an empty list. Examples: [ { "coordinates": [606, 170.91, 621.35, 184.28], "category": { "id": 2, "name": "person", "color": "#FF0000" }, "id": "uuid4", "segmentation": [ [431.0, 217.5, 442.0, 215.5, 432.0, 216.5, 431.0, 217.5] ], "tags": [ { "key": "colour", "name": "colour", "values": ["peach"] } ] } ].

predictions Optional[List[Prediction]]

List of predictions for the image. Defaults to an empty list. Examples: [ { "coordinates": [606, 170.91, 621.35, 184.28], "category": { "id": 2, "name": "person", "color": "#FF0000" }, "id": "uuid4", "segmentation": [ [431.0, 217.5, 442.0, 215.5, 432.0, 216.5, 431.0, 217.5] ], "tags": [ { "key": "colour", "name": "colour", "values": ["peach"] } ], "score": 0.95 } ].

Display Tenyks Image:

from tenyks_sdk.sdk.image.utils import display_images

Utility function to display Tenyks Images

Parameters:

Name Type Description Default
images List[Image]

A list of Image objects to be displayed.

required
n_images_to_show Optional[int]

The number of images to display. If None, all images will be shown. Defaults to None.

None
draw_bboxes Optional[bool]

Whether to draw bounding boxes around annotations. If True, bounding boxes will be drawn based on image annotations. Defaults to False.

False
n_cols Optional[int]

The number of columns in the display grid. The layout will adjust the number of rows accordingly. Defaults to 3.

3