File size: 4,151 Bytes
b7d2408
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
"""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")