Problem: Building a reliable visual application that detects leaks and spills in a dynamic environment
Liquid spills and leaks in industrial and commercial facilities pose significant risks, from slip-and-fall accidents to potential chemical hazards. Traditional detection methods often rely on manual observation, leading to delayed responses and increased risk. However, building a custom computer vision model to detect leaks and spills can be a complicated and lengthy process, and isn't always reliable when it comes to dynamic environments. Groundlight's Python SDK enables developers to create a real-time leak detection system using computer vision.
Why choose Groundlight for building a Leak and Spill Detection system?
High level overview: building your leak and spill detection model using Groundlight AI
Here's a high level overview of how you would build a leak and spill detection model using Groundlight AI. Interested in seeing the sample code for leak detection? Check out our Github repo.
Set up Groundlight
To get started, you would set up a Groundlight account, install Groundlight's Python SDK and connect it to your existing camera system.
Define what you are detecting (your Computer Vision Models)
On dashboard.groundlight.ai, you can create a detector (what you are detecting using computer vision), and using natural language just type your query: "Is there a spill or leak on the floor". You will also set your confidence threshold - in the example below, the confidence threshold has been set to 0.9, or 90%. This means that if the system is ever less than 90% sure that there is a leak or spill, it will ask for help from Groundlight staff.

You can also create a detector directly by using Groundlight's Python SDK:
import groundlight
gl = groundlight.Groundlight()
detector = gl.get_or_create_detector(
name="leak_detector",
query="Is there a liquid spill on the floor?"
)
For a dynamic leak and spill detection system that can recognize different liquids, you can create a combination of numerous detectors:
- Binary Detector:
Is there a leak or spill on the floor?
- Counting Detector:
Label each leak or spill in the image
- Multi-class Detector:
What types of spills or leaks are these?

As images are captured, they are fed through numerous detectors. First, the image is fed through a binary detector ("Is there a leak or spill on the floor"). If the output is "Yes", the image will then be fed through an Counting and Object Detection Model that will count and create one bounding box for the leak or spill. Afterwards, the model is fed into a Multi-class detector to define what kind of leak or spill it is. The categories defined here are 1) water spills, 2) residue water after the spill has been cleaned, 3) food residue, and finally 4) other.

Capture and analyze images
After setting up your detectors, you can begin capturing images from your camera feed and analyze them using your detectors. As new spills or leaks occur, the system uses its proprietary escalation framework to continuously learn.
Here's an example where the algorithm has confidently said (with 97.8% confidence) that there is a spill (water residue after a spill has been cleaned).
.jpg)
All of a sudden a new spill appears and the confidence score drops to 86.3%. Since the user has specified that if the algorithm is ever less than 90% confident on an answer, the system should escalate it to a human (Cloud Labeler) to confirm the answer. In this case, since the algorithm answered with a confidence score below 90%, it got escalated to a human who confirmed that there is a spill at a confidence score of 100%.
.jpg)
Implement alert system
Set up your system to send notifications when a leak is detected, integrating with your preferred communication channels.
Advantages for Developers:
How Do I Get Started?
If you are a developer or have developers in-house, here’s how you can build this solution for yourself
If you’d like to customize this solution for your business but need assistance to get started, book a call with Groundlight and we’d be happy to help
Schedule a call