It is a well known fact that, Rice is the one of the most important cereal crop worldwide. There are many different rice varieties world due to its diverse climatic and soil features. And it has led to the rapidly spreading practice of rice falsification. Therefore, establishing a method to reliably and accurately identify rice varieties using modern computer vision algorithms is urgently needed. There are usually features such as texture, shape, and color. With these features that distinguish rice varieties, it is possible to classify and identify rice varieties.
In this project, a computer vision system was developed using Edge Impulse's FOMO(Faster Objects, More Objects)algorithm in order to distinguish between two rice species(Jasmine and Basmati). Jasmine rice is originally from Thailand, while Basmati comes from India and Pakistan. This project is intended for those who are planning to scale their POC(proof of concept).
This project consists of four phases:
- Data gathering and labeling
- Training the model using Edge Impulse FOMO algorithm.
- Deployment and Inference of the rice varieties detection vision system on the NVIDIA Jetson Xavier NX Developer Kit
- Deployment and Inference of the rice varieties detection vision system on the OpenMV Cam H7 Plus
Required Hardware
You will need the following hardware to complete this tutorial:
- Development board officially supported by Edge Impulse platform. Here I have used the OpenMV H7 Plus and NVIDIA Jetson Xavier NX Developer Kit.
- USB WebCam for use with real-time applications. For live camera demonstrations, cameras like the Raspberry Pi Camera module are required. Here I’ll be using Arducam Complete High Quality Camera Bundle.
- OpenMV IDE. Navigate toOpenMV official website. Download and install the latest OpenMV IDE.
- Edge Impulse account.
For simplicity we will assume everything is installed. So take a look at the requirements before starting the tutorial.
Create and Train the Model in Edge Impulse
As you already know, with Edge Impulse SaaS-based machine learning platform, developers can rapidly develop and deploy sensor, audio and computer vision applications for their different applications. Edge Impulse is a great platform for non-coders to develop machine learning models without any knowledge of any programming language.
So, let's get started.
- Go to Edge Impulse plaform,enter your credentials at Login (or create an account), and start a new project.
- Select Images option.
- Then click Classify Multiple Objects option.
- Download a face rice image dataset from Kaggle by Murat Koklu. The image data set has 5 classes, we need only 2 classes(Jasmine and Basmati). We should collect enough images for each of our classes.
- Click Go to the uploader button.
- Upload images. In my case, I uploaded 600 images in total with 300 images for each class(basmati and jasmine).
- You can also add more items by labeling and uploading in Data Acquisition and retraining the model.
- Labelling images for object detection is pretty straightforward. We need to annotate the images using Edge Impulse annotation tool.
- After finishing with the image labeling for the different classes, the next step is to split them into a group for training and another for testing.
- Once you have your dataset ready, go to Create Impulse section.
- The captured image first gets resized to 96x96, it helps in keeping the final model small in size.
- Rename it to Rice Varieties detection. Click the Save Impulse button.
- Go to Image section. Select color depth as Grayscale features. Fundamental difference between FOMO and the standard Object Detection is that FOMO uses Grayscale features. Then press Save parameters.
- Finally, click on the Generate features button....