11from typing import Dict , Any , Union
22from pathlib import Path
33import os
4+ import warnings
45
5- from labelbox . data .annotation_types .collection import LabelCollection , LabelGenerator
6- from labelbox . data .serialization .coco .instance_dataset import CocoInstanceDataset
7- from labelbox . data .serialization .coco .panoptic_dataset import CocoPanopticDataset
6+ from .. .annotation_types .collection import LabelCollection , LabelGenerator
7+ from .. .serialization .coco .instance_dataset import CocoInstanceDataset
8+ from .. .serialization .coco .panoptic_dataset import CocoPanopticDataset
89
910
1011def create_path_if_not_exists (path : Union [Path , str ],
@@ -28,7 +29,7 @@ def validate_path(path: Union[Path, str], name: str):
2829
2930class COCOConverter :
3031 """
31- Class for convertering between coco and labelbox formats
32+ Class for converting between coco and labelbox formats
3233 Note that this class is only compatible with image data.
3334
3435 Subclasses are currently ignored.
@@ -55,6 +56,12 @@ def serialize_instances(labels: LabelCollection,
5556 Returns:
5657 A dictionary containing labels in the coco object format.
5758 """
59+
60+ warnings .warn (
61+ "You are currently utilizing COCOconverter for this action, which will be deprecated in a later release." ,
62+ DeprecationWarning ,
63+ stacklevel = 2 )
64+
5865 image_root = create_path_if_not_exists (image_root , ignore_existing_data )
5966 return CocoInstanceDataset .from_common (labels = labels ,
6067 image_root = image_root ,
@@ -85,6 +92,12 @@ def serialize_panoptic(labels: LabelCollection,
8592 Returns:
8693 A dictionary containing labels in the coco panoptic format.
8794 """
95+
96+ warnings .warn (
97+ "You are currently utilizing COCOconverter for this action, which will be deprecated in a later release." ,
98+ DeprecationWarning ,
99+ stacklevel = 2 )
100+
88101 image_root = create_path_if_not_exists (image_root , ignore_existing_data )
89102 mask_root = create_path_if_not_exists (mask_root , ignore_existing_data )
90103 return CocoPanopticDataset .from_common (labels = labels ,
@@ -107,6 +120,12 @@ def deserialize_panoptic(json_data: Dict[str, Any], image_root: Union[Path,
107120 Returns:
108121 LabelGenerator
109122 """
123+
124+ warnings .warn (
125+ "You are currently utilizing COCOconverter for this action, which will be deprecated in a later release." ,
126+ DeprecationWarning ,
127+ stacklevel = 2 )
128+
110129 image_root = validate_path (image_root , 'image_root' )
111130 mask_root = validate_path (mask_root , 'mask_root' )
112131 objs = CocoPanopticDataset (** json_data )
@@ -125,6 +144,12 @@ def deserialize_instances(json_data: Dict[str, Any],
125144 Returns:
126145 LabelGenerator
127146 """
147+
148+ warnings .warn (
149+ "You are currently utilizing COCOconverter for this action, which will be deprecated in a later release." ,
150+ DeprecationWarning ,
151+ stacklevel = 2 )
152+
128153 image_root = validate_path (image_root , 'image_root' )
129154 objs = CocoInstanceDataset (** json_data )
130155 gen = objs .to_common (image_root )
0 commit comments