Allow Wildbook to set custom image UUIDs via add_images API#320
Merged
Conversation
Instead of always computing UUIDs from file content hashes, callers can now pass image_uuid_list to /api/image/json/ to provide their own UUIDs. This lets Wildbook maintain consistent MediaAsset UUIDs across systems. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace assert with raise ValueError for API input validation (asserts are stripped by python -O and produce 500 instead of 400) - Wrap UUID parsing in try/except for malformed strings - Log warning when custom UUID is dropped due to failed image load - Document that None elements mean "use hash-computed UUID" Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When an annotation references a missing or broken image, the chip generation returns None for its path. Previously this caused a TypeError crash in the densenet/efficientnet DataLoader. Now we filter out null paths, log a warning with the affected annotation IDs, and return safe defaults (score=0.0, species=UNKNOWN) so the batch can complete. Affects: compute_classifications (densenet), compute_labels_annotations (efficientnet and densenet labeler paths). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codex review caught two issues with the initial defensive check:
1. Fake (0.0, 'UNKNOWN') results get cached by the depcache,
turning a transient missing-image problem into a persistent
wrong prediction that survives image repair.
2. Empty probs dict {} breaks downstream evaluation code that
expects real label keys.
Fix: yield None for annotations with missing chips. The depcache's
filter_Nones mechanism already handles this — the row is skipped
without caching anything, so a retry after fixing the image will
produce a real prediction.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
add_imagesAPI to passimage_uuid_list, overriding the default hash-computed UUIDs with Wildbook-provided onesNoneelement in the list means "use the hash-computed UUID for this image", so callers can selectively overrideChanges
wbia/web/apis_json.pyimage_uuid_listparam, validate as UUID strings, pass through toadd_images. Removedimage_uuid_listfrom deprecated list.wbia/control/manual_image_funcs.pyimage_uuid_listparam, splice custom UUIDs into the params tuple in place of hash-computed ones. Warns when a custom UUID is dropped due to failed image load.Test plan
add_images_jsonwithoutimage_uuid_list→ existing behavior unchangedadd_images_jsonwith validimage_uuid_list→ images get the specified UUIDsadd_images_jsonwithNoneelements in list → those images keep hash-computed UUIDsValueErrorraisedValueErrorraised🤖 Generated with Claude Code