File tree Expand file tree Collapse file tree 3 files changed +6
-9
lines changed
labelbox/data/serialization/coco Expand file tree Collapse file tree 3 files changed +6
-9
lines changed Original file line number Diff line number Diff line change 5
5
from pydantic import BaseModel
6
6
import numpy as np
7
7
8
+ from .path import PathSerializerMixin
9
+
8
10
9
11
def rle_decoding (rle_arr : List [int ], w : int , h : int ) -> np .ndarray :
10
12
indices = []
@@ -50,7 +52,7 @@ class COCOObjectAnnotation(BaseModel):
50
52
iscrowd : int = 0
51
53
52
54
53
- class PanopticAnnotation (BaseModel ):
55
+ class PanopticAnnotation (PathSerializerMixin ):
54
56
# One to one relationship between image and panoptic annotation
55
57
image_id : int
56
58
file_name : Path
Original file line number Diff line number Diff line change 1
1
from typing import Dict , Any , Union
2
- from pathlib import Path , PosixPath , WindowsPath
2
+ from pathlib import Path
3
3
import os
4
4
5
- import pydantic .json
6
-
7
5
from labelbox .data .annotation_types .collection import LabelCollection , LabelGenerator
8
6
from labelbox .data .serialization .coco .instance_dataset import CocoInstanceDataset
9
7
from labelbox .data .serialization .coco .panoptic_dataset import CocoPanopticDataset
10
8
11
- pydantic .json .ENCODERS_BY_TYPE [PosixPath ] = str
12
- pydantic .json .ENCODERS_BY_TYPE [WindowsPath ] = str
13
-
14
9
15
10
def create_path_if_not_exists (path : Union [Path , str ],
16
11
ignore_existing_data = False ):
Original file line number Diff line number Diff line change 1
1
from pathlib import Path
2
2
3
3
from typing import Optional , Tuple
4
- from pydantic import BaseModel
5
4
from PIL import Image
6
5
import imagesize
7
6
7
+ from .path import PathSerializerMixin
8
8
from labelbox .data .annotation_types import Label
9
9
10
10
11
- class CocoImage (BaseModel ):
11
+ class CocoImage (PathSerializerMixin ):
12
12
id : int
13
13
width : int
14
14
height : int
You can’t perform that action at this time.
0 commit comments