diff --git a/nucleus/__init__.py b/nucleus/__init__.py index 96b23ce5..71aa6402 100644 --- a/nucleus/__init__.py +++ b/nucleus/__init__.py @@ -67,10 +67,11 @@ from .annotation import ( BoxAnnotation, - Point, PolygonAnnotation, Segment, SegmentationAnnotation, + Point, + CuboidAnnotation, ) from .constants import ( ANNOTATION_METADATA_SCHEMA_KEY, @@ -118,6 +119,7 @@ ) from .prediction import ( BoxPrediction, + CuboidPrediction, PolygonPrediction, SegmentationPrediction, ) @@ -569,6 +571,8 @@ def annotate_dataset( :param update: whether to update or ignore conflicting annotations :return: {"dataset_id: str, "annotations_processed": int} """ + if any((isinstance(ann, CuboidAnnotation) for ann in annotations)): + raise NotImplementedError("Cuboid annotations not yet supported") # Split payload into segmentations and Box/Polygon segmentations = [ @@ -727,6 +731,9 @@ def predict( "predictions_ignored": int, } """ + if any((isinstance(ann, CuboidPrediction) for ann in annotations)): + raise NotImplementedError("Cuboid predictions not yet supported") + segmentations = [ ann for ann in annotations diff --git a/nucleus/dataset.py b/nucleus/dataset.py index 8fdbe1b4..756c0619 100644 --- a/nucleus/dataset.py +++ b/nucleus/dataset.py @@ -3,15 +3,18 @@ import requests from nucleus.job import AsyncJob +from nucleus.url_utils import sanitize_string_args from nucleus.utils import ( convert_export_payload, format_dataset_item_response, serialize_and_write_to_presigned_url, ) -from nucleus.url_utils import sanitize_string_args - -from .annotation import Annotation, check_all_annotation_paths_remote +from .annotation import ( + Annotation, + CuboidAnnotation, + check_all_annotation_paths_remote, +) from .constants import ( DATASET_ITEM_IDS_KEY, DATASET_LENGTH_KEY, @@ -33,7 +36,6 @@ ) from .payload_constructor import construct_model_run_creation_payload - WARN_FOR_LARGE_UPLOAD = 50000 @@ -166,6 +168,9 @@ def annotate( "ignored_items": int, } """ + if any((isinstance(ann, CuboidAnnotation) for ann in annotations)): + raise NotImplementedError("Cuboid annotations not yet supported") + if asynchronous: check_all_annotation_paths_remote(annotations)