diff --git a/README.md b/README.md index 3d28599..aa7af29 100644 --- a/README.md +++ b/README.md @@ -2514,7 +2514,11 @@ dataset_object = client.create_dataset_object( "value": "dog", "type": "bbox" # type can be 'bbox', 'segmentation'. } - ] + ], + custom_metadata={ + "key": "value", + "metadata": "metadata-value" + } ) ``` @@ -2568,6 +2572,10 @@ See API docs for details. "confidenceScore": -1 } ], + "customMetadata": { + "key": "value", + "metadata": "metadata-value" + }, 'createdAt': '2022-10-30T08:32:20.748Z', 'updatedAt': '2022-10-30T08:32:20.748Z' } diff --git a/fastlabel/__init__.py b/fastlabel/__init__.py index 044a2ec..995ed36 100644 --- a/fastlabel/__init__.py +++ b/fastlabel/__init__.py @@ -4050,7 +4050,11 @@ async def __download(base_path: Path, _obj: dict): exist_dataset_objects = json.load(open(output_path)) with Path(base_path / "annotations.json").open("w") as f: annotations = [ - {"name": obj["name"], "annotations": obj["annotations"]} + { + "name": obj["name"], + "annotations": obj["annotations"], + "customMetadata": obj["customMetadata"], + } for obj in objects ] json.dump( @@ -4076,6 +4080,7 @@ def create_dataset_object( file_path: str, tags: List[str] = None, annotations: List[dict] = None, + custom_metadata: Optional[dict[str, str]] = None, ) -> dict: """ Create a dataset object. @@ -4102,6 +4107,8 @@ def create_dataset_object( payload["tags"] = tags if annotations: payload["annotations"] = annotations + if custom_metadata: + payload["customMetadata"] = custom_metadata return self.api.post_request(endpoint, payload=payload) def delete_dataset_object(self, dataset_id: str, object_name: str) -> None: @@ -4418,6 +4425,7 @@ def get_histories( return self.api.get_request(endpoint, params=params) + def delete_extra_annotations_parameter(annotations: list) -> list: for annotation in annotations: annotation.pop("id", None) @@ -4437,4 +4445,4 @@ def delete_extra_attributes_parameter(attributes: list) -> list: attribute.pop("title", None) attribute.pop("name", None) attribute.pop("type", None) - return attributes \ No newline at end of file + return attributes