Skip to content

Detect particular class #818

Answered by fcakyon
Cutinho007 asked this question in Q&A
Jan 19, 2023 · 2 comments · 3 replies
Discussion options

You must be logged in to vote

@Cutinho007 this should work:

import yolov5
from sahi import AutoDetectionModel

model = yolov5.load('custom_model.pt")
model.classes = [0, 15, 16]

sahi_model = AutoDetectionModel(
    model_type='yolov5',
    model=model,
)

# use `sahi_model` with `get_prediction` or `get_sliced_prediction`

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@Cutinho007
Comment options

@nakuda1
Comment options

@nakuda1
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by fcakyon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants