Razor Insights
Transforming Manufacturing: Developing Budget-Friendly AI with a Raspberry Pi - Part 2
In Part 2 of our series, we explore how Razor developed a cost-effective computer vision system using a Raspberry Pi to monitor safety compliance on the factory floor. Through BOHAD, a proof-of-concept tool, we demonstrate that advanced AI solutions don’t require large investments. Discover how this affordable system delivers powerful insights, transforming factory operations and monitoring key safety measures like hard hat usage—all while running on budget-friendly hardware.
<>
Following on from part 1 of this series, this article delves into a real-world case study—how our team at Razor built a cost-effective computer vision system using a Raspberry Pi. While many enterprises might assume that implementing AI solutions requires hefty budgets and advanced hardware, we set out to prove otherwise. In this article, we’ll walk you through the creation of BOHAD, a proof-of-concept that leverages affordable hardware to deliver powerful AI-driven insights.
<>
The Proof of Concept
Computer vision has come a long way, from being a research-heavy topic to powering everyday applications like facial recognition and autonomous vehicles. Yet, implementing such technology on a shoestring budget has remained challenging—until now. Enter BOHAD, a proof of concept (POC) that brings computer vision models to life on cheap hardware, specifically a Raspberry Pi with its standard camera.
This POC is more than just a gimmick; it's a functional, fast, and relatively easy-to-use system that leverages the power of large language models (LLMs) to semi-automatically train TensorFlow Lite (TFLITE) models. What’s truly impressive is that, despite running on something as basic as a Raspberry Pi, BOHAD processes 3-4 images per second at 640x480 resolution—more than enough for a range of practical applications.
<>
A Walkthrough: The BOHAD User Journey
Using BOHAD is straightforward, even for those with limited technical expertise. Here’s a step-by-step overview of how a user might interact with the system:
Connecting to the Web App: The journey begins by connecting to a web app running on the Raspberry Pi. This serves as the main interface for interacting with BOHAD.
Defining a New Model: The user creates a new model by specifying a name and a goal. The goal acts as supporting context to improve the accuracy of the LLM in categorising images.
Setting Rules and Labels: For each model, the user defines rules and labels. For instance, if the goal is to "Identify if everyone in an image is wearing a hard hat," the labels might include "HARDHATS_WORN" and "HARDHATS_NOT_WORN," each with specific rules.
Starting the Training Process: With the model set up, the user clicks a button to begin training. The system will run for a few days, collecting enough training images.
Reviewing and Reclassifying Images: The user can review and, if necessary, reclassify images that the LLM might have miscategorised.
Downloading and Training: Once enough images are collected, the user downloads the training data to a more powerful machine to run the training script and generate a TFLITE model.
Uploading and Running the Model: After training, the user uploads the TFLITE model through the web app and starts the model execution.
Image Categorisation: BOHAD processes images rapidly, categorising them at the mere expense of the Raspberry Pi's miniscule power consumption.
<>
Use Cases: Where Can BOHAD Be Applied?
BOHAD has the potential to be applied in various settings where automatic image analysis is needed:
Factory Safety Compliance: BOHAD could monitor whether workers are following safety protocols, like wearing hard hats or high-visibility clothing.
Occupancy Monitoring: The system could determine if people are present at a specific machine or area, or even monitor overall floor occupancy.
Parking Management: BOHAD could help manage parking spaces by signalling when spots are free.
<>
The Tech Behind BOHAD: How It All Works
BOHAD comprises four key services running on the Raspberry Pi, with an additional dockerised training script for model generation. Here's a look under the hood:
Web App
Built in Next.js, the web app is where users interact with the system. They can adjust camera settings, manage models, and review images. The app is the central hub for controlling the system.
Camera Service
The camera service, built in Python, leverages Picamera2 to snap images at scheduled intervals. It’s configured to capture images every 90 seconds during working hours, balancing the need for data with cost efficiency. For context, snapping images between 08:00 and 18:00 every day would yield around 11,953 images over a month—costing about £20 using GPT-4o for image categorisation.
Training Service
This Python Flask application handles the training process. It uses the openai library to send images to GPT-4o for categorisation based on the model's rules. Categorised images are then organised into the appropriate training directories.
Inference Service
Another Python Flask application, the Inference Service, uses the mediapipe library to run the trained TensorFlow Lite model. Images are categorised based on the model’s output and sorted accordingly.
<>
The Road Ahead: What’s Next for BOHAD?
BOHAD is a promising start, but there’s plenty of room for further development:
Improved Scheduling: Currently, only the camera delay is configurable, not the active days and times. More granular control would make the system even more adaptable.
Resilience: The current file system queue is brittle. Implementing a proper queue system like RabbitMQ could allow for running multiple models simultaneously.
Fully Automated Training: Training on the Pi itself hasn’t been feasible due to dependency issues stemming from python and potentially the lack of power within the hardware, but with cloud computing or further optimisation, fully automated training could become a reality.
Confidence Values: Exposing confidence values in the classification process would help users manage false negatives, making the system more reliable for sensitive applications.
BOHAD demonstrates that computer vision doesn't need to be prohibitively expensive or complex. With a Raspberry Pi, some clever programming, and a little help from modern AI, robust image analysis can be achieved on a budget—making advanced technology more accessible than ever.
<>
Conclusion
Computer vision AI offers manufacturers a powerful tool to automate the monitoring and analysis of manual processes. By using LLMs to label datasets and train machine learning models, manufacturers can create small, efficient systems that operate consistently and accurately. With the ability to deploy these models on low-cost hardware, the solution is both scalable and accessible to a wide range of operations. This approach exemplifies the future of manufacturing—where AI doesn’t just assist but becomes an integral part of optimising and enhancing industrial processes.
In the next part of this series, we'll walk through a real case study of computer vision AI in a manufacturing environment, presenting each stage of the user journey, from collecting data to training the model and, finally delivering actionable insights that transform operations. This case study will highlight the tangible benefits of AI and give you a clear roadmap for how it can be applied to your own processes.