Skip to content

[Bug-fix]Add support for max_detection_per_image hyperparam#543

Open
RihaanBH-1810 wants to merge 5 commits intoJdeRobot:masterfrom
RihaanBH-1810:fix-use-max-detections-per-image-hyper-param
Open

[Bug-fix]Add support for max_detection_per_image hyperparam#543
RihaanBH-1810 wants to merge 5 commits intoJdeRobot:masterfrom
RihaanBH-1810:fix-use-max-detections-per-image-hyper-param

Conversation

@RihaanBH-1810
Copy link
Copy Markdown
Contributor

@RihaanBH-1810 RihaanBH-1810 commented Apr 5, 2026

This PR fixes #497 by filtering the best results in postprocess_detection for both yolo and torchvision. I have updated the docstrings and formatted the changed files with black.

Here is a video of me testing the PR on both yolo and torchvision models :

max_image_fix.mp4

@dpascualhe

Copy link
Copy Markdown
Collaborator

@dpascualhe dpascualhe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Upon addressing the comments raised we can merge

Comment thread perceptionmetrics/models/utils/torchvision.py Outdated
Comment thread perceptionmetrics/models/utils/torchvision.py Outdated
Comment thread perceptionmetrics/models/torch_detection.py Outdated
@RihaanBH-1810
Copy link
Copy Markdown
Contributor Author

Hi @dpascualhe, thanks for the review. I've set the default value to -1 so that the filter is bypassed by default, and also change the code to check if max_detections is less than the number of outputs and apply filter only in that case.
I've made the changes for both yolo and torchvision.

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.

[Bug] The max_detections_per_image field in mannual model config is being ignored.

2 participants