Skip to content
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

fix: separate postprocessing from runtime inference logic and handle null masks results #79

Merged
merged 2 commits into from
Feb 25, 2025

Conversation

CuriousDolphin
Copy link
Member

@CuriousDolphin CuriousDolphin commented Feb 24, 2025

  • Move postprocessing functions from runtime.py to utils/vision.py
  • Update runtime classes to return raw model outputs
  • Modify local and remote model classes to apply postprocessing separately
  • Improve logging with more detailed inference time and detection count information
  • Enhance error handling for cases with no detections (empty masks)

Context

New segmentation postprocess is broken when there are empty masks (non_null_pixel =0 or mask.shape !=2) in model output.

- Move postprocessing functions from runtime.py to utils/vision.py
- Update runtime classes to return raw model outputs
- Modify local and remote model classes to apply postprocessing separately
- Improve logging with more detailed inference time and detection count information
- Enhance error handling for cases with no detections
Copy link

github-actions bot commented Feb 24, 2025

Coverage

Coverage Report •
FileStmtsMissCoverMissing
local_model.py68297%143–144
remote_model.py1433972%228–233, 238, 242–243, 245–246, 250–251, 279–287, 289–292, 296–298, 302, 305–310, 312–313, 370
runtime.py1409532%30, 38–39, 60, 64, 68, 78, 80–81, 83–85, 88–90, 93, 96–98, 101, 104–105, 108–109, 112, 137–141, 143–144, 147–150, 152–153, 155, 159–162, 166–167, 169–171, 173–177, 179–180, 182–184, 188, 198–199, 209–212, 214, 216–217, 219–225, 229–232, 236–237, 239–240, 242–246, 248–249, 251–252, 254, 264–265
utils
   vision.py141596%124, 162, 192, 330, 362
TOTAL108915685% 

Tests Skipped Failures Errors Time
116 1 💤 0 ❌ 0 🔥 14.027s ⏱️

…ions

- Add check for empty detections in RemoteModel annotation method
- Replace np.empty with np.zeros for consistent empty array handling
- Adjust mask cropping and bounding box calculations for edge cases
- Improve robustness of detection conversion and postprocessing functions
@CuriousDolphin CuriousDolphin merged commit c8736a7 into main Feb 25, 2025
9 checks passed
@CuriousDolphin CuriousDolphin deleted the fix/postprocess branch February 25, 2025 10:14
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.

3 participants