Skip to content

Model Training: Find Missing Pieces in Circuit Boards

Overview

In this tutorial, you will set up all necessary components and train an AI model to detect missing components on printed circuit boards (PCBs).

Estimated time

60–75 minutes.

What you'll learn

  • Prepare and upload image datasets for training and validation.
  • Add and manage annotations for object detection tasks.
  • Configure a model training workspace and problem.
  • Train an object detection model using a predefined architecture.

What you'll build

By the end of this tutorial, you'll have a trained object detection model capable of identifying missing components on PCB images. This model can later be deployed and integrated into inspection workflows.

An example showing defective printed circuit boards annotated with bounding boxes.
An example showing defective printed circuit boards annotated with bounding boxes.

Prerequisites

To complete this tutorial, you will need the following:

To complete this tutorial, you need the platformadmin role. If you don't have this role, you cannot access model training.

Step 1: Create a Training and Validation Dataset

In the Hub, go to the Dataset tab and create two image datasets using the files from the prerequisites section. Name the first dataset PCB Train (PCB_train_1920x1080_dataset.zip) and the second dataset PCB Val (PCB_val_1920x1080_dataset.zip). If you don't know how to create a dataset, go to Create an Image Dataset and then come back.

Step 2: Add Annotations to Your Datasets

To train a model, you also need to provide annotations.

  1. Click the Add Annotations button next to Upload files.
  2. Name it Train annotations, choose Object Detection from the Annotation type menu, and drag and drop the provided training annotations file (PCB_train_1920x1080_annotations.xml).
  3. Click Upload.
Add annotations pop up window.
Add annotations pop up window.
  1. Repeat the process for the validation dataset using the corresponding annotation file and name.

Step 3: Create a Model Training Workspace

In the left navigation, switch from the Datasets tab to the Model Training tab.

Empty workspaces.
Empty workspaces.
  1. Click Create Workspace in the top right.
  2. In the Create New Model Training Workspace popup:
    • Name it My First Project.
    • Enter documentation in the customer field.
    • Optionally add a description.
  3. Click Create.
Workspace pop up window.
Workspace pop up window.

Step 4: Create a Problem

Within a workspace, you can define multiple problems.

  1. In the header of My First Project, click Create Problem.
  2. In the popup: Name the problem PCB Missing Components.
  3. Click Create.

Step 5: Prepare Training Configuration

You will now configure the training using the stepper interface. Follow the instructions for each step and proceed using the Next button.

  1. Basic configuration
    • Name: PCB object detection.
    • Problem Type: Object Detection.
    • Model Architecture: Faster R-CNN.
Stepper 1.
Stepper 1.
  1. Datasets and annotations
    • Training dataset: PCB Train.
    • Training annotations: Train annotations.
    • Validation dataset: PCB Val.
    • Validation annotations: corresponding validation annotations.
Stepper 2.
Stepper 2.
  1. Preprocessing
    • Set image resolution to 1440x810 to reduce computational load.
Stepper 3.
Stepper 3.
  1. Data augmentation

    • Add Random Color Adjustment augmentation.
    • Keep the default settings.

💡 Augmentaions improve robustness.

Training works also without the Random Color Adjustment augmentation, but adding it improves robustness, especially to lighting changes and small color variations between boards.

Stepper 4.
Stepper 4.
  1. Training configuration
    • Open Object detection training configuration.
    • Set Number of epochs to 50.
    • Leave all other settings as default.
Stepper 5.
Stepper 5.
  1. Start training
    • Click Start Training.
    • Monitor the live training metrics.
Stepper 6.
Stepper 6.

Now you have completed model training.

The best model is from epoch 23, achieving 0.787 mAP50 on the validation set. This is a solid result, it shows the model learned real patterns in PCB boards and their defects. The detections are not random, although the model may still make some mistakes such as false positives or false negatives.
The best model is from epoch 23, achieving 0.787 mAP50 on the validation set. This is a solid result, it shows the model learned real patterns in PCB boards and their defects. The detections are not random, although the model may still make some mistakes such as false positives or false negatives.

⚠️ Training results may vary.

Training is not fully deterministic due to data ordering, augmentation, and slight variations in numeric operations. This can change exact mAP values, but overall results remain consistent.

Next steps

Now that you've completed this tutorial, you can learn how to: