Baby Crying Detector: The Voice of Babies Left Alone in Cars

A Blog by STMicroelectronics

The title above is bold, but it is behind the creation of an ST software called Baby Crying Detector. The application is one of the many demos available on STBLESensor, our mobile tool for iOS and Android. The app works in conjunction with the, ST’s most powerful sensor platform. As the name suggests, Baby Crying Detector detects whether a baby is crying or not. The records sounds with its MP23ABS1 MEMS microphone in 16 kHz samples. It then processes the signal before passing it to a machine learning algorithm running on the host STM32L4R9. If the system determines that a child is crying, the LED on the sensor board turns green, and the smartphone receives an alert via Bluetooth.

ST engineers decided to write Baby Crying Detector after a series of tragedies made the front page of newspapers. Parents would inadvertently leave a child in a car, in the summer heat, and be unaware of it until it was too late. Our experts, therefore, asked a simple question: could we prevent such tragedies with existing technologies? Since children in distress will almost always cry, detecting their screams could trigger an alert. The problem is that to be effective the application needs to be precise. As a result, AI is a necessity because hard-coding the algorithm would be a herculean endeavor. Additionally, the platform needs powerful enough sensors to capture quality data. ST engineers thus realized that opened the door to the Baby Crying Detector because it brought AI and performance under one roof.

Baby Crying Detector: Once Upon a Time, There Was Data

Obtaining Quality Data

As ST engineers started working on Baby Crying Detector, the first hurdle they encountered was finding useful training data. The famous adage “garbage in, garbage out” is particularly relevant for machine learning. Hence, our teams began by combing through tens of hours of audio recordings of babies crying. They also realized that rejection data was as critical. It was, therefore, essential to get samples of ambient noises, animals, and adults crying, among many other things. Ultimately, our engineers’ ordeal highlights the difficulty of obtaining quality data today and exposes the importance of ST Partners that can help with data collection.

Resolving False Positive

Once the ST teams felt that their dataset was satisfactory, they started testing the neural network. The initial evaluation was encouraging. However, they also realized that they had a few recurring false positives. One of them took place when the system mistook a dog’s howling for a baby crying. To solve this issue, our teams adjusted the Fast Fourier Transform of the audio signal before sending it to the neural network. The ST engineers also implemented an inertial detection system. Baby Crying Detector assumes that an infant is alone in the car. If the vehicle is moving, it means that there’s a driver and that an alert is useless. The current implementation is relatively basic, but developers could use the machine learning core of the LSM6DSOX found on the to sense motion while keeping the power consumption at a minimal.

Baby Crying Detector: How to Reach the Ever After

Converting the Neural Network with STM32Cube.AI

The other prominent feature of Baby Crying Detector is the ability to run the machine learning algorithm on an STM32L4. To achieve such a feat, the ST engineers used STM32CubeMX.AI. The expansion software converts a neural network into an optimized code for STM32. In this instance, our developers created a neural network on Keras. Built on TensorFlow 2.0, the API generates a Python library that users can then process with X-CUBE-AI. The result is a binary that developers can call in the main loop. Baby Cry Detector, therefore, takes the signal from the microphone, sends it to the neural network optimized by X-CUBE-AI, and returns whether the system detected an infant in distress or not.

Not a Final Product

Could Baby Crying Detector prevent even just one child from dying? We believe the answer is “yes,” but we also know that our application is not market-ready. A company looking to sell a similar solution will have to gather much more data and create a more complex neural network to improve its accuracy. However, our application shows what we accomplished in a short time and with a simple dataset from the Internet. Hence, Baby Crying Detector demonstrates, in a very real way, the potential of AI and sensors and what engineers can expect when they invest in the as well as the ST ecosystem.

The blog has been republished with permission. For more details kindly visit ST Blog.