Trained a Custom YoloV11 OBB Model with Custom Dataset, But Getting No Detections #18197
-
Environment
DatasetObject detection dataset was created using cvat. The dataset consists of Keurig images and the labeled objects are the buttons on the coffee machine. I modified the data.yaml to fit the YoloV11 data formatting. The dataset has the following structure:
data.yaml has the following contents Train: Train.txt
names:
0: 4oz
1: 6oz
2: 8oz
3: 10oz
4: 12oz
5: strong
6: iced
7: hot
8: add_water
9: descale
10: handle
11: water bin
12: power
path: .
train: images/train
val: images/val Example of what the labeled contents will have: 4 0.590707 0.701204 0.687732 0.701204 0.687732 0.756579 0.590707 0.756579
9 0.524006 0.534504 0.633152 0.534504 0.633152 0.575587 0.524006 0.575587
8 0.365464 0.542247 0.508409 0.542247 0.508409 0.588087 0.365464 0.588087
5 0.359874 0.598838 0.511762 0.586760 0.519713 0.633986 0.367825 0.646064
7 0.509094 0.587168 0.660982 0.575090 0.668933 0.622316 0.517045 0.634393
0 0.426112 0.659534 0.511870 0.659534 0.511870 0.704180 0.426112 0.704180
1 0.537865 0.648219 0.611502 0.648219 0.611502 0.698229 0.537865 0.698229
2 0.385390 0.716093 0.473756 0.716093 0.473756 0.772652 0.385390 0.772652
3 0.486745 0.709545 0.576848 0.709545 0.576848 0.763725 0.486745 0.763725
6 0.642680 0.636316 0.712857 0.636316 0.712857 0.685132 0.642680 0.685132
12 0.428351 0.364767 0.510677 0.364767 0.510677 0.417925 0.428351 0.417925 CodeThis is the code I used to train my custom YoloV11 OBB model with my custom dataset import cv2
from ultralytics import YOLO
model = YOLO("yolo11n.yaml")
model.train(data="<path_to_datasets>/datasets/v19/data.yaml", epochs=10, imgsz=640)
model = YOLO("/home/ncbernar/.pyenv/runs/detect/train5/weights/best.pt")
results = model("<path_to_keurig_image>/keurig.png")
for r in results:
im_array = r.plot() # plot a BGR numpy array of predictions
im = cv2.cvtColor(im_array, cv2.COLOR_BGR2RGB) # convert to RGB for display
cv2.imshow("Detection Results", im)
cv2.waitKey(0) # wait for a key press to close the window
cv2.destroyAllWindows() After results is collected, I get the following message:
To reproduce this issue, please use the following dataset from here. ProblemAs shown above, results tells me that the model was unable to detect any of the objects, even though the labels and images were provided as part of the dataset. One example of what the labeled image looks like is below: But after I feed the model an image for inference, I get the following result with no bounding boxes: DiscussionBasically, I expected the model to be able to detect the obejcts, or buttons, in the image. It acknowledged the dataset and labels, but still no sign of the bounding boxes being shown on the resulting image. Any reason for why this happens? I suspect that my dataset may not be correctly formatted for the OBB model, but it could be a different issue. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
👋 Hello @BeaverBytes, thank you for sharing details about your custom training experience with Ultralytics 🚀! We understand the effort you’ve put into setting up your custom YoloV11 Object Bounding Box (OBB) model, and we’re here to help. While we review your discussion, here are a few suggestions that might help you identify the issue: If this is a 🐛 Bug Report, please make sure to provide a minimum reproducible example (MRE), including a representative data sample and code snippet to allow us to replicate the issue on our end. If your provided example includes all necessary information, thank you! If this is a custom training ❓ Question, it's important to ensure your dataset adheres to YOLO OBB label formatting and that you're following our Tips for Best Training Results. Since OBBs require a specific annotation format, double-check that all bounding box corners are correctly defined in your label files. Docs and Community Resources
Verify Installation and DependenciesPlease ensure you're running the latest version of pip install -U ultralytics Additionally, confirm that your system and Python packages match the required versions specified in the requirements file. EnvironmentsTest your training and inference setup on validated environments to ensure consistency:
Training Suggestions and Debugging Checklist
StatusOur Continuous Integration (CI) tests verify the latest commit’s functionality on macOS, Windows, and Ubuntu. Check the project's current CI status: This is an automated response to get you started 😊. An Ultralytics engineer will review your question and provide additional help soon! |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
yolo11n.yaml
trains a normal detection model, not OBB. And start training from "yolo11n-obb.pt" not yaml. https://docs.ultralytics.com/tasks/obb/