liveBook · Manning

YOLOv8

As explained in Machine Learning Platform Engineering

YOLOv8n is the nano-sized YOLOv8 model variant designed to reduce computation and memory requirements.

YOLOv8 is used here to train a custom object detector for ID cards. Start by making the dataset usable by Ultralytics YOLO, then train a pretrained model against that dataset. For a first run, YOLOv8n—the Nano variant—reduces compute and memory demands, making it useful for testing feasibility on limited hardware. section 7.3.1 section 8.1.2

Listing 7.9 Configuration training YOLOv8 with a custom dataset
path: /home/jovyan/data/
train: "train/images"
val: "val/images"
test: "test/images"
names:
  0: id_card

The dataset YAML gives YOLOv8 a root path, image locations for training, validation, and test, and the zero-indexed class name. Each split also needs a corresponding labels directory; an image and its label share a filename stem. section 7.3.1

Listing 8.3 Writing the data configuration to YAML
from ultralytics import YOLO

model = YOLO('yolov8n.pt') #1
results = model.train( #2
    data='custom_data.yaml',
    imgsz=640,
    epochs=epochs,
    batch=batch,
    name='yolov8n_custom',
    project=project_path) #3

Load the pretrained Nano weights with `YOLO('yolov8n.pt')`, then pass the dataset YAML, image size, epochs, batch size, run name, and artifact directory to `model.train()`. In a Kubeflow component, the project path collects weights and evaluation artifacts. section 8.1.2

Check the operational trade-offs before running training:

  • Keep images and labels paired when preparing the three dataset splits; a different folder or naming convention calls for checking the relevant format documentation. section 7.3.1
  • Choose model size for the deployment constraint: smaller YOLOv8 models favor speed and memory use, while larger ones can improve accuracy at greater computational cost. section 8.1.2
  • Set epochs, batch size, and image size with available compute and memory in mind. Inspect saved inference samples, confusion matrices, and precision and recall curves as training progresses. section 8.1.2

How Machine Learning Platform Engineering covers it

How deep it goes
Works through dataset layout, a training call, parameter choices, and saved artifacts; does not unpack model internals.
Examples
Uses an ID-card class, a custom-dataset YAML, a YOLOv8n training call, and surveillance-camera versus self-driving-car deployment choices.
What it assumes
Introduces the required YOLO dataset layout while using Python-based Kubeflow components and an Ultralytics training call.
What you can do after
Apply it via Ultralytics YOLO to train YOLOv8n on a configured custom dataset and inspect saved training artifacts.
How it connects
Links object detection with dataset splits, Kubeflow Pipelines, model selection, and training artifacts.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning Platform Engineering. The section links point to the parts of the book it draws on.