Overview
In the manufactured product casting process, liquid material is poured into a mold with a cavity that corresponds to the shape of the desired finished product. Casting defects can develop during the liquefaction of the material, resulting in problems or defects such as shrinkage, pinholes, blow holes, etc. Most manufacturers have a quality inspection process for separating defective products from the non-defective ones. Accuracy and decision making normally depends upon human inspection and interpretation. Computer vision based systems can therefore improve accuracy or speed up the process, and will be explored in this project.Solution
In this project I implement a computer vision based cast inspection procedure and application. I trained a YOLOv5 object detection model using the Edge Impulse platform, and deployed it to the Renesas RZ/V2L Evaluation Board. A Google Coral camera first takes a top-view image of a submersible pump impeller moving on a conveyor belt. An application running on the Renesas RZ/V2L then classifies if the impeller is good, or defective. The time per inference is around 63 milliseconds, which equates to around 16 frames per second (fps). This low latency during inference can be related to the fact that the Renesas RZ/V2L board is designed for vision AI applications, due to it’s powerful hardware acceleration through its Dynamically Reconfigurable Processor (DRP) and multiply-accumulate unit (AI-MAC).Project setup
Components and Hardware Configuration
Software components:- Edge Impulse Studio account
- Edge Impulse for Linux
- Edge Impulse Python SDK
- Flask
- PyInstaller
- Renesas RZ/V2L Evaluation Board Kit
- USB Type-C cable “AK-A8485011” (manufactured by Anker)
- USB PD Charger Anker “PowerPort III 65W Pod” (manufactured by Anker)
- Ethernet cable
- 12V AC/DC adapter
- 470 Ohm resistor
- 10k Ohm multiturn trimmer potentiometer
- 1M Ohm resistor
- IRF540 mosfet
- A 3cm x 3cm strip board
- 4 2.5mm pin spaced male header pins
- A soldering gun and some solder wire
- At least four male-female jumper wires
- N20 3mm DC 6V 200RPM Metal Gear motor
- Mini conveyor assembly
- Renesas RZ/V2L Evaluation Board Kit camera support
- At least 20 pairs of M3 bolts and nuts
Data Collection Process
I used the casting product image data for quality inspection dataset on Kaggle. This dataset contains top view gray-scaled and augmented images of submersible pump impellers. The dataset has folders for defective and non-defective images of submersible pump impellers. In total, I had 1300 images: 1047 for training and 253 for testing.
Training data

Testing data

AI-assisted labelling
Training and Building the Model
An Impulse is a machine learning pipeline that indicates the type of input data, extracts features from the data and finally a neural network is created that trains on the features from your data. For the YOLOv5 model, I used an image width and height of 160 pixels and the “Resize mode” set to “Squash”. The processing block was set to “Image” and the learning block set to “Object Detection (Images)”.
Impulse Design

Dataset features

Choosing a model

Training performance
Model Testing
After training a model, we need to do a test with the unseen (Test) data. In my case, the model had an accuracy of 91%. This accuracy is a percent of all samples with a precision score above 98%.
Testing performance
Deploying the Model to a Renesas RZ/V2L
The Renesas RZ/V2L Evaluation Kit comes with the Renesas RZ/V2L board and a 5-megapixel Google Coral camera. To setup the board, Edge Impulse has documentation that shows how to prepare the Linux image, install Edge Impulse for Linux, and finally connected the board to the Edge Impulse Studio. After the Renesas RZ/V2L board has been setup we can SSH into the board through an ethernet connection between a development computer and the board, or the board and a router. To SSH into the RZ/V2L we can run the following terminal/Command prompt command on a computer:smarc-rzv2l
hostname is not identified on your network, you can use the board’s local IP address instead.
RZ/V2L with camera
edge-impulse-linux-runner
which lets us log in to our Edge Impulse account and select a project. The model will be downloaded and inference will start automatically.
Alternatively, we can also download an executable of the model which contains the signal processing and ML code, compiled with optimizations for the processor, plus a very simple IPC layer (over a Unix socket). This executable is called .eim model.
To do a similar method, create a directory and navigate into the directory:

Camera feed
Results - An Industrial Demo of AI in Quality Inspection
Using the.eim
executable and Edge Impulse Linux Python SDK, I developed a Web Application using Flask that counts the number of good, and number of defective submersible pump impellers. The images and the counts are then displayed on the Webpage in real time.

Custom WebApp
Conveyor assembly
Motor driver circuit slot
- 4 corner brackets
- 4 roller supports
- 2 rollers
- 1 motor support
- 1 motor support cover
- At least 20 pairs of M3 bolts and nuts (if you plan to screw 2 out of 4 four holes)
- 1 crate
Motor driver circuit
Renesas RZ/V2L EVK support
Renesas RZ/V2L EVK support\_2

Project setup

Project setup GIF

Conveyor motion GIF