Model training fits a model to prepared data. In a production ML system, the training process also needs to be reproducible, modular, and connected to data preparation and validation. A notebook can support experimentation, but a versioned pipeline component can run consistently across environments and retain the evidence needed to assess each run. section 1.1.1 section 8.1
For an ID card detector, the training component has three responsibilities:
- Download training, validation, and test images with their labels, then configure the dataset paths and splits. section 8.1
- Initialize a pretrained YOLO model and run training with a dataset configuration, image size, epoch count, and batch size. section 8.1.2
- Save weights, plots, and sample inferences in a project directory so training progress and validation results can be inspected. section 8.1.2
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
The Ultralytics example initializes `yolov8n.pt` and calls `model.train` with `custom_data.yaml`. The pipeline supplies `epochs` and `batch`; `project_path` collects the resulting artifacts. section 8.1.2
Choose settings against three constraints: training time, available compute, and required performance. Image size affects memory use and training time; batch size and model architecture also need to fit the available resources. Prefer defaults that work reliably in the pipeline over manual tuning that is difficult to repeat. section 8.1.2
The same pattern with structured data
A movie recommender starts from prepared Parquet data divided into training, test, and validation splits. Its components check incoming data quality, train and validate a model, and use MLflow to log experiments and track model versions. The training infrastructure carries over even though the task and artifacts differ from object detection. section 9.3
Training is not the end of the loop. If evaluation metrics fall short, revisit the architecture or the quality and quantity of the data; a problem found during training may require returning to data preparation. Orchestration makes those repeated runs easier to automate and trace. section 1.1.1























