Classification of OK / NOK Bottles
This playbook demonstrates how to classify bottles into two categories: OK (non-defective) and NOK (defective). A classifier analyzes each image and assigns a single label to indicate whether the bottle is defective or non-defective. The model is used in a single inspection pipeline.
The dataset
The dataset contains 63 defective (NOK) and 20 non-defective (OK) bottle images. All images are annotated in LabelMe format; examples are shown below.
.jpg)
Load the annotated dataset
- Request access to ReliVision Learning Center and download the bottle image set and its LabelMe annotation files.
- 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.
Train the classification model
In ReliTrainer, train an AI block for bottle classification. The main steps are:
- Select Classification as the model type.
- Select your annotated bottle dataset.
- 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
- 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 build the pipeline by dragging and dropping AI and basic blocks. For this use case you need an input data source and a classification AI block connected in series.
- Open the pipeline editor.
- Add an input data source and point it at your raw bottle image set.
- Add the classification AI block you trained and connect it after the input.
- 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.
Sample NOK result
.jpg)
Sample OK result
.jpg)
Related User Guide sections
- Import a raw dataset
- Import annotated data
- Whole image annotation
- Training an AI block
- Create and edit a pipeline
Try it yourself
Download ReliVision to run this playbook on your own bottle images, or browse the other use cases.
Download ReliVision