Thibaut's picture
Add complete metrics evaluation subproject structure
b7d2408
"""CVAT API task schemas.
This module contains Pydantic models for CVAT API tasks, including task details
and media metadata.
"""
from typing import Any
from pydantic import BaseModel, ConfigDict, Field
from .common import CvatApiJobsSummary, CvatApiStorage, CvatApiUser
from .job import CvatApiMetainformationFrame
from .label import CvatApiLabelDefinition
class CvatApiTaskMediasMetainformation(BaseModel):
"""Represents the media metadata for a task in CVAT API.
Attributes:
media_type: Type of media (e.g., "image", "video") - optional as not always returned by API
start_frame: First frame number in the task
stop_frame: Last frame number in the task
frame_filter: Frame filter expression
frames: List of frame metadata
"""
media_type: str | None = None
start_frame: int
stop_frame: int
frame_filter: str
frames: list[CvatApiMetainformationFrame]
model_config = ConfigDict(extra="allow")
class CvatApiTaskDetails(BaseModel):
"""Represents task details in CVAT API.
Tasks are containers for annotation work, divided into jobs. Tasks belong
to projects and contain media (images or video frames) to be annotated.
Attributes:
id: Unique task identifier
name: Task name
project_id: Associated project ID (optional)
mode: Task mode (e.g., "annotation", "interpolation")
owner: User who created the task
assignee: User assigned to the task (optional)
bug_tracker: Bug tracker URL
created_date: Task creation timestamp
updated_date: Last update timestamp
overlap: Number of overlapping frames between jobs (optional)
segment_size: Number of frames per job segment (optional)
status: Task status
labels: Label definitions or URL reference
segments: List of job segments
dimension: Task dimension ("2d" or "3d")
data_compressed_chunk_type: Compression type for data chunks
data_original_chunk_type: Original chunk type
image_quality: JPEG quality for image compression (0-100, optional)
data: Data ID reference (optional)
subset: Dataset subset name (e.g., "train", "test", "val")
organization: Organization ID (optional)
target_storage: Target storage configuration (optional)
source_storage: Source storage configuration (optional)
jobs: Jobs summary for this task
url: API URL for the task
data_chunk_size: Size of data chunks (optional)
data_cloud_storage_id: Cloud storage ID for data (optional)
guide_id: ID of annotation guide (optional)
size: Task size in bytes (optional)
organization_id: Organization ID (optional, alternative field)
assignee_updated_date: Last assignee update timestamp (optional)
validation_mode: Validation mode (optional)
consensus_enabled: Whether consensus mode is enabled
"""
id: int
name: str
project_id: int | None = None
mode: str
owner: CvatApiUser
assignee: CvatApiUser | None = None
bug_tracker: str = ""
created_date: str
updated_date: str
overlap: int | None = None
segment_size: int | None = None
status: str
labels: list[CvatApiLabelDefinition] | dict[str, str] = Field(default_factory=list)
segments: list[dict[str, Any]] = Field(default_factory=list)
dimension: str
data_compressed_chunk_type: str | None = None
data_original_chunk_type: str | None = None
image_quality: int | None = None
data: int | None = None
subset: str = ""
organization: int | None = None
target_storage: CvatApiStorage | None = None
source_storage: CvatApiStorage | None = None
jobs: CvatApiJobsSummary
url: str
data_chunk_size: int | None = None
data_cloud_storage_id: int | None = None
guide_id: int | None = None
size: int | None = None
organization_id: int | None = None
assignee_updated_date: str | None = None
validation_mode: str | None = None
consensus_enabled: bool = False
model_config = ConfigDict(extra="allow")