Construction site safety is one of the most crucial things to take care of during a construction project, since potential emergencies may be life-threatening. Builders tend to neglect safety rules when employers fail to maintain secure working conditions. Luckily, modern technologies can help make a construction site a safer place.
In this blog post, we describe how we applied our knowledge in machine learning and computer vision to prevent one of the most common safety breaches among builders. The DB Best team came up with a solution utilizing the YOLO object detection algorithm for a neural network to detect those not wearing hard hats on a construction site. Our algorithms reached 98% accuracy in identifying troublemakers analyzing video materials in real-time!
One in ten gets injured at a worksite
Statistically, every fifth worker’s death is construction-related, and 1 in 10 suffers from injuries sustained at the workplace. Since employees often neglect safety rules or simply get distracted from wearing safety equipment, our customers in the construction industry turned to us for help. They needed a reliable solution for monitoring all workers required to wear a safety helmet while on the construction site.
In addition to increasing the sense of personal responsibility among workers, our client wanted to engage with artificial intelligence technology to automatically identify employees without protective helmets with the help of data from video cameras.
Utilizing one of the fastest object detection algorithms
In a project such as this, we basically have two main challenges when working with image or video recognition. The first one is identifying what the image represents, whether it generally has the objects we’re interested in. And the second is to identify the object’s location in the image.
In our case, neural networks served our purpose the best in searching for objects and extracting useful information from the video. With the help of a YOLO object detection algorithm based on neural networks, our Data Science team made software that, using data from a video camera, determined which worker had a protective helmet on and which didn’t. When we detected a person not wearing a helmet, the system sent a correspondent signal to the security service.
YOLO allows you to detect which object is where in real-time from the video. This is one of the newest algorithms for object detection based on convolutional neural networks. It implements a principle of regression when we’re detecting classes and bounding boxes for the image as a whole instead of selecting the parts of the image we’re interested in. We are basically splitting our image into cells responsible for predicting bounding boxes, and predict a bounding box specifying object location and a class of an object. These bounding boxes are weighted by the predicted probabilities. Please follow the link for the algorithm implementation details.
The solution implementation pipeline
Based on the YOLO object detection algorithm, we built a model with an accuracy of 98 percent that defined a person without a protective helmet.
The step sequence is as follows:
- Acquiring images.
We can have any source for obtaining data, generating data both: online and offline. In our case, we acquire images in real-time from video cameras.
- Transferring data to Azure Databricks.
To train the model on neural networks, we need computational resources with the presence of GPU (graphics processing unit). Resources with GPU give us the opportunity to significantly increase productivity in comparison with servers with CPU (central processing unit). We use an Azure Databricks cluster as a set of computation resources and configurations for machine learning.
- Processing images in the desired format and layout.
At this stage, we use Pillow or PIL, the Python-based library, to open the image, and bring it to the size we need. After that, we select the target area we want to predict.
- Processing data using PyTorch.
Using Python and the PyTorch library, we encode the incoming image into a format suitable for a neural network.
- Model training and result prediction.
Python is the main programming language in this project, and our machine learning model is built on the Python framework. After the model is successfully trained, we run the prediction machine learning algorithm.
- Sending the result to the server.
After the machine learning model runs, we send the result to the server to save or execute business logic. In our case, managers receive images with the alerts in the application.
As a result, we delivered a bespoke solution for making a construction site a safer place and prevented the client’s company from spending extra money and from suffering time losses.
Future refinements to look for smaller objects
In our case, we still have much work to do to advance our algorithm to make a worksite even safer. Because the presence of hard hats on workers doesn’t mean, for example, that they are wearing it correctly. Sometimes builders prefer a style to safety and wear helmets backward or in combination with bandanas and other unapproved headgears. Because of this, the helmet doesn’t always fulfill its mission, and the front bill can not prevent splashes, drips, and spills from running into a worker’s eyes and face.
Now, in addition to the helmet position on the head, we will attempt to make our ML solution even more advanced and train it to recognize smaller and less visible objects on a human body such as eye goggles, noise-canceling earplugs, and construction boots.
Enhance your business with machine learning!
Using advanced machine learning algorithm-based solutions, you can take the level of your business safety and efficiency to new heights. The DB Best Data Science team is here to help you eliminate risk factors that you may encounter and to help make data-driven predictions using video data, facial recognition, and many more.
Feel free to apply for a consultation and uncover the best way to reduce the risks that impact your business with AI technologies.