Edge Impulse logo
Blog Post

Piping Up to Detect Defects

Machine Learning, Artificial Intelligence, TinyMLThis ML system can help identify cracks and defects in pipes with the use of mmWave radar and an Arduino Nicla Vision.

Nick Bild

May 24, 2023

    In the vast network of industrial pipelines that crisscross our modern world, monitoring plays a pivotal role in ensuring safety, averting environmental disasters, and maintaining operational efficiency. These intricate systems transport a wide array of materials, including water, oil, gas, and chemicals, making pipeline monitoring an essential practice for numerous industries.

    The consequences of a pipeline failure can be catastrophic, leading to environmental damage, property destruction, and even loss of life. To illustrate the gravity of the situation, statistics show that between 2010 and 2019, more than 3,000 pipeline incidents were reported in the United States alone, resulting in approximately 100 fatalities and over $6 billion in damages. These alarming figures emphasize the urgent need for more effective monitoring systems to prevent such incidents from occurring.

    The test setup with simulated defects

    However, monitoring pipelines is not without its challenges. One of the primary difficulties is the vast geographical expanses that pipelines cover. Some pipeline networks stretch across thousands of miles, making it arduous to maintain constant vigilance over the entire infrastructure. Additionally, pipelines traverse diverse terrains, including remote areas, deserts, and underwater, making access for routine inspections and maintenance activities challenging.

    To be practical under such conditions, monitoring systems must be cost effective and durable, in addition to accurate. Serial inventor Kutluhan Aktar recently built a proof of concept device that meets all of these requirements, and might prove to be useful in monitoring real-world pipelines one day. His system relies on inexpensive, off-the-shelf hardware to detect pipeline defects early, before they become a real problem, by measuring their vibrations. Those vibrations are interpreted by a machine learning classifier developed with Edge Impulse Studio.

    The mmWave radar module alongside the Arduino Nicla Vision

    At the core of the hardware design is a tiny yet powerful Arduino Nicla Vision development board. With an Arm Cortex-M7 processor core running at 480 MHz and a megabyte of RAM, this little platform has more than enough power to run a machine learning pipeline that has been optimized for resource-constrained devices by Edge Impulse. It also has a two megapixel camera, which Aktar leveraged to snap a picture when a pipeline defect is detected.

    A 60 GHz mmWave module from Seeed Studio was included to capture fine vibratory measurements as liquids flow through pipes. These modules were designed with capturing metrics like respiratory rate and heart rate in mind, but Aktar thought they should also fit the bill for his use case. Next, an Arduino Nano was added to the build for library compatibility with the mmWave module. Finally, a TFT LCD screen was wired in to allow for the development of a user interface.  The components were assembled inside of a custom, 3D-printed case to ruggedize the system.

    Before creating the software, a dataset needed to be collected to train the machine learning algorithm. Aktar took a trip to the hardware store, then built a very simple pipeline of his own from PVC pipes and fittings. Three types of pipe defects were simulated in this setup — clogs, cracks, and leaks. A mini aquarium pump was then used to move water through the system. Software was written to collect data from the mmWave module as it recorded vibrations in the pipe as water passed through the defect regions. This data was converted to a CSV-formatted file, then was uploaded to a project in Edge Impulse Studio using the CSV Wizard.

    Examining the samples in Data Explorer

    After validating that the uploaded samples looked correct in the Data Explorer tool, Aktar began to build the impulse. This is the most important part of the entire project — it defines how the data is processed, all the way from raw sensor measurements to the prediction from the intelligent algorithm. It is also the simplest part of the entire project. Using the slick, web-based interface of Edge Impulse Studio, preprocessing steps were added to split the sensor data into one second segments, then extract the most important features. The features were then fed into a neural network classifier that can predict the likelihood of each of the three types of pipe defects in the training dataset.

    The model was modified, with three additional dense layers being added. A few hyperparameters were also tweaked, then the training process was initiated.  After a short time, the training step had completed and metrics were displayed to help assess the model’s performance. It was found that the model had achieved an average classification accuracy of 94.4% on the training dataset. The more stringent model testing tool was also used to validate this result, and that showed the classification accuracy to be 90%.  This is more than sufficient to prove the concept, so Aktar moved on to the next step of the project.​​

    The finished classification pipeline

    So that there would be no dependencies on external cloud computing resources or wireless connectivity, the machine learning pipeline was deployed as an Arduino library using the Deployment tab. This is a very flexible option that allows one to add their own code that is triggered based on the model’s predictions. Aktar added in logic to transmit a message to a web application when pipeline defects were detected, then flashed it to the Arduino Nicla Vision.

    The web application, hosted on a LattePanda 3 Delta single board computer, can display all detected pipeline defects, and is also capable of exporting them as a CSV-formatted file.  The images captured by the Nicla Vision are also available in the web interface to allow users to have a view of the problem. Using the onboard LCD display, each device also provides an alert when a pipeline defect has been detected.

    The web application

    The project write-up is extremely detailed and well worth the read. Whether you want to replicate the project, or just learn more about neural network classification algorithms, you can’t go wrong. And if you want to get a headstart on your own classifier, Aktar has very graciously made his own Edge Impulse Studio project public, so feel free to clone it and modify things to suit your own needs.

    Want to see Edge Impulse in action? Schedule a demo today.


    Are you interested in bringing machine learning intelligence to your devices? We're happy to help.

    Subscribe to our newsletter