Weld Porosity Detection
Overview
The Weld Porosity Detection tutorial provides an AI-enabled approach to detect porosity defects in an input frame from a weld inspection camera.
This tutorial can be executed as part of the Edge Insights for Industrial package . If you have not installed that package yet, you can download it here and then follow the Edge Insights for Industrialinstallation instructions .
Target System Requirements
Ubuntu* 18.04 LTS
Intel® Core™ i5 processor or above with 16 GB of RAM
How It Works
The Weld Porosity Detection tutorial uses the inference engine included in the Intel® Distribution of OpenVINO™ toolkit. The tutorial shows an example of how detection networks can be leveraged in industrial quality inspection applications.
Weld inspection video: Sample video that is used to simulate a weld inspection camera stream. The video includes porosity defects that occur during the weld process and at random times.
Weld Porosity Detection Custom UDF: Ingest the frames from the Video Ingestion pipeline and performs inference on each frame to classify it as no weld or normal weld or porosity weld. The rate at which each frame is classified is also recorded and displayed on the output Visualizer window of the Edge Insights for Industrial software stack. The UDF utilizes the Inference Engine module from the Intel® Distribution of OpenVINO™ toolkit to optimize the inference on Intel hardware.
Configuration files: The weld porosity detection custom UDF configuration file to add the classification algorithm UDF to the Edge Insights for Industrial pipeline.
Intel hardware optimized models: Deep learning classification models to detect porosity weld defects optimized using the Intel® Distribution of OpenVINO™ toolkit; IR files generated by the Model Optimizer.
All communication between the image acquisition from sample video and analytics to detect defects (VideoIngestion) to visualizing the inspection results (Visualizer) occur over the Edge Insights Internal Message Bus.
Get Started
The Weld Porosity Detection reference implementation is a plug-and-play application developed for the Edge Insights for Industrial package.
Prerequisites
Weld Porosity Detection can be executed as part of the Edge Insights for Industrial package . If you have not installed that package yet, you can download it here in the custom download section of the video or video-timeseries use case. Both the use cases will download the video pipeline related services required to satisfy the pre-requisites for this application. Next, follow the Edge Insights for Industrialinstallation instructions .
Step 1: Add Weld Porosity Detection UDF Components
Change working directory to the Weld Porosity Detection package and create an environment variable $EII_HOME to point to the IEdgeInsights install path for ease of reference.
NOTE:In this tutorial, the variable $WORKDIR refers to the host system path where Edge Insights for Industrial package was downloaded and unzipped.<version> indicates the downloaded version of Edge Insights for Industrial.
cd $WORKDIR/edge_insights_industrial/Edge_Insights_for_Industrial_<version>/weld_porosity_detection/weld_porosity_detection/ EII_HOME=$WORKDIR/edge_insights_industrial/Edge_Insights_for_Industrial_<version>/IEdgeInsights/
Copy the Weld Porosity Detection custom UDF file to the Edge Insights for Industrial CustomUdfs directory:
cp -r PyWeldPorosityIngestion $EII_HOME/CustomUdfs/.
Optionally, edit the PyWeldPorosityIngestion/config.json to use the inference hardware of choice [CPU/GPU/Myriad/HDDL]. Default is CPU. Please note that the deep learning model used in the reference implementation is a deep model, and hence would take a few minutes for the initial loading into an accelerator (GPU/Myriad/HDDL) memory.
Modify the Visualizer and WebVisualizer configuration to subscribe to the custom UDF publisher port.
NOTE:We recommend that you make copies of the original $EII_HOME/Visualizer/config.json and $EII_HOME/WebVisualizer/config.json files before proceeding. These files needed to be rewritten to modify the pipeline to use the Weld Porosity Detection application files instead of the default PCB demo application.Make copies of the original Visualizer and WebVisualizer config.json files:
mv $EII_HOME/Visualizer/config.json $EII_HOME/Visualizer/config.json_original mv $EII_HOME/WebVisualizer/config.json $EII_HOME/WebVisualizer/config.json_original
Copy the new Visualizer and WebVisualizer config.json files to subscribe to the the Weld Porosity Detection application:
cp vis_config.json $EII_HOME/Visualizer/config.json cp webvis_config.json $EII_HOME/WebVisualizer/config.json
Copy the usecase UDF yml file to include the custom weld UDF container:
cp video-streaming-weldUDF.yml $EII_HOME/build/usecases/.
Follow the Edge Insights for Industrial instructions to provision and launch the containers:
# Configure the IEdgeInsights pipeline to use the containers necessary for CustomUDF application cd $EII_HOME/build/ sudo python3 builder.py -f usecases/video-streaming-weldUDF.yml # Provision cd $EII_HOME/build/provision/ sudo -E ./provision.sh ../docker-compose.yml # Build and run cd $EII_HOME/build/ sudo sg docker –c 'docker-compose -f docker-compose-build.yml build python_weld_detection' sudo sg docker –c 'docker-compose up –d' # Enable visualizer display xhost +
The output will look similiar to:
Step 2: Check the Reference Implementation
The Edge Insights for Industrial builds the PyWeldPorosityIngestion, Visualizer and WebVisualizer containers. The VideoIngestion container streams the sample weld video and performs inference on each frame to detect porosity defect. Once the frame has been classified, the image is displayed on the Visualizer output window with the inference result and time.
Execute the following command to ensure all the containers are running without errors:
sudo docker ps
Check for Success
If it was successful, the results will be similar to:
Visualizer Output
The sample weld video has 3 types of classification results that can be monitored using the visualizer output: no weld, normal weld, porosity weld.
Step 3: Stop the Vision Pipeline
To stop the Edge Insights for Industrial software, execute the following command:
cd $EII_HOME/build/ sudo sg docker –c 'docker-compose down'
To revert to the default PCB Demo application, move the Visualizer and WebVisualizer config.json files to the original copies [Step 1.3.a] and rebuild using the instructions below:
# Replace the original Visualizer & WebVisualizer config.json mv $EII_HOME/Visualizer/config.json_original $EII_HOME/Visualizer/config.json mv $EII_HOME/WebVisualizer/config.json_original $EII_HOME/WebVisualizer/config.json # Configure the IEdgeInsights pipeline to use default containers for PCB demo application cd $EII_HOME/build/ python3 builder.py -f usecases/video-streaming.yml # Provision cd $EII_HOME/build/provision sudo -E ./provision.sh ../docker-compose.yml # Run sudo sg docker –c 'docker-compose up -d' # Enable visualizer display if not already xhost +
Troubleshooting
If executing docker ps lists all containers as running, but the visualizer window does not display results, execute the below command:
xhost +
This is a one-time command that needs to be executed after each system reboot.
If the system is remote without access to monitor display, use the WebVisualizer to view the results while the custom UDF containers are running. Login from a Chrome browser using the IP address of the EII system and port 5000: https://<ipaddress>:5000
Enter using the default login ID and password provided in webvis_config.json.
Username: admin
Password: admin@123
Optionally, modify these values in $EII_HOME/WebVisualizer/config.json while building the containers to use custom username and passwords.
WebVisualizer Output
If you’re unable to resolve your issues, go to the Support Forum.
Summary and Next Steps
You successfully ran the Weld Porosity Detection application and displayed the result using the Edge Insights for Industrial Visualizer output.
To get access to the deep learning training algorithm that was used to generate the Weld Porosity Detection model, please contact your Intel account manager.