Blog post

Monitoring Packages in Transit with Edge ML

Blog
By Zin Thein Kyaw
Monitoring Packages in Transit with Edge ML

It has been estimated that over 10% of packages are damaged in transit. For online retailers, this leads to substantial costs being incurred, and poor customer experiences. Driving up those costs is the fact that as much as 20% of product returns to these retailers are due to damage that occurred during shipment. While more difficult to quantify, these negative experiences have the effect of discouraging customers from returning to do business with a retailer in the future. Unfortunately, proving that the contents of a package were damaged in transit, as opposed to before or after transfer to a carrier, can be a challenge since we have no insight into what occurs during the delivery process. This current state of affairs opens the door to both misplaced blame and outright fraud.

To demonstrate one possible better path forward, we built a prototype device using inexpensive, off-the-shelf hardware that can determine if a package has been mishandled in transit. With some intelligence added to this hardware via the Edge Impulse platform, our gadget is capable of providing insight about how a package was handled, moment by moment, during its journey.

Arduino Nano 33 BLE Sense

An Arduino Nano 33 BLE Sense development board was chosen for this project because it has an Arm Cortex-M4 CPU running at 64 MHz, 256 KB of SRAM, and 1 MB of flash memory to allow for rapid inferences from a tinyML model. The included nine-axis inertial sensor sweetened the deal, making this board an all-in-one solution. While the Nano is ideally suited for the task, it should be noted that it would be possible to port this solution to another, comparable development board containing an accelerometer with little effort by choosing a different target device to deploy to in the Edge Impulse Studio.

We affixed the Arduino to a package, then did our best impression of a disgruntled delivery driver to collect training data for a machine learning model. We dropped and violently shook the package for about six minutes, while collecting accelerometer data and transferring it to Edge Impulse, where we used the data acquisition tools to label the data. From there, an impulse was designed, beginning with a preprocessing step called a spectral analysis that serves to extract only the most important features from the data, which helps to reduce the computational resources required by subsequent steps.

Classification performance after training model

With the initial data processing out of the way, the next stop in the pipeline is a neural network classifier, which was built to recognize the difference between a package being dropped, excessively shaken, or sitting idle. This is a great start, but a creative delivery driver can damage a package in any number of ways, so we also included a K-means anomaly detector to catch any type of anomalous activity.

After training on the uploaded dataset, a validation showed that the neural network had achieved a very impressive 98.7% classification accuracy. At this point, all that was left to do was deploy the machine learning data analysis pipeline to the Arduino, then tape the board inside a box. On delivery, the device is able to tell what happened to the package along the entire route. So, if your new set of drinking glasses arrived in far more pieces than hoped for, you can consult data collected on the device to understand if the package was dropped by the carrier.

To keep an eye on your own fragile shipments, grab a development board from your parts bin and check out our public Edge Impulse project.


Want to see Edge Impulse in action? Schedule a demo today.

Comments

Subscribe

Are you interested in bringing machine learning intelligence to your devices? We're happy to help.

Subscribe to our newsletter