Skip to content

Feature/multi bbox predictions#73

Draft
mualicemu wants to merge 11 commits into
google:mainfrom
mualicemu:feature/multi-bbox-predictions
Draft

Feature/multi bbox predictions#73
mualicemu wants to merge 11 commits into
google:mainfrom
mualicemu:feature/multi-bbox-predictions

Conversation

@mualicemu

Copy link
Copy Markdown

Description

This PR introduces a new execution pathway (multi_predict) to extract and return independent species classifications for every bounding box detected in an image, bypassing the legacy constraint that flattened all detections into a single prediction.

Key Changes

  1. classifier.py: Added multi_preprocess() to dynamically generate separate image crops for each detected bounding box within the image.
  2. ensemble_prediction_combiner.py: Added combine_predictions_for_all_items(), a new 1-to-many combiner loop. Instead of hardcoding detections[0], it iterates over all bounding boxes, applies geofencing/roll-up rules individually, and retains the physical bounding box [ymin, xmin, ymax, xmax] coordinates in the output dictionary.
  3. ensemble.py: Added multi_combine() to orchestrate the new zippering logic.
  4. multiprocessing.py: Appended a new multi_predict() method to the SpeciesNet class. This safely batches the cropped tensors on the GPU and invokes the new combiner.

Note: Strict backwards compatibility is maintained. The original predict() method and combine_predictions_for_single_item remain completely untouched for legacy integrations.

@mualicemu mualicemu marked this pull request as draft July 8, 2026 16:50
@mualicemu mualicemu force-pushed the feature/multi-bbox-predictions branch 2 times, most recently from 910d1ff to 05ccd7b Compare July 8, 2026 17:24
@mualicemu mualicemu force-pushed the feature/multi-bbox-predictions branch from 05ccd7b to 9d4b47b Compare July 8, 2026 17:34
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