Open WYL-Projects opened 5 months ago
👋 Hello @WYL-Projects, thank you for your interest in Ultralytics YOLOv8 🚀! We recommend a visit to the Docs for new users where you can find many Python and CLI usage examples and where many of the most common questions may already be answered.
If this is a 🐛 Bug Report, please provide a minimum reproducible example to help us debug it.
If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our Tips for Best Training Results.
Join the vibrant Ultralytics Discord 🎧 community for real-time conversations and collaborations. This platform offers a perfect space to inquire, showcase your work, and connect with fellow Ultralytics users.
Pip install the ultralytics
package including all requirements in a Python>=3.8 environment with PyTorch>=1.8.
pip install ultralytics
YOLOv8 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
If this badge is green, all Ultralytics CI tests are currently passing. CI tests verify correct operation of all YOLOv8 Modes and Tasks on macOS, Windows, and Ubuntu every 24 hours and on every commit.
@WYL-Projects hello,
Thank you for your question and for checking the existing issues and discussions before posting! 😊
Yes, YOLOv8-Pose can indeed be adapted to detect keypoints for multiple object types, such as license plates and faces, simultaneously. To achieve this, you need to ensure that your dataset is annotated correctly and that the model is configured to handle multiple keypoint sets.
Here's a high-level overview of how you can set this up:
Dataset Preparation:
Dataset YAML Configuration:
Here’s an example configuration for your case:
path: ../datasets/custom-pose # dataset root dir
train: images/train # train images (relative to 'path')
val: images/val # val images (relative to 'path')
test: # test images (optional)
# Keypoints
kpt_shape: [5, 3] # number of keypoints, number of dims (2 for x,y or 3 for x,y,visible)
flip_idx: [] # if applicable
# Classes dictionary
names:
0: license_plate
1: face
Training the Model:
Use the following code to train your model with the custom dataset:
from ultralytics import YOLO
# Load a pretrained YOLOv8-Pose model
model = YOLO("yolov8n-pose.pt")
# Train the model on your custom dataset
results = model.train(data="path/to/your/custom-pose.yaml", epochs=100, imgsz=640)
By following these steps, you can train a YOLOv8-Pose model to detect keypoints for both license plates and faces simultaneously. If you encounter any issues or need further assistance, please provide a reproducible example of your setup, as it will help us diagnose and address your issue more effectively. You can find more information on creating a minimum reproducible example here.
Feel free to reach out if you have any more questions. Happy training!
@glenn-jocher hello I have a question. If there are multiple categories and the keypoints for each category are different, there should be a problem with the "kpt_shape: [5,3]" written in your YAML above. Not all categories have a keypoint of 5,Is it written directly based on the highest number of keypoints? Do data with different keypoints like this need special processing in training labels,Looking forward to your answer
Hello @sc-huipu-pc,
You're correct that the kpt_shape
parameter should reflect the highest number of keypoints among all categories. If different categories have varying numbers of keypoints, you should set kpt_shape
to the maximum number of keypoints. For categories with fewer keypoints, you can pad the remaining keypoints with zeros or a specific value to maintain consistency in the label format. This ensures that the model can handle varying keypoint counts during training.
If you encounter any issues or need further assistance, please let us know.
Search before asking
Question
Dear author, I have a small question, can YOLOv8-Pose be used for both license plate keypoints and face keypoints detection at the same time, say four keypoints for license plate and five keypoints for face.
Additional
No response