Table of Contents
- Introduction
- Getting Started
- Edge Impulse
- Improving Edge Impulse Model
- Testing The Machine Learning Model With OpenMV
- Adding The Water Sprayer System
- Testing The Water Sprayer System
- IoT Ambient Monitoring System | Part1
- IoT Ambient Monitoring System | Part2
- Summary
**********************************************************************************************************************
In this post I will show you how to improve my first model that I made in Edge Impulse. As you will remember, I obtained an accuracy of 70.5% and a loss value of 0.89.
Reporting a Bug in OpenMV
If I increase the number of images samples, we can increase the accuracy scores and reduce loss value, however the size model will be increase above 2 MB. Remember that the flash memory of the Nicla Vision is 2 MB. The idea is to load the model in the flash memory because if we use the ROM memory to load the model and run the code, this will not work.Below I show you an error report that I had when I increased the number of samples.
So that you understand me, here are the details of the bug that I reported to technical support of OpenMV: https://forums.openmv.io/t/openmv-cant-build-a-new-firmware-for-nicla-vision/8200
Selecting Best Samples
Since we are limited by the memory of the Nicla Vision, Then my strategy is to select the best images loaded in my project and reorganize it.
When I talk about choosing the best images, I mean the ones with the best details, and with backgrounds of different colors. Blurred and cropped images must be removed. Below you can see samples of images of bees, spiders and unknown images that I used to train my model.
Below I show you the features generated after these changes. As you can see, the three classes are bee, spider and unknown.
Training the Model
We retrain the model and see that we get better results. now the accuracy is 74.1% and the loss value is 0.58.
With the changes made we have increased the accuracy from 70.5% to 74.1%. We have also reduced the loss value from 0.89 to 0.58. Therefore we have improved and now we can test this model on our Nicla Vision board.
Model Testing
Edge Impulse has a facility to test the model created with the uploaded dataset. Below I show you the results and you can see a good accuracy of 81.69%, which is a good indicator for our purposes.
OpenMV Library
- Now that we have a Machine Vision model that works, we can use EdgeImpulse to generate an OpenMV library that can be flashed to the Nicla Vision and be called from a Python script.
- As we saw in the previous chapter, Select Deployment from the menu bar, choose OpenMV from the library section, and click Build
- This will build the file, then open a file browser to input the download location – you will get the zip archive.
Once downloaded the compressed file in zip format, below I show you the model files.
Conclusion
- We have already managed to improve the model created in Edge Impulse by selecting best images and removed the blured.
- The precision can be increased with more samples uploaded to the model. In fact my idea was to increase the samples, but it is not possible due to the memory of the Nicla Vision, which is also used for the code, the communication between chips, the capture of images and data, etc.
- For now its enough, in the next chapter we will test this model with OpenMV resources.