Ultralytics YOLO27: Join the waitlist.
License YOLO
Ultralytics YOLO

Export a custom-trained Ultralytics YOLOv8 model

Train a custom Ultralytics YOLOv8 object detection model in Google Colab, export the trained weights, and run live webcam inference with a few lines of Python.

Nuvola LadiNuvola Ladi3 min read

Listen to this article

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 blog post, we’ll explore the process of training a custom model, exporting the trained weights, and running live inference on a webcam.

Training a custom object detection model#

In our previous video, we covered training an Ultralytics YOLOv8 model on a custom dataset in Google Colab, using a dataset of cups. We saw the training graph steadily improving, with the loss decreasing and the mean average precision (mAP) increasing. Based on this, our custom 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 step: 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 in batch-processing scenarios.

Exporting and running inference with the trained model#

With the trained model weights downloaded from Colab, we can load them into a Python environment and put our custom model to work.

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. The model identifies cups of various shapes, sizes, and colors, showing how well it handles real-world scenarios.

Fine-tuned 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, export the trained weights, and run live inference on a webcam.

Wrapping up#

From training a custom model to exporting the trained weights and running live inference on a webcam, we've seen how Ultralytics YOLOv8 handles the full workflow.

Ready to try custom object detection yourself? Check out Ultralytics Platform and our docs for more information on all things Ultralytics, and join our community to keep up to date on the latest developments!

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

Written by

Nuvola Ladi
Nuvola Ladi

Digital Content Manager · Ultralytics

Nuvola Ladi is a Digital Content Manager at Ultralytics, where she creates content covering vision AI and Ultralytics YOLO and represents the company at industry events such as the PyTorch Conference 2025. Based in Spain, she holds a Master's degree in Visual and Digital Media from IE University. Before joining Ultralytics, she held roles at organizations including XVA Gallery & Hotel and Rolex.

Comments

Ask a question, share your results, or help someone else.

Explore solutions

Computer vision in sports

Computer vision in sports

Discover how Ultralytics YOLO powers sports vision with player and ball tracking, performance analytics, coaching insights, and athlete rehabilitation.
Learn more
Computer vision for aerial imagery

Computer vision for aerial imagery

Turn drone and aerial imagery into real-time insights for agriculture, aquaculture, conservation, and geospatial analysis with Ultralytics YOLO.
Learn more
Computer vision in aerospace

Computer vision in aerospace

Apply computer vision in aerospace with Ultralytics YOLO for aircraft inspection, runway FOD detection, airport ground operations, and composite defect detection.
Learn more
Computer vision in security

Computer vision in security

Protect every site with Ultralytics YOLO models. Vision AI powers perimeter monitoring, threat detection, license-plate recognition, and workplace safety.
Learn more
Computer vision in robotics

Computer vision 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
Computer vision in logistics

Computer vision in logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.
Learn more
Computer vision in retail

Computer vision in retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.
Learn more
Computer vision in healthcare

Computer vision in healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.
Learn more
Computer vision in manufacturing

Computer vision in manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.
Learn more
Computer vision in automotive

Computer vision 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
Computer vision in agriculture

Computer vision 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