Classify - Ultralytics YOLOv8 Docs #2830
Replies: 16 comments 24 replies
-
Beta Was this translation helpful? Give feedback.
-
I am working primarily with video and a lot of my projects involve things like "is location outside?" "is it inside?" That sort of thing. When I run my script it is detecting those classes in a long stream of frame by frame detections. This is great for testing the quality of the model, but pretty redundant for what I'm hoping to achieve. Is there a way to simplify this to the point of saying that footage was detected outside or inside or both? |
Beta Was this translation helpful? Give feedback.
-
Hello, In classification duty, I want to get output of predicted class that means when I input an image, it can print the predicted class of it. I found there is no attribute of results which names cls. How can I get such output from results? thanks. |
Beta Was this translation helpful? Give feedback.
-
I want to perform Multi "label" classification using YOLOV8 in Python, instead of Multi "class." Could you please explain the configuration of the dataset (①) and the specific coding approach for the network (②)? ① Dataset Configuration: Below is an example of the configuration for Multi "class" as described on the official website. However, in the case of Multi-label classification, there are images that belong to multiple classes. How should I handle such cases? root/ ② Specific Coding Approach for the Network: The following code is provided on the official website, but how should I modify it accordingly? I would like to set the number of model outputs to num_class (number of multi-labels), change the loss to BCE (Binary cross entropy), compute BCE for each output, and take the average of losses for each label. Is that the right way to make these changes, or is there a simpler implementation method? python Load a modelmodel = YOLO('yolov8n-cls.yaml') # build a new model from YAML Train the modelmodel.train(data='mnist160', epochs=100, imgsz=64) |
Beta Was this translation helpful? Give feedback.
-
Hi I trained a classification model with 2 classes and every time a do a prediction I get a sum of the probability even with an image that contains both classes, ie: |
Beta Was this translation helpful? Give feedback.
-
Classification looks like a great inclusion and I am hoping to use it in a project of mine, but I am a little confused by the sample image. The documentation clearly states "The output of an image classifier is a single class label and a confidence score." But the sample image right above has three labels, "Person", "Tripod", and "Safety Vest". Was this image evaluated by three separate classification models? Or perhaps this result was obtained by picking the top 3 results from Probs.top5? Somewhat related, in the documentation for ImageNet ( https://docs.ultralytics.com/datasets/classify/imagenet/#sample-images-and-annotations ), the categories appear to be hierarchical. Thank you, I think Ultralytics classification will work for my project, but knowing the answers will definitely help plan things out |
Beta Was this translation helpful? Give feedback.
-
Hello, could you please tell, metrics in the process on training are metrics on the train or val data?
|
Beta Was this translation helpful? Give feedback.
-
Hi.. @glenn-jocher, Can you please explain the architecture different between YOLO version 8 object detection nano model and YOLO version 8 image classification nano model ? |
Beta Was this translation helpful? Give feedback.
-
Hey Glen,i have trained yolov8 classification model and i am performing predictions with this code from ultralytics import YOLO Load a pretrained YOLOv8n modelmodel = YOLO('weight.pt of custom trained yolov8 classification model') Define path to directory containing images and videos for inferencesource = 'path to directory' Run inference on the sourceresults = model(source,stream=False) My results are in this format |
Beta Was this translation helpful? Give feedback.
-
i tried running this train.py for the classify model |
Beta Was this translation helpful? Give feedback.
-
hello ,in classify duty,when I run the validate code |
Beta Was this translation helpful? Give feedback.
-
How to set image classification to one result and then output the result to txt file |
Beta Was this translation helpful? Give feedback.
-
I organize folders with images for 2 classes classification in next way: So, there are 4 sub-folders for single dataset I divided for training. |
Beta Was this translation helpful? Give feedback.
-
I trained a model with my windows11 laptop but I can not use that module for my classification work in my raspberry pi4, is there any exception? |
Beta Was this translation helpful? Give feedback.
-
hello,I wanted to ask about my approach for product detection on shelves. I used the YOLOv8s-cls.pt model for training on a custom dataset containing photos of Product 1 and Product 2 without backgrounds of course with good structer of the dataset like it's mentioned in the docs. and for the detection i've used yoloworld i cropped the detected product and send it into yolov8-cls model |
Beta Was this translation helpful? Give feedback.
-
Hey @glenn-jocher thnx for your response , i've another question , I'm working on training a classification model to distinguish between different sizes of the same product, like Coca-Cola in 1L and 50cl bottles. I'm seeking guidance on structuring my dataset effectively to train the model accurately. Questions: 1-How should I organize my dataset to train a classification model for distinguishing between different product sizes? |
Beta Was this translation helpful? Give feedback.
-
Classify - Ultralytics YOLOv8 Docs
Check YOLO class label with only one class for the whole image, using image classification. Get strategies for training and validation models.
https://docs.ultralytics.com/tasks/classify/
Beta Was this translation helpful? Give feedback.
All reactions