This project will show you how to detect an make an inventory of your fridge in real time using a Raspberry Pi, Edge Impulse and Balena. You will be able to check on your phone what you have on your fridge when you go to the supermarket. We could expand this project in an industrial use to have a real time inventory of the factory stock.
Summary :1)Introduction
- Elements use in this projects
- Get familiar with Raspberry Pi
- What’s EdgeImpulse ?
- What’s BalenaCloud ?
2)Creation of the machine learning model using Edge Impulse
3)Connection between Edge impulse and Balena
4)Creation of the Balena environement
Elements use in this projects- Raspberry Pi v4
- Pi camera V2
- SD card
- USB-C cable
- A free Edge Impulse studio account
- A free BalenaCloud account
- BalenaEtcher a software to flash an SD card
Click on the link, and follow the instructions to see your raspberry on your screen, you have to download Raspberry Pi Imager, …
https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up
Now you can see this screen on your computer
Go to the main menu and open the Raspberry Pi Configuration tool.
Select the Interfaces tab and ensure that the camera is enabled :
Open a terminal, use this code
Now you can see on your desktop one picture !
What is Edge impulse ?Edge impulseis a platform that allows you to generate Machine Learning trained models in the cloud and deploy it on microcontrollers.
What is BalenaCloud ?First Part : Generate a machine learning model using Edge ImpulseStep 1 : Start a new project and start collecting data in the data acquisition.
Then you have to scan the QR code with your smartphone and start taking pictures to train the model. The more you take pictures the more the model will be precise. In our case we take around 50 pictures per items.
Step 2 : Create the impulse
In this part you will have to :
- Select a resolution of 96x96 which the best resolution for our project
- Add a processing block and select image
- Add a transfer learning block (images)
The output features will appear with all of our foods selected. Then save the impulse.
In the impulse design menu, you have to set up the RGB color depth. Save the parameters and you will have 3D visualisation of our model.
This show us if the model recognizes all the differents foods well and if the software doesn't mixed up all of the pictures that we have taken.
Now we will go in the transfer learning menu to start training our model.
We have to set up our parameters :
- Number of training cycles to 100
- Learning rate to 0.0075
- Data augmentation: enabled
- Minimum confidence rating: 0.8
Click on Start training and this will generate the machine learning model.
Step 3 : Test the model
Go on Model Testing menu and click on Classify selected. This will show the fiability of our model and in our case we have 96.67% which is almost perfect.
Second Part : Connection between Edge impulse and balenaWe will need the Project ID and the API Key
Third Part : Creation of the balena environementGo to balena and create and account and a new project.
You need your project ID, to join balena and Edge Impulse. Go to DashBoard, and copy it.
Click on Key on the top and add a new API KEY, balena
Now on Balena, create two variables:
- EI_API_KEY with your api key from edge impulse
- EI_PROJECT_ID with your project ID (17632 here)
Add a new device, your Raspberry...
Choose your device type, like Raspberry 3, your Wifi SSID and your password before dowload the file.
You downloaded a file, and you have to fash it on the SD Card. To do it, download balenaEtcher.
Select your zip, your drive and falsh !
You can put your sd card on the Raspberry now. After few minutes, you will see the device
Select "Public URL" to show your camera with the URL.
After few minutes, the system will download two services, Balena-cam and Edge Impulse.
LastPart,Youcan test your application
You can take a picture with your raspberry on the URL, and show what it is, Cordon bleu, mimolette, beurre or unknown.
Credits : https://www.balena.io/blog/how-to-classify-socks-using-a-raspberry-pi-edge-impulse-and-balena/
Comments