tasks/classify/ #7960
Replies: 33 comments 113 replies
-
I have a pretrained model that can do detection and segmentation with my custom dataset, Can the model continue be trained for classification purpose, and predicts by passing the |
Beta Was this translation helpful? Give feedback.
-
I think you need to modify the dataset structure to be compatible with Detection as @pderrenger stated and might need to use |
Beta Was this translation helpful? Give feedback.
-
i want solo object detection code for video then want to merge my object half identification code status = False
|
Beta Was this translation helpful? Give feedback.
-
I trained a yolov8-l classification model where I was perform classification on some images, few months back it was working perfectly fine, was classifying accurately, but few days ago, when I ran the model again on an image I got an error, something like this This is the code, where I am loading a trained model .pt file from ultralytics import YOLO model = YOLO('/content/drive/MyDrive/best.pt') And Getting error like this: AttributeError Traceback (most recent call last) 9 frames AttributeError: shape Cant figure out this error, Kindly If anyone could help with this. |
Beta Was this translation helpful? Give feedback.
-
i have 73 bad images and 4000 good images, can yolov8 work for this or not (For classification problem), if yes , then what i will do ? |
Beta Was this translation helpful? Give feedback.
-
What are the main differences in the model architecture of Classify and Detect? |
Beta Was this translation helpful? Give feedback.
-
Hi there! TL;DR - After debug into train.py & predict.py, realized the images are resized + cropped strangely from what I gathered in the docs/forums, even with specified imgsz and rect=True. Full explanation - Training was : Expectations : (Even when I tried to do imgsz as a tuple - (h,w) aka (292,1216), a warning showed up, telling me the imgsz will be automatically selected to 1216, as it should have been an integer.. not a tuple.) What actually happened : Meaning, what previously was image of size 1216x292, turned into image of size 5063x1216 (This is due to Resize transformation of pytorch) And its not over - the data taken was only the INNER 1216x1216 - less than 1/4 of the actual data.. (This is due to CenterCrop transformation of pytorch) So, basically, I am asking - Is there a quote from the docs I have missed that said classify must be square sized? Or is there another way (except from padding to 1216x1216 - adding 924 black pixels to the height), to make classify work with rectangular images? Thank you so much, and sorry if I wasnt clear.. hopefully it was. |
Beta Was this translation helpful? Give feedback.
-
Hi, I have identified a small issue in the example provided for training in the classification task, which is 'results = model.train(data='mnist160', epochs=100, imgsz=64)'. The parameter 'imgsz' should actually be 640. |
Beta Was this translation helpful? Give feedback.
-
When I try to train my custom data, it raised Runtime Error
while in my yaml file is
why it did not go into train folder? |
Beta Was this translation helpful? Give feedback.
-
Hello, ı hope your day is going well.
I run this code and ı get max 0.764 acc. I want to improve my acc value. I changed optimizer but it did not improve. What should ı do. Please help me :(( Load a modelmodel = YOLO("yolov8x-cls.pt") # load a pretrained model Train the model and save the resultsresults = model.train(data='/content/data', epochs=200, imgsz=224, scale=0) |
Beta Was this translation helpful? Give feedback.
-
How would i write a custom loss function to be used only during training, and the default loss for validation? I tried this in tasks.py def init_criterion(self):
"""Initialize the loss criterion for the ClassificationModel."""
return v8ClassificationCustomLoss(self) if self.training else v8ClassificationLoss() |
Beta Was this translation helpful? Give feedback.
-
Hello, can a pretrained detection model be modified and applied to a classification task? |
Beta Was this translation helpful? Give feedback.
-
Rewrite: I have an image classification use case where the images could belong to class 1 or class 2, both class 1 and class 2 and neither. What's the best way to setup this classification using ultralytics image classifiers? Currently I have 4 folders class 1, class2, both, neither. Can you provide suggestions? |
Beta Was this translation helpful? Give feedback.
-
Hi, |
Beta Was this translation helpful? Give feedback.
-
I wanted to train a classification model on my custom datset. When i run the code i get this error Traceback (most recent call last):
Could you please tell what mistake im making here? |
Beta Was this translation helpful? Give feedback.
-
Bug description:
0 -1 1 464 ultralytics.nn.modules.conv.Conv [3, 16, 3, 2]
|
Beta Was this translation helpful? Give feedback.
-
Hi, i have trained a classification model on one category, it is about food detection. the model can return the classification result. However, if I pass in random images it will also classify that as the trained category. Is something wrong? Or it is supposed to be like that? |
Beta Was this translation helpful? Give feedback.
-
how to extract classification result? i have 2 classes |
Beta Was this translation helpful? Give feedback.
-
Hi, i have done a classification model. However, i have decided to add some data to one class. i created a new folder specifically for that class data, the new folder contains new data to one of the classes from previous training folder. i want to only train the new data and i used the weights from last training session that was trained on all classes to train this new data. i used the load function to load weights from last session. however, after training, the results only contained the classes from the new data, and when running inference, it always gives me the same class that is that one particular class of the new data, it classified everything the same. why is that? i have already load the weights from previous session. |
Beta Was this translation helpful? Give feedback.
-
Hi! Are there any other Classification Models than YOLOv8-cls series? (e.g. YOLOv5-cls series / v6-cls / so on)? Thank you! |
Beta Was this translation helpful? Give feedback.
-
Hi guys I need some help or an advice. I successfully trained a yolov8 classification model which works randomly perfect! My problem : I need just the detected classname of the image on which I run model.predict on. When I make I get a console output with Information like imagesize and found classes. I need this data/classname to be stored in a variable. Like first class = "classname" Is there a way to achieve this? To I need to store result data in a txt or json format to be able to used for Coding ? I need to separate the classname from the result and store it in a separate variable to compare with another string-variable. Thanks a lot for help and for reading this PS: Have a great day everyone 🙂 |
Beta Was this translation helpful? Give feedback.
-
Hello, regarding the classification task, Load a modelmodel = YOLO("yolov8n-cls.pt") Train the modelresults = model.train(data="path/to/your/dataset", epochs=100, imgsz=640) Load a modelmodel = YOLO("path to best.pt“) # load a custom model Train the modelresults = model.train(data="path/to/your/dataset", epochs=100, imgsz=640) |
Beta Was this translation helpful? Give feedback.
-
Hi, so I try to validate my trained model with exactly the same syntax above model = YOLO("yolov8s-cls.pt") # load a pretrained YOLOv8n classification model metrics = model.val()
|
Beta Was this translation helpful? Give feedback.
-
Hi, |
Beta Was this translation helpful? Give feedback.
-
Is there a version trained on Open Images V7 like yolov8n-oiv7? |
Beta Was this translation helpful? Give feedback.
-
Can yolov11 image classification on human facial expression like happy vs. sad? Thanks. |
Beta Was this translation helpful? Give feedback.
-
Hello YOLO team. Can I know which parts of the image that yolo classification model sees in form of heatmaps? Thanks. I basically want to answer the question why! |
Beta Was this translation helpful? Give feedback.
-
Hello https://i.ibb.co/s3qZxCy/Figure-1.png |
Beta Was this translation helpful? Give feedback.
-
Hello, I keep getting this error when tuning a yolov8-cls classification model with wandb. TensorBoard: model graph visualization added ✅
Traceback (most recent call last): AdditionalEnvironment information: Basic code: !pip install -U ultralytics from ultralytics import YOLO wandb.agent(sweep_id, train, count=10). |
Beta Was this translation helpful? Give feedback.
-
I have an issue when exporting with batch
After that, I am trying to run a sample code that is generated when exporting the model
But it crashed.
I want to know what is a solution to fix it ??? |
Beta Was this translation helpful? Give feedback.
-
tasks/classify/
Learn about YOLOv8 Classify models for image classification. Get detailed information on List of Pretrained Models & how to Train, Validate, Predict & Export models.
https://docs.ultralytics.com/tasks/classify/
Beta Was this translation helpful? Give feedback.
All reactions