Weld Porosity Detection Reference Implementation

ID 678124
Updated 7/19/2021
Version Latest
Public

author-image

By

Overview

This reference implementation provides an AI-enabled approach to detect porosity defects in an input frame from a weld inspection camera. 

Weld Porosity Detection can be executed using the Intel® Distribution of OpenVINO™ toolkit inference engine.

Select Configure & Download to download the reference implementation and the software listed below.  

Configure & Download

Screenshot of running Weld Porosity Detection

  • Time to Complete: Approximately 30 minutes
  • Programming Language: Python* 3.6
  • Available Software: Intel® Distribution of OpenVINO™ toolkit 2021.3

Target System Requirements 

  • Ubuntu* 18.04 LTS 
  • Intel® Core™ i5 processor or above with 16 GB of RAM 

How It Works 

The application uses the inference engine included in the Intel® Distribution of OpenVINO™ toolkit. The reference implementation 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. 

  • Inference Module: Ingests the frames extracted from the video and performs inference to classify the frames as defective or not. The rate at which each frame is classified is also recorded and displayed on the terminal output. 

Architecture Diagram


Get Started

Weld Porosity Detection is a reference implementation for the application using OpenVINO™ toolkit inference engine. 

NOTE: This application is a reference implementation, not a production-ready custom commercially deployable weld porosity detection tool.

Install the Reference Implementation 

Select Configure & Download to download the reference implementation and then follow the steps below to install it.  

Configure & Download

 

  1. Open a new terminal, go to the downloaded folder and unzip the downloaded RI package:  
    unzip weld_porosity_detection.zip

     

  2.  Go to the weld_porosity_detection/ directory:
    cd weld_porosity_detection
      
  3. Change permission of the executable edgesoftware file: 
    chmod 755 edgesoftware
     
  4. Run the command below to install the Reference Implementation: 
    ./edgesoftware install

     

  5. During the installation, you will be prompted for the Product Key. The Product Key is contained in the email you received from Intel confirming your download. Screenshot of Product Key.
  6. When the installation is complete, you see the message “Installation of package complete” and the installation status for each module. Screenshot of Installation of package complete

Run the Application 

Step 1: Activate the Python* Virtual Environment

This application uses a Python virtual environment to isolate Python dependencies between host system and the application. This ensures the Python packages installed for this application do not affect the system dependencies.

Go to the working directory and activate the virtual environment for the application.

cd weld_porosity_detection/Weld_Porosity_Detection_2021.3/Weld_Porosity_Detection/weld_porosity_detection
source setvirtualenv.sh

Check for Success

(m_detect) before the terminal prompt indicates the virtual environment is active. Make sure the virtual environment is active before executing the application at any time.

Screenshot of (m_detect) before the terminal prompt indicates the virtual environment is active.


Step 2: Execute the Reference Implementation

This reference implementation uses the OpenVINO™ toolkit Inference Engine module for performing inference on test images.

The sample weld data included as part of this package includes porosity defect, as shown in the figure below:

Screenshot of weld porosity defect


Step 3: Run Inference on a Video File

Set up the OpenVINO™ toolkit and Python virtual environment if not already done using the command below:

source setvirtualenv.sh

Run inference on the video file:

python inference.py \
 --model ./models/model.xml \
 --label ./models/labels.txt \
 --input ./data/weld.mp4 \
 --device CPU

NOTE: Execute the command with the -h flag to list all available options. If executing on a headless (non-graphical) remote session, use the --no_show flag to display only terminal output.

python inference.py \
 --model ./models/model.xml \
 --label ./models/labels.txt \
 --input ./data/weld.mp4 \
 --device CPU
 --no_show

Check for Success

If it was successful, the display output will be as follows:

Screenshot of No weld, normal weld, porosity images

The terminal output will be as follows:

Screenshot of terminal output

Step 4: Exit the Application Environment

The Python modules installed for the weld porosity detection application are limited to the virtualenv (m_detect). To deactivate the application, simply deactivate the virtualenv.

deactivate


Check for Success

If it was successful, the terminal output will be as follows:

Screenshot of Deactivate the application

Step 5: Uninstall Dependencies and Packages

The Python modules installed from the requirements.txt file are limited to the virtualenv(m_detect). To uninstall these dependencies completely, simple deactivate the virtualenv and remove it.

deactivate
rmvirtualenv m_detect

Check for Success

If it was successful, the terminal output will be as follows:

Screenshot of Removing (m_detect)

To uninstall all packages installed by the edgesoftware script, use the command below:

cd weld_porosity_detection/
./edgesoftware uninstall -a

Check for Success 

If the package uninstall was successful, the terminal output will be as follows:

Screenshot of Uninstall finished


Summary and Next Steps 

You successfully ran the Weld Porosity Detection application and displayed the result using the Intel® Distribution of OpenVINO™ toolkit Inference Engine. 

To get access to the deep learning training algorithm that was used to generate the Weld Porosity Detection model or the commercial version of this software, please reach out to your Intel account manager. 

This application can be deployed on the factory floor using the Edge Insights for Industrial software package. A sample implementation can be downloaded by selecting the Weld Porosity Detection Application under Video Ingestion & Analytics (Step 3 of 6) tab from the Customize & Download section on the bottom-right. 


Learn More 

To continue learning, see the following guides and software resources: 


Troubleshooting 

ImportError: libinference_engine.so

Running the application results in ImportError: libinference_engine.so error as seen below: 

Screenshot of ImportError: libinference_engine.so

Source the OpenVINO™ toolkit environment variables and run the application again. 

source /opt/intel/openvino_2021/bin/setupvars.sh -pyver 3.6

No Module Named "numpy" Error

Running the application results in No Module Named "numpy" error as seen below: 

Screenshot of No Module Named "numpy" Error

Activate the virtual environment by executing the command below and run the application again. 

source setvirtualenv.sh

Can’t initialize GTK backend in function ‘cvInitSystem’ Error

Running the application results in Can’t initialize GTK backend in function ‘cvInitSystem’​ error as seen below: 

Screenshot of Can’t initialize GTK backend in function ‘cvInitSystem’ Error

If using a headless (non-graphical) remote session, use the --no_show flag to display only terminal output.

python inference.py \
 --model ./models/model.xml \
 --label ./models/labels.txt \
 --input ./data/weld.mp4 \
 --device CPU
 --no_show

Support Forum 

If you're unable to resolve your issues, contact the Support Forum.