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

Exclude classes from inference using pretrained or custom models #1104

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

gguzzy
Copy link

@gguzzy gguzzy commented Dec 2, 2024

Hello dear all,
I am writing you to share and open a PR to include in your framework the option to exclude certain classes from inferences/predictions performed, since I found this useful in general.

This allows us to exclude predictions which are not considered by a custom user.

This can be done by using two new optional parameters which are: exclude_classes_names and exclude_classes_id.

Recall to use the same notation for class names and ids accordingly to the loaded model.

I introduced an example which shows the usage of the new parameter, added to folder tests as test_exclude_classes.py'

The methods which include the new parameters are the ones which are responsible for predictions, which are 'prediction, get_sliced_prediction, get_prediction' and their respective usages inside the 'predict.py' class.

gguzzy and others added 2 commits December 2, 2024 18:59
…ls on SAHI - Pull request

1. This feature allows to perform 'predict', 'get_sliced_prediction', and 'get_prediction' inserting a new custom parameter. An example is provided in the code 'test_exclude_classes.py'
Copy link
Author

@gguzzy gguzzy left a comment

Choose a reason for hiding this comment

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

The only one thing missing is adding these new parameters into the methods definitions (the comments explaining the parameters, and not adding it to the method as parameter, which has been already done), it is not such a huge issue to deal with. Waiting for your review and approval.

@gguzzy
Copy link
Author

gguzzy commented Dec 21, 2024

I updated the code and workflow also using both black and isort. Waiting for your approval.

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