Detection and Classification of Characters on Metal Plates
This playbook demonstrates how to detect the alphanumeric characters A, F, 2, and 1 on metal plates and classify each detected character as OK or NOK. A detector first identifies the characters, followed by a classifier that assigns each character to the appropriate category. Both models are combined into a single inspection pipeline.
The dataset
The dataset contains 50 plates. Each character is labelled OK or NOK depending on whether it has a defect; good characters are shown in green boxes and defective ones in red below.
.jpg)
Load the annotated dataset
- Request access to ReliVision Learning Center and download the annotated dataset (LabelMe format).
- In ReliUI, import the image set with Import Data.
- Import the annotation file for each image folder with Import Annotated Dataset, choosing the LabelMe annotation format.
- Your annotated dataset is now available in the Gallery.
.jpg)
Train the character detector
The detector finds every character on the plate, whatever its state, and outputs a bounding box.
Prepare the training data
- Make a copy of the annotated dataset for detector training.
- Merge all character labels into a single class called Character.
Train the model
- In ReliTrainer, select Object Detection as the model type.
- Select the character detector training dataset you prepared.
- Split the data into train and test sets, automatically or manually, to hold back some data for validation.
- Set the hyperparameters and start training.
Hyperparameters used in this use case
- Epochs: 20
- X-Y resolution: 704 (default)
- Learning rate: 0.0001 (default)
- Momentum: 0.937 (default)
- Weight decay: 0.0005
.jpg)
Train the character classifier
The classifier looks at one cropped character at a time and labels it OK or NOK.
Prepare the training data
- Extract the rectangle annotations with the ReliUI data curation functions, so each character becomes its own image.
- Keep the OK and NOK labels on the extracted images — this is your classification dataset.
Train the model
- In ReliTrainer, select Classification as the model type.
- Select the character classifier training dataset you prepared.
- Split the data into train and test sets, automatically or manually, to hold back some data for validation.
- Set the hyperparameters and start training.
Hyperparameters used in this use case
- Epochs: 300 (default)
- X-Y resolution: 224 (default)
- Learning rate: 0.0001 (default)
- Momentum: 0.99 (default)
- Weight decay: 0.0005 (default)
.jpg)
Build and run the pipeline
Use the pipeline editor to chain the two models. The character detector finds each character and outputs a bounding box; the character classifier receives each cropped detection and decides whether it is OK or NOK. No basic (image-processing) blocks are needed.
- Open the pipeline editor.
- Add an input data source and point it at your raw metal plate image set.
- Add the character detector AI block and connect it after the input.
- Add the character classifier AI block and connect it after the detector.
- Add an Output Imageset or End Branch block, depending on the desired output: generate an Imageset file from the executed pipeline or proceed to the audit stage.
- Run the pipeline with the execute button at the top.
.jpg)
Review the results
Review the results in the ReliUI data annotation interface. The pipeline saves its outputs as a separate set of annotations for each image it runs on, so you can compare predictions against your labels image by image.
.jpg)
Related User Guide sections
- Import annotated data
- ROI annotation
- Extract ROIs
- Merge and download datasets
- Training an AI block
- Create and edit a pipeline
Try it yourself
Download ReliVision to run this playbook on your own metal plate images, or browse the other use cases.
Download ReliVision