Exclude classes from inference using pretrained or custom models #1104
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.