Detection of personal protective equipment on workers using an object detection AI model.
Construction is among the industries where accidents occur most frequently. It's crucial to ensure that workers consistently wear their personal protective equipment to safeguard their safety, reduce accidents, and adhere to regulatory standards.
Several solutions can be considered:
This is where edge AI comes in. It offers real-time detection, cost efficiency, privacy preservation, and scalability compared to other solutions. Quantitative evidence can be mentioned, such as the reduction in accident rates and cost savings, while qualitative feedback from workers validates an improved perception of safety.
This use case is based on a public dataset containing images of workers wearing personal protective equipment (helmets, safety vests, shoes, and gloves). The goal is to detect what personal protective equipment a person is wearing and draw a bounding box around each piece of equipment.
For this project, we used the STM32 model zoo. It provides pre-trained models optimized for STM32 and scripts to retrain and customize your models.
First, we cloned the GitHub repository and set up our project environment. We mainly used the resources from the "Object detection" folder since our project involved detecting personal protective equipment. You might use resources from another folder depending on your use case. Several applications are available in the STM32 model zoo.
After downloading the dataset, we imported the files into the STM32 model zoo in the designated folder (stm32ai-modelzoo/object detection/datasets). Each sample in the dataset consists of an image and a txt file with the position of each piece of equipment in the image.
We then used the configuration file (stm32ai-modelzoo/object detection/src/user_config.yaml) to set up the training parameters for our model. This file allowed us to:
Then, we just had to execute the python script with the command python stm32ai_main.py to start the training (make sure to be in the stm32ai-modelzoo/object_detection/src folder).
Once the training was completed, we were able to retrieve the results in the experiment_outputs folder (stm32ai-modelzoo/object_detection/src/ experiment_outputs). In this folder, we can find the .h5 train model and its .tflite quantized version, the execution time and memory footprint for each model, and the confusion matrix for each object to be detected.
You will find below a video in which we show all these steps.
* The quantization and benchmark are done through the ST Edge AI Developer Cloud. You will need an ST account to be able to use it.
Dataset Personal protective equipment detection
Data format
5 classes: Person, Helmet, Protection Jacket, Protection Shoes, Gloves
RGB images: 4.2K train, 584 validation, 292 test
Model SSD mobilenetv1 quantized neural network
Input size: images rescaled to 224x224x3
Memory footprint:
188.6 Kbytes Flash for weights
131.42 KbytesRAM for activations
Accuracy: 78.96% mean average precision after quantization
Performance on STM32H747l-DISCO (High-perf) @ 400 MHz
Inference time: 74.98 ms
STM32CubeAI 8.1.0
A collection of reference AI models optimized to run on ST devices with associated deployment scripts. The model zoo is a valuable resource to add edge AI capabilities to embedded applications.
A free STM32Cube expansion package, X-CUBE-AI allows developers to convert pretrained AI algorithms automatically, such as neural network and machine learning models, into optimized C code for STM32.
The STM32 family of 32-bit microcontrollers based on the Arm Cortex®-M processor is designed to offer new degrees of freedom to MCU users. It offers products combining very high performance, real-time capabilities, digital signal processing, low-power / low-voltage operation, and connectivity, while maintaining full integration and ease of development.