From 177598bc594de0facfd5b9df252e737b0a77a09b Mon Sep 17 00:00:00 2001 From: Chandler Supple Date: Wed, 7 Aug 2024 15:34:10 -0700 Subject: [PATCH 1/3] Added inference IDs to sources when uploaded via Dataset Upload --- .../core_steps/sinks/roboflow/roboflow_dataset_upload.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/inference/core/workflows/core_steps/sinks/roboflow/roboflow_dataset_upload.py b/inference/core/workflows/core_steps/sinks/roboflow/roboflow_dataset_upload.py index ac41518314..1140d90055 100644 --- a/inference/core/workflows/core_steps/sinks/roboflow/roboflow_dataset_upload.py +++ b/inference/core/workflows/core_steps/sinks/roboflow/roboflow_dataset_upload.py @@ -464,6 +464,7 @@ def register_datapoint( api_key=api_key, batch_name=batch_name, tags=tags, + inference_id=prediction.data["inference_id"][0], ) if roboflow_image_id is None: return DUPLICATED_STATUS @@ -489,6 +490,7 @@ def safe_register_image_at_roboflow( api_key: str, batch_name: str, tags: List[str], + inference_id: Optional[str] = None, ) -> Optional[str]: registration_response = register_image_at_roboflow( api_key=api_key, @@ -497,6 +499,7 @@ def safe_register_image_at_roboflow( image_bytes=encoded_image, batch_name=batch_name, tags=tags, + inference_id=inference_id, ) image_duplicated = registration_response.get("duplicate", False) if image_duplicated: From cc351db905d4c06d531ad6c6608afce69b583874 Mon Sep 17 00:00:00 2001 From: Chandler Supple Date: Wed, 7 Aug 2024 16:56:18 -0700 Subject: [PATCH 2/3] Accounted for no predictions --- .../core_steps/sinks/roboflow/roboflow_dataset_upload.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/inference/core/workflows/core_steps/sinks/roboflow/roboflow_dataset_upload.py b/inference/core/workflows/core_steps/sinks/roboflow/roboflow_dataset_upload.py index 1140d90055..dd9b2c9803 100644 --- a/inference/core/workflows/core_steps/sinks/roboflow/roboflow_dataset_upload.py +++ b/inference/core/workflows/core_steps/sinks/roboflow/roboflow_dataset_upload.py @@ -457,6 +457,7 @@ def register_datapoint( batch_name: str, tags: List[str], ) -> str: + inference_id = prediction.data["inference_id"][0] if prediction and "inference_id" in prediction.data else None roboflow_image_id = safe_register_image_at_roboflow( target_project=target_project, encoded_image=encoded_image, @@ -464,7 +465,7 @@ def register_datapoint( api_key=api_key, batch_name=batch_name, tags=tags, - inference_id=prediction.data["inference_id"][0], + inference_id=inference_id, ) if roboflow_image_id is None: return DUPLICATED_STATUS @@ -490,7 +491,7 @@ def safe_register_image_at_roboflow( api_key: str, batch_name: str, tags: List[str], - inference_id: Optional[str] = None, + inference_id: Optional[str], ) -> Optional[str]: registration_response = register_image_at_roboflow( api_key=api_key, From e4f335ec91cb92707883b10d6447b5a123c29afd Mon Sep 17 00:00:00 2001 From: Chandler Supple Date: Wed, 7 Aug 2024 17:04:01 -0700 Subject: [PATCH 3/3] Made the linter happy --- .../core_steps/sinks/roboflow/roboflow_dataset_upload.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/inference/core/workflows/core_steps/sinks/roboflow/roboflow_dataset_upload.py b/inference/core/workflows/core_steps/sinks/roboflow/roboflow_dataset_upload.py index dd9b2c9803..1ad56e91c5 100644 --- a/inference/core/workflows/core_steps/sinks/roboflow/roboflow_dataset_upload.py +++ b/inference/core/workflows/core_steps/sinks/roboflow/roboflow_dataset_upload.py @@ -457,7 +457,11 @@ def register_datapoint( batch_name: str, tags: List[str], ) -> str: - inference_id = prediction.data["inference_id"][0] if prediction and "inference_id" in prediction.data else None + inference_id = ( + prediction.data["inference_id"][0] + if prediction and "inference_id" in prediction.data + else None + ) roboflow_image_id = safe_register_image_at_roboflow( target_project=target_project, encoded_image=encoded_image,