pose-detection

Train YOLOv8 pose/keypoint detection model on your own data

May 11, 2023
10

Keypoint detection is a crucial aspect of computer vision applications, empowering tasks such as human pose estimation and robotic manipulation. In this tutorial, we will guide you through the process of training a custom keypoint detection model using the Ultralytics YOLOv8-pose model and the trainYOLO platform. Specifically, we will train a model to detect whiteboard markers, with separate keypoints for the top and bottom positions. From labeling your dataset to utilizing model-assisted labeling, we'll cover each step to help you build an accurate keypoint detector. Let's get started!

Step 1: Create a New Project

Begin by creating a new project on the trainYOLO platform. Sign in to your trainYOLO account or create a free account here if you don't have one. Click on the green 'plus' icon and set the project visibility to either Public or Private, depending on your preference. For this example, we name the project "Whiteboard Markers" and select the annotation type Keypoints. We add a single object category "Marker" and include two keypoint categories: "Top" and "Bottom."

Step 2: Upload Your Images

Navigate to the data tab within your project and click on the green 'plus' icon to upload your images. Select the images you want to use for training, we will upload 123 images of whiteboard markers in various configurations, and click upload. Keep in mind that for more complex use cases, a larger number of images might be necessary to train an optimal model.

Step 3: Label Your Images

Once your images are uploaded, proceed to label each image. By clicking on an image you enter the labeling editor. Use the box tool from the left menu to label each object (in our case each marker) accurately. Before drawing a bounding box, ensure that the correct object category is selected on top, and draw a box around the object by clicking once on the upper-left corner and once on the lower-right corner. Next, label each keypoint by clicking on the corresponding spot. Use the arrow keys or the carousel at the bottom to navigate between images and label them accordingly.

Step 4: Train the YOLOv8 Model

After labeling a sufficient number of images, it's time to train your custom YOLOv8 keypoint detection model. For simplicity, we will use the preconfigured Google Colab notebooks provided by trainYOLO. Therefore, go to the model's tab in your project and select the YOLOv8 notebook by clicking the green 'plus' icon. This notebook comes preconfigured with the necessary settings. Fill in your API key (available by clicking on your avatar) and project name. Leave the other parameters as default, then start the training session by clicking "Runtime" and selecting "Run all." The notebook will download your dataset, train the model, and upload the trained model to your project, providing you with a custom keypoint detection model in no time.

Once your model is trained, you can refresh your model’s page, and you should see your newly trained model in the list. From here, you can improve your model by labeling more images, or training with other hyperparameters.

For our example, we got the following metrics:

Step 5: Model-Assisted Labeling

Utilize the power of model-assisted labeling to speed up your labeling. Whenever a new model version is added to your project, it automatically becomes a labeling assistant. Rather than labeling each image from scratch, you can now verify or correct the model predictions. This significantly speeds up the labeling process. Access the labeling assistant by clicking on the magic paintbrush icon in the left menu. It will load the model predictions, From here, you can remove false-positive detections, and modify wrongly placed keypoints. To change a keypoint position, first click on the bounding box to select the object, and next you can simply drag the point to the desired location.

Next Steps:

Once you have labeled more images, you can train more versions and experiment with hyperparameters like image size and model type to optimize your keypoint detection model. Have fun training models!

Latest posts

Get in touch.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. View our Privacy Policy for more information.