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

Add detection_filter to predict() method to allow for user-defined logic #307

Merged
merged 2 commits into from
Aug 19, 2024

Conversation

brendancol
Copy link
Collaborator

Hey @giswqs...I was interested in being able to have finer-grain control over the filtering of detections, especially during batch_predict.

Just an idea, but what about adding a callable detection_filter arg to predict()?

...which expects a function like:

def max_25_detections_filter_func(box, mask, logit, phrase, i) -> bool:
    return i < 25

To then be passed in kwargs down the line...

sam.batch_predict(..., detection_filter=max_25_detections_filter_func) 

I've implemented the following above, and seems to work well, but would appreciate hearing other people's perspectives on the API for something like this.

brendancol and others added 2 commits August 18, 2024 15:02
filtering of detections based on user-defined logic;
appears to seamlessly work with `batch_predict` also;
@brendancol brendancol changed the title Added a detection_filter to predict() method to allow for user-defined logic Add detection_filter to predict() method to allow for user-defined logic Aug 18, 2024
Copy link
Member

@giswqs giswqs left a comment

Choose a reason for hiding this comment

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

LGTM.

@giswqs giswqs merged commit 409953a into opengeos:main Aug 19, 2024
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.

2 participants