-
Notifications
You must be signed in to change notification settings - Fork 259
feat(workflows): support custom image names in dataset upload block #2034
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
grzegorz-roboflow
merged 7 commits into
main
from
feat/dg-287-add-optional-image_name-field-to-preserve-original-filenames
Feb 25, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a60c2b6
feat(workflows): support custom image names in dataset upload block
rafel-roboflow 5ba1f71
Reduce scope to change dataset upload
rafel-roboflow 5540f68
clean up
rafel-roboflow 8347225
added manifest in v1
rafel-roboflow 4e3562b
fixed failing test dataset upload v1
rafel-roboflow 4076206
Merge branch 'main' into feat/dg-287-add-optional-image_name-field-to…
grzegorz-roboflow 5c78fec
Merge branch 'main' into feat/dg-287-add-optional-image_name-field-to…
grzegorz-roboflow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -238,10 +238,15 @@ | |
| description="Frequency at which new labeling batches are automatically created for uploaded images. Options: 'never' (all images go to the same batch), 'daily' (new batch each day), 'weekly' (new batch each week), 'monthly' (new batch each month). Batch timestamps are appended to the labeling_batch_prefix to create unique batch names. Automatically organizing uploads into time-based batches simplifies dataset management and makes it easier to track and review collected data over time.", | ||
| examples=["never", "daily"], | ||
| ) | ||
| image_name: Optional[Union[str, Selector(kind=[STRING_KIND])]] = Field( | ||
| default=None, | ||
| description="Optional custom name for the uploaded image. If provided, this name will be used instead of an auto-generated UUID. This is useful when you want to preserve the original filename or use a meaningful identifier (e.g., serial number, timestamp) for the image in the Roboflow dataset. The name should not include file extension. If not provided, a UUID will be generated automatically.", | ||
| examples=["serial_12345", "camera1_frame_001", "$inputs.filename"], | ||
| ) | ||
|
|
||
| @classmethod | ||
| def get_parameters_accepting_batches(cls) -> List[str]: | ||
| return ["images", "predictions"] | ||
| return ["images", "predictions", "image_name"] | ||
|
|
||
| @classmethod | ||
| def describe_outputs(cls) -> List[OutputDefinition]: | ||
|
|
@@ -294,6 +299,7 @@ | |
| fire_and_forget: bool, | ||
| labeling_batch_prefix: str, | ||
| labeling_batches_recreation_frequency: BatchCreationFrequency, | ||
| image_name: Optional[Batch[Optional[str]]] = None, | ||
| ) -> BlockResult: | ||
| if self._api_key is None: | ||
| raise ValueError( | ||
|
|
@@ -312,7 +318,8 @@ | |
| ] | ||
| result = [] | ||
| predictions = [None] * len(images) if predictions is None else predictions | ||
| for image, prediction in zip(images, predictions): | ||
| image_names = [None] * len(images) if image_name is None else image_name | ||
| for image, prediction, img_name in zip(images, predictions, image_names): | ||
| error_status, message = register_datapoint_at_roboflow( | ||
| image=image, | ||
| prediction=prediction, | ||
|
|
@@ -332,6 +339,7 @@ | |
| background_tasks=self._background_tasks, | ||
| thread_pool_executor=self._thread_pool_executor, | ||
| api_key=self._api_key, | ||
| image_name=img_name, | ||
| ) | ||
| result.append({"error_status": error_status, "message": message}) | ||
| return result | ||
|
|
@@ -356,6 +364,7 @@ | |
| background_tasks: Optional[BackgroundTasks], | ||
| thread_pool_executor: Optional[ThreadPoolExecutor], | ||
| api_key: str, | ||
| image_name: Optional[str] = None, | ||
| ) -> Tuple[bool, str]: | ||
| registration_task = partial( | ||
| execute_registration, | ||
|
|
@@ -374,6 +383,7 @@ | |
| new_labeling_batch_frequency=new_labeling_batch_frequency, | ||
| cache=cache, | ||
| api_key=api_key, | ||
| image_name=image_name, | ||
| ) | ||
| if fire_and_forget and background_tasks: | ||
| background_tasks.add_task(registration_task) | ||
|
|
@@ -400,6 +410,7 @@ | |
| new_labeling_batch_frequency: BatchCreationFrequency, | ||
| cache: BaseCache, | ||
| api_key: str, | ||
| image_name: Optional[str] = None, | ||
| ) -> Tuple[bool, str]: | ||
| matching_strategies_limits = OrderedDict( | ||
| { | ||
|
|
@@ -427,7 +438,7 @@ | |
| return False, "Registration skipped due to usage quota exceeded" | ||
| credit_to_be_returned = False | ||
| try: | ||
| local_image_id = str(uuid4()) | ||
| local_image_id = image_name if image_name else str(uuid4()) | ||
| encoded_image, scaling_factor = prepare_image_to_registration( | ||
| image=image.numpy_image, | ||
| desired_size=ImageDimensions( | ||
|
|
@@ -465,7 +476,7 @@ | |
| finally: | ||
| if credit_to_be_returned: | ||
| return_strategy_credit( | ||
| cache=cache, | ||
Check failureCode scanning / CodeQL Use of a broken or weak cryptographic hashing algorithm on sensitive data High Sensitive data (password) Error loading related location Loading Sensitive data (password) Error loading related location Loading Sensitive data (password) is used in a hashing algorithm (MD5) that is insecure for password hashing, since it is not a computationally expensive hash function. Sensitive data (password) is used in a hashing algorithm (MD5) that is insecure for password hashing, since it is not a computationally expensive hash function. Sensitive data (password) is used in a hashing algorithm (MD5) that is insecure for password hashing, since it is not a computationally expensive hash function. Sensitive data (password) is used in a hashing algorithm (MD5) that is insecure for password hashing, since it is not a computationally expensive hash function. Sensitive data (password) is used in a hashing algorithm (MD5) that is insecure for password hashing, since it is not a computationally expensive hash function. Sensitive data (password) is used in a hashing algorithm (MD5) that is insecure for password hashing, since it is not a computationally expensive hash function. Sensitive data (password) is used in a hashing algorithm (MD5) that is insecure for password hashing, since it is not a computationally expensive hash function. |
||
| workspace=workspace_name, | ||
| project=target_project, | ||
| strategy_name=strategy_with_spare_credit, | ||
|
|
@@ -575,7 +586,7 @@ | |
| tags: List[str], | ||
| inference_id: Optional[str], | ||
| ) -> Optional[str]: | ||
| registration_response = register_image_at_roboflow( | ||
Check failureCode scanning / CodeQL Clear-text logging of sensitive information High
This expression logs
sensitive data (password) Error loading related location Loading This expression logs sensitive data (password) Error loading related location Loading This expression logs sensitive data (password) as clear text. This expression logs sensitive data (password) as clear text. This expression logs sensitive data (password) as clear text. This expression logs sensitive data (password) as clear text. This expression logs sensitive data (password) as clear text. This expression logs sensitive data (password) as clear text. This expression logs sensitive data (password) as clear text. |
||
| api_key=api_key, | ||
| dataset_id=target_project, | ||
| local_image_id=local_image_id, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.