-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Specify the class for detection on pre-trained YOLOv8 #982
Comments
from ultralytics import YOLO
model = YOLO(f"yolov8n.pt")
model.predict(source="ultralytics/assets/", save=True, classes=[0,1]) |
@Laughing-q hi from Chengdu, |
where this code replace on yolov8? |
I'm Running this code from vscode how to select Specify class? |
@kosongdansatu to select specific classes while using YOLOv8 in Visual Studio Code, you can add the "classes" parameter to the Here's an example code snippet: from ultralytics import YOLO
model = YOLO("yolov8.pt")
# Detect objects from classes 0 and 1 only
classes = [0, 1]
# Set the confidence threshold
conf_thresh = 0.5
# Set the source of the input data (e.g., image file, video file, or folder containing images)
source = "path/to/your/data"
# Call the predict function with the specified parameters
results = model.predict(source=source, save=True, classes=classes, conf=conf_thresh) Please note that you need to replace "path/to/your/data" with the actual path to your data. Additionally, you can adjust the value of the "conf_thresh" parameter to modify the sensitivity of the model. |
thank you soo much glenn |
@kosongdansatu you're welcome! If you have any further questions or concerns about YOLOv8, don't hesitate to ask. We're always here to help. |
Search before asking
Question
I wanted to use the yolov8 pre-trained model to detect only certain classes, not all the classes on which the model is trained.
I know we can do this on yolov5 to specify the class. I couldn't do the same with yolov8.
Is there something similar for YOLOv8?
Additional
No response
The text was updated successfully, but these errors were encountered: