Thursday, October 3, 2024

More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages

DIY: Factory Assembly Inspection Using AI-based Quality Control Camera

Inspecting and controlling the quality of a product is a tedious task when done manually. It requires proper hand-eye coordination, which can get tiring after long durations, leading to serious errors and thus affecting the accuracy of the process.

So to solve this issue and make the process more reliable, today you will learn to make an AI-based Quality Control Camera with which you can create an ML model to detect the fault in parts/product manufacturing defects in a factory assembly line. The camera uses an SBC board that runs the pre-trained model for monitoring purposes.

AI-based Quality Control Camera
Fig 1 Author’s Prototype for Factory Assembly Inspection Using AI-based Quality Control Camera
AI-based Quality Control Monitoring
AI-based Quality Control Monitoring

Bill of Materials 

Begin with shopping of the following components. 

- Advertisement -
DIY AI-based Quality Control Camera Components
AI-based Quality Control Camera BoM

Feeding Datasets 

To create the ML model, you can use various platforms like TensorFlow, Google’s Teachable Machine, Lobe, Edge Impulse, etc. Because Edge Impulse is used here, below are the commands for installing it:

curl -sL https://deb.nodesource.com/setup_12.x | sudo bash -
sudo apt install -y gcc g++ make build-essential nodejs sox gstreamer1.0-tools gstreamer1.0-plugins-good gstreamer1.0-plugins-base gstreamer1.0-plugins-base-apps
npm config set user root && sudo npm install edge-impulse-linux -g --unsafe-perm

After installation, run the Edge Impulse using the following command in the terminal: 

- Advertisement -
Edge-impulse-linux

You will then see a login screen to start Edge Impulse from the web GUI. Upon login, you will be asked to select the project to connect with. The project name and its URL is then given so that you can start feeding the dataset for training and testing the ML model. 

If you have connected the RPi camera to the Raspberry Pi board, then you can view the camera video output upon opening the link. Now assemble the correct objects or parts in front of the camera and label them. Make sure to feed the dataset. 

Repeat the same process and feed the images of parts with manufacturing defects. Here I have used Lego parts to train and test. 

Edge Impulse Linux
Fig 3. Connecting to Impulse
Setting up AI-based Quality Control Camera
Fig 4.
Edge Impulse Camera
Fig 5. Feeding Dataset

Training ML Model 

Next, go to the Train menu. Select the image for processing and Keras for learning. 

Then create the feature and parameter for the ML model to learn. After getting the option to add layers for neutral networks and SSD mobile net model, use the SSD mobile net v2 model to train and test the ML model. After getting the option to tune the model, we select the board; here i.e. RPI 4, and use the model. 

Edge Impulse Setup

Edge Impulse for AI-based Quality Control Camera

Edge Impulse EON Tuner

Deploying 

After testing the model, deploy it by going to the deploy menu and selecting the board. Since the RPi board is being used here, select the Linux board. Our model will then be ready to get deployed. You can also connect the HDMI LCD or SPI LCD display to RPI. To see the output, run the following command: 

edge-impulse-linux-runner

Now a new GUI will appear that will show the results with a camera video feed. 

Camera Video feed GUI

Testing 

When you run Impulse, you will get a URL. When it is opened in the RPi web browser, the live camera video feed is seen on the LCD screen. Point the camera in the assembly line for inspection of the manufacturing defect.

AI Quality Control Camera

Raspberry Pi Camera with LCD Display

AI-based Quality Control Project


Ashwini Sinha
Ashwini Sinha
A tech journalist at EFY, with hands-on expertise in electronics DIY. He has an extraordinary passion for AI, IoT, and electronics. Holder of two design records and two times winner of US-China Makers Award.

2 COMMENTS

SHARE YOUR THOUGHTS & COMMENTS

EFY Prime

Unique DIY Projects

Electronics News

Truly Innovative Electronics

Latest DIY Videos

Electronics Components

Electronics Jobs

Calculators For Electronics