Why did we build Clean Water AI?
According to the World Health Organization, more than 2 billion people are still being affected by contaminated water. And while we think it’s safe in the United States, the Flint, Michigan water crisis has proven to us that even in first world country like the US, we still face water safety issues. In india water quality monitoring is a big issue so we built an AI and IoT based water quality monitoring system.
Currently all of the water sensors are chemical based, the most common one being using chemical test strips that are one time use. Making monitoring contamination extremely difficult and exhausting, hence events like Flint, MI have happened in the past.
The method of detection
Clean Water AI is an IoT device that classifies and detects dangerous bacteria and harmful particles. The system can run continuously in real time. The cities can install IoT devices across different water sources and they will be able to monitor water quality as well as contamination continuously.
What is AI and how to use it
Deep learning has been a pretty big trend for machine learning lately, and the recent success has paved the way to build project like this. We are going to focus specifically on computer vision and image classification in this sample. To do this, we will be building nevus, melanoma, and seborrheic keratosis image classifier using deep learning algorithm, the Convolution Neural Network (CNN) through Caffe Framework.
In this article we will focus on supervised learning. It requires training on the server as well as deploying on the edge. Our goal is to build a machine learning algorithm that can detect contamination images in real time. This way you can build your own AI based contamination classification device.
Our application will include 2 parts. The first part is training, which we will be using different sets of cancer image database to train a machine learning algorithm (model) with their corresponding labels. The second part is deploying on the edge, which uses the same model we've trained and running it on an Edge device, in this case Movidius Neural Computing Stick.
Traditional Machine Learning (ML) vs. Deep Learning
This is probably the most asked question in AI, and it's fairly simple once you learn how to do it. In order to understand this we first have to learn how machine learning image classification works. Machine learning requires feature extraction and model training. We first have to use domain knowledge to extract features that can be used for our ML algorithm model, some examples includes SIFT and HoG. After that we can use a dataset that has all the image features and labels to train our machine learning model. The major difference between traditional ML and Deep Learning is in the feature engineering. The traditional ML uses manually programmed features where Deep Learning does it automatically. Feature engineering is relatively difficult since it requires domain expertise and is very time consuming. Deep learning requires no feature engineering and can be more accurate.
Convolutional Neural Networks (CNNs)
Convolutional neural network is a class of deep, feed-forward artificial neural networks, most commonly applied to analyzing visual imagery because it is designed to emulate behavior of biological behaviors on animal visual cortex. It consist of convolutional layers and pooling layers so that the network can encode image properties. The convolutional layer's parameters consists of a set of learnable filters (or kernels) that have a small receptive field. This way the image can convolve across spatially, and computing dot products between the entries of the filter and the input and producing a 2-dimensional activation map of that filter. This way the network learns filters that can activate when it detects special features on the input image's spatial feature.
Neurons of a convolutional layer (blue), connected to their receptive field (red). Source (Wikipedia)
The pooling layer is a form of non-linear down-sampling. It partitions the input image into a set of non-overlapping rectangles and, for each such sub-region, outputs the maximum. The idea is to continuously reduce the spatial size of the input representation to reduce the amount of parameters and computation in the network, so it can also control overfitting. Max pooling is the most common type non-linear pooling. According to Wikipedia, "Pooling is often applied with filters of size 2x2 applied with a stride of 2 at every depth slice. A pooling layer of size 2x2 with stride of 2 shrinks the input image to a 1/4 of its original size."
Connecting AI to IoT
In this project we are trying to gather the information from the camera and inferencing it over the edge device, then pass the data using Azure IoT Hub.