Skip to content

Commit 9320c73

Browse files
authored
Update predict.md (#1125)
1 parent 1240bab commit 9320c73

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

docs/predict.md

+28
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,31 @@ result = predict(
6969
)
7070

7171
```
72+
73+
- Exclude custom classes on inference:
74+
75+
```python
76+
from sahi.predict import get_sliced_prediction
77+
from sahi import AutoDetectionModel
78+
79+
# init a model
80+
detection_model = AutoDetectionModel.from_pretrained(...)
81+
82+
# define the class names to exclude from custom model inference
83+
exclude_classes_by_name = ["car"]
84+
85+
# or exclude classes by its custom id
86+
exclude_classes_by_id = [0]
87+
88+
result = get_sliced_prediction(
89+
image,
90+
detection_model,
91+
slice_height = 256,
92+
slice_width = 256,
93+
overlap_height_ratio = 0.2,
94+
overlap_width_ratio = 0.2,
95+
exclude_classes_by_name = exclude_classes_by_name
96+
# exclude_classes_by_id = exclude_classes_by_id
97+
)
98+
99+
```

0 commit comments

Comments
 (0)