Proper posture plays a crucial role in promoting the health and safety of workers in various industries. Maintaining good posture means aligning the body in a way that minimizes stress and strain on muscles, joints, and ligaments. It is important because it significantly reduces the risk of musculoskeletal disorders and related injuries. By adopting correct posture, workers can experience many benefits that positively impact their overall well-being and productivity.
Poor posture, such as slouching or hunching over, can lead to excessive strain on the neck, back, and shoulders, resulting in chronic pain and discomfort. Over time, this can lead to more serious conditions like herniated discs, sciatica, or carpal tunnel syndrome. By maintaining proper alignment, workers distribute the load evenly on their body, reducing the risk of developing such disorders.
Maintaining good posture can be challenging for workers for many reasons. Firstly, some job roles require prolonged periods of sitting or standing, which can lead to slouching or improper alignment. Secondly, lack of awareness and education about the importance of posture, as well as the absence of regular breaks and stretching exercises, can make it difficult for workers to consistently maintain good posture throughout their workday.
In certain trades, the unique requirements of the job make it essential to consistently perform the work in a very particular way to prevent injuries. Craftsman and machine learning enthusiast Roni Bandini knows this all too well because of his work with leather. It involves a lot of repetitive tasks involving hard pressing that can wreak havoc on the body over time if they are not performed in the correct manner. But when doing this sort of work over and over again, day after day, it can be easy to get a bit sloppy with posture at times.
Recognizing the toll this can take on a worker, and the loss of productivity that can lead to, Bandini set out to come up with a solution that might help to alleviate this problem. Using an image of the worker as a starting point, Bandini quickly realized that it would be extraordinarily challenging to evaluate posture with traditional programming techniques. As soon as an algorithm gets to the point of working acceptably, something will change, like the worker’s clothing, and it will be back to the drawing board.
A machine learning algorithm, on the other hand, could learn to recognize the relevant features of good and bad posture in a generalized way by evaluating sample images. Since this approach would get Bandini off the hook for having to play the losing game of designing the algorithm himself, he understandably decided to go this route. In particular, he settled on the idea of training an object detection model to recognize good and bad posture while doing leatherwork. To take the complexities out of designing and training this machine learning model, he decided to use Edge Impulse Studio for the job.
For the hardware platform, the SK-TDA4VM Starter Kit from Texas Instruments was selected since it is optimized for edge AI vision systems. This powerful prototyping board can perform eight trillion operations per second with its TDA4VM processor. And with 4 GB of memory and a wide array of options for interfacing with external devices, the SK-TDA4VM can easily handle running machine learning algorithms that have been highly optimized for edge computing platforms be Edge Impulse. A USB webcam was also included to give the system a view of a worker’s posture. To finish off the hardware, a relay was connected to the SK-TDA4VM’s GPIO pins so that the device can shut down any arbitrary machinery if it is being used improperly.
After setting up the hardware and flashing a Linux image onto an SD card for use with the SK-TDA4VM, the only thing remaining to be done before building the object detection pipeline was to collect a training dataset. There are many ways to get data into an Edge Impulse Studio project, but in this case, Bandini chose to simply use his smartphone because it was convenient to bring to the shop with him. He captured a small dataset consisting of about 50 images of him doing work with good posture, and 50 more with incorrect posture. The images were then uploaded using the Data Acquisition tool, which automatically split them into training and testing sets.
With the help of the AI-assisted Labeling Queue tool, bounding boxes were drawn around the worker in each image, labeling each case as an example of good or bad posture. Next, an impulse was designed — this defines every step of the data analysis process, from raw sensor data to prediction. The initial steps resized the input images, then extracted the most informative features from the data. These are crucial steps in preparing a complex algorithm like object detection for running on resource-constrained platforms. The features were then forwarded into Edge Impulse’s unique FOMO object detection model that was custom-built for high accuracy levels with low resource utilization.
A few hyperparameters, like the number of training cycles and the learning rate, were tweaked, then the training process was initiated. When it completed a few minutes later, metrics were displayed to assist in assessing how well the model was performing. An F1 score of over 71% was observed, which is just fine to prove the concept. This score could be greatly improved by supplying the model with more training data, however — the dataset used in this project is very small for an object detection algorithm.
Sending a constant stream of images of people at work to the cloud raises serious privacy concerns, so Bandini wanted to be sure that no data left the SK-TDA4VM board. So, he installed Edge Impulse for Linux which made it easy to deploy the impulse to the device. After running a one-liner in the terminal application, a web service was up and running showing frames from the camera, along with predictions of the worker’s posture.
To complete the project, Bandini wrote a custom Python script to parse the model’s predictions, then trigger the relay accordingly. If deployed in a real-world scenario, this relay would cut the power to a machine if it was not being used in the proper way. After running a few tests, the system was found to operate exactly as expected. Bandini noted that the SK-TDA4VM can accept inputs from multiple cameras, so he is considering the idea of capturing a worker from multiple angles to more accurately determine their body position for a future project.
The project documentation is very thorough, and could pretty easily be adapted to other use cases. For example, instead of detecting posture, you might be able to detect a sleepy driver with some small tweaks. Whatever you plan to build, cloning the public Edge Impulse Studio project as a first step will give you a boost in getting started.
Want to see Edge Impulse in action? Schedule a demo today.