The demand for fish as a source of meat increases by an average of 6% each year — making it the most rapidly growing food in the meat industry. This demand has doubled since the start of the 2000s and will double again by 2050 if the current growth rate holds.
Fish farming has been expanding to meet this demand by increasing the number of fish within their facilities. However, as the fish become more closely packed: their quality of life decreases.
Maintaining a high quality of life requires the following needs to be met:
- A low rate of sea-lice (Lepeiopthteirus Salmonis) infestation
- low levels of the stress hormone Cortisol
- The ideal level of food (and timed food delivery)
- An appropriate biomass size
- Well maintained mesh nets that keep the fish enclosed (and predators out)
- A careful water quality balance
- low rates of disease
Unfortunately, the quality of life decreases exponentially as fish farms become depleted. This is because of the relationship between these factors and space (less space = more transference of sea-lice, disease, etc.)
Several parameters that effect he water quality such as pH, dissolve oxygen, turbidity, salinity, temperature etc. Aquaculture systems are severely affected by poor water quality.
In this project we are interested in developing a machine learning based system for water ecosystem analysis.
Our solutionIn this project, we are going to develop a machine learning model for predicting the water quality score. Several sensors data are used here for predicting water quality score. Throughout this project I will describe how to used edge impulse and Nordic thingy:53 to achieve this objective. Edge Impulse is Software as a Service (SaaS) web platform that allows developers to deploy powerful ML models to edge devices without possessing deep knowledge of programming or AI, ML concepts.
Here is a sneak peek of what's about to happen:
- Collecting sample training data (sensor data)
- Upload dataset to Edge Impulse to train the model.
- Feature Extraction
- Training of the model
- Deploy to Nordic Thingy:53
- Real-time data evaluation and testing using apps interface
Let’s get started!
Train the Model in Edge ImpulseEdge Impulse is a web-based tool that helps us quickly and easily create AI models that can then be used in all kinds of projects. We can create Machine Learning models in a few simple steps and users can build custom data classifiers with nothing more than a web browser.
As with any deep learning task, the first most important task is to prepare the dataset. We prepare the dataset using Nordic Thingy53. The Nordic Thingy53 have several built-in sensors. We used the color sensor for capturing the color information and light intensity sensor for collecting light intensity information of the water. A machine learning based classifier will be developed which classifies water based on light and color information.
Data Collection
The black water represents Polluted class, Orange represents Toxic class and clean water represents Normal water class.
For recording data we use nRF Edge impulse mobile application (A short reference video is given below). The nRF Edge impulse mobile apps automatically upload the data to the edge impulse web platform. Internet connection is mandatory for this purposes.
Edge Impulse account is mandatory for this project.
Now, we are going to use the nRF Edge Impulse mobile apps for collecting and transferring data to the edge impulse.
Open the mobile apps and login to the edge impulse. Create a new project, put a name of the project.
Power up the Nordic Thingy:53 and connect it with your mobile apps via Bluetooth.
Navigate to the data tab, click record new data, select category as training and label it as Normal or Toxic or Polluted and choose sensor as Light. Light sensor data consists of Red, Green, Blue color information and light intensity.
- Click Record New Data button for collecting sample data
- We need to repeat this process for several times for collecting several sample data.
The data is automatically uploaded to edge impulse (Mobile phone must be connected with Internet).
A short reference video tutorial is given below,
The data set has 3 classes. There are: Normal, Toxic, and Polluted. It would look something like this:
We are collecting very little number of data of each class which really effect the result (maybe). Here, around 15 to 19 samples of each class are taken for training.
After uploading the audio data for each classes we will be moving on to the splitting process. Any machine learning training procedure involves first splitting the data randomly into two sets. You can do it using the Perform train/test split functionality available in the Edge Impulse. Navigate to Dashboard section and select Perform train/test split. This will automatically split your data between a training class (80%) and a testing class (20%).
Once you have set up all of your classes and are happy with your datasets, it is time to train the model. Navigate to Impulse Design on the left navigation menu.
Select Add a processing block and add Flatten. Then select Add learning block and add Classification (Keras). Click Save Impulse.
Click Save parameters and finally press Generate Features.
Next, click on NN Classifier on the navigation menu. We will train a model for 500 epochs and learning rate as 0.005. Click the Start training button. Training the model can take a while. While training is in progress, you'll see a progress bar. Training should take around 6 minutes or less using the 500 epochs.
A short video is given below for better understanding.
When the training process completes you should have a result like the picture shown below:
Train data was passed through the two dense layers. Dense Layer is used to classify data based on output from convolutional layers. After completing the training, we get a validation accuracy of 100.0% (very impressive). Increasing the number of training epochs and dataset can potentially increase this accuracy score as well.
After the training is complete, you can transfer the model to the Nordic Thingy:53 using nRF edge impulse mobile apps.
Deploying the Trained Model to Nordic Thingy53The given video shows how we transfer the machine learning model to the Nordic Thingy53 board using nRF Edge Impulse mobile apps.
Testing the modelReference
Comments