Skip to content

Allow Wildbook to set custom image UUIDs via add_images API#320

Merged
JasonWildMe merged 6 commits into
mainfrom
custom-image-uuids
Apr 13, 2026
Merged

Allow Wildbook to set custom image UUIDs via add_images API#320
JasonWildMe merged 6 commits into
mainfrom
custom-image-uuids

Conversation

@JasonWildMe
Copy link
Copy Markdown
Contributor

Summary

  • Allow callers of the add_images API to pass image_uuid_list, overriding the default hash-computed UUIDs with Wildbook-provided ones
  • Enables Wildbook to maintain UUID consistency when re-importing images that may have been re-encoded or resized (same logical image, different bytes → different hash)
  • Validates UUID format at the JSON API layer, with length-mismatch checks at both layers
  • A None element in the list means "use the hash-computed UUID for this image", so callers can selectively override

Changes

File Change
wbia/web/apis_json.py Accept image_uuid_list param, validate as UUID strings, pass through to add_images. Removed image_uuid_list from deprecated list.
wbia/control/manual_image_funcs.py Accept image_uuid_list param, 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_json without image_uuid_list → existing behavior unchanged
  • add_images_json with valid image_uuid_list → images get the specified UUIDs
  • add_images_json with None elements in list → those images keep hash-computed UUIDs
  • Length mismatch → ValueError raised
  • Invalid UUID string → ValueError raised
  • Image that fails to load with custom UUID → warning logged, UUID dropped gracefully

🤖 Generated with Claude Code

JasonWildMe and others added 6 commits March 30, 2026 22:02
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>
@JasonWildMe JasonWildMe merged commit 357e13f into main Apr 13, 2026
4 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant