Meet YOLO26: next-gen vision AI.
Ultralytics
Ultralytics YOLO

Export a custom-trained Ultralytics YOLOv8 model

Explore custom object detection with Ultralytics YOLOv8! Learn how to train, export, and run live inference on a webcam!

NUNuvola Ladi
2 min read
Exporting a custom-trained Ultralytics YOLOv8 model for inference

Join us as we take a closer look at custom object detection with Ultralytics YOLOv8. In this blogpost, we’ll explore the intricate process of training a custom model, exporting the trained weights, and running live inference on a webcam.

Link to this sectionTraining a custom object detection model#

In our previous video, we delved into the realm of training a YOLOv8 model on a custom cups dataset in Google Colab. We saw the training graph steadily improving, with the loss decreasing and the mean average precision (mAP) increasing. Based on this, our special model can now identify five different types of cups very accurately.

With our custom model trained and ready to go, it's time to explore the next frontier—exporting the trained weights and running live inference on a webcam.

Model inference is the process of using a trained computer vision model to make predictions or decisions based on new, unseen data. It is when the model uses input data, such as an image, and processes it through its learned parameters and structure. The model then produces an output, such as classification, detection, or segmentation, based on its training task.

In practical terms, inference often involves deploying the trained model into a production environment where it can be used to process real-world data in real-time or batch-processing scenarios.

Link to this sectionExporting and running inference with the trained model#

With trained model weights downloaded from Colab, we can seamlessly import them into a Python environment, ready to unleash the full potential of our custom model.

Using a few lines of code, we can set up a Python script to run live inference on a webcam, capturing real-time footage and detecting different cups with impressive accuracy. The power of YOLOv8 shines through as our model effortlessly identifies cups of various shapes, sizes, and colors, showcasing its versatility and reliability in real-world scenarios.

Fine-tuning models offer several benefits. They can detect, segment, or classify objects that pretrained models may not support. Additionally, they can assist researchers or data scientists in understanding how model architecture performs on real-world datasets.

Nicolai Nielsen outlining custom model training, export, and webcam inference

Fig 1. Nicolai Nielsen outlining how to train a custom model, exporting the trained weights, and running live inference on a webcam.

Link to this sectionWrapping up#

From training a custom model to exporting the trained weights and running live inference on a webcam, we've witnessed the power and versatility of YOLOv8 firsthand.

Join us in our quest to unlock the full potential of custom object detection with Ultralytics YOLOv8. Together, let's shape the future of AI one detection at a time. Check out Ultralytics Platform, and our docs for further information on all things Ultralytics as well as join our community to keep up to date on the latest developments!

If you’re curious about exporting custom trained YOLOv8 models and running inference on webcam, watch the full video Watch the full video!

Explore solutions

Real-time defect detection with Ultralytics YOLO

Defect Detection

YOLO-based vision AI detects defects in steel, PCBs, fabric, solar panels, and welds, with peer-reviewed accuracy up to 99.4% and up to 94.5% lower inspection cost.
Learn more
Real-time AI that works with your team

AI in Robotics

Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.
Learn more
Real-time AI that works with your team

AI in Logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.
Learn more
Real-time AI that works with your team

AI in Retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.
Learn more
Real-time AI that works with your team

AI in Healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.
Learn more
Real-time AI that works with your team

AI in Manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.
Learn more
Real-time AI that works with your operation

AI in Automotive

Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.
Learn more
Real-time AI tailored to your operation

AI in Agriculture

Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.
Learn more
Real-time defect detection with Ultralytics YOLO

Defect Detection

YOLO-based vision AI detects defects in steel, PCBs, fabric, solar panels, and welds, with peer-reviewed accuracy up to 99.4% and up to 94.5% lower inspection cost.
Learn more
Real-time AI that works with your team

AI in Robotics

Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.
Learn more
Real-time AI that works with your team

AI in Logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.
Learn more
Real-time AI that works with your team

AI in Retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.
Learn more
Real-time AI that works with your team

AI in Healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.
Learn more
Real-time AI that works with your team

AI in Manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.
Learn more
Real-time AI that works with your operation

AI in Automotive

Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.
Learn more
Real-time AI tailored to your operation

AI in Agriculture

Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.
Learn more
Real-time defect detection with Ultralytics YOLO

Defect Detection

YOLO-based vision AI detects defects in steel, PCBs, fabric, solar panels, and welds, with peer-reviewed accuracy up to 99.4% and up to 94.5% lower inspection cost.
Learn more
Real-time AI that works with your team

AI in Robotics

Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.
Learn more
Real-time AI that works with your team

AI in Logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.
Learn more
Real-time AI that works with your team

AI in Retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.
Learn more
Real-time AI that works with your team

AI in Healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.
Learn more
Real-time AI that works with your team

AI in Manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.
Learn more
Real-time AI that works with your operation

AI in Automotive

Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.
Learn more
Real-time AI tailored to your operation

AI in Agriculture

Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.
Learn more

Let's build the future of AI together!

Begin your journey with the future of machine learning