All work James Pieter Djibu

Image Processing & Water Quality Analysis

AI Development Gold Medal · Eskom Expo

Lab tests for water quality are slow and out of reach for most households. We built a smartphone app that screens water from a single photo. It extracts the dominant colours, classifies them with a neural network and combines the result with what the user observes.

Award Gold Medal, Eskom Expo
Team Co-authored with Jasmine Nurul Izza Bachtiar. Supervised by Novita Sari Almista and Pipit Fitriani, Menlo Park School, Jakarta
Tools Python 3.7, TensorFlow / Keras, Color Thief
Method Euclidean colour matching and an artificial neural network
88% Test accuracy of the colour classifier
5,053 Labelled RGB values used for training, with an 80/20 split
11 Basic colour classes the network distinguishes
3/4 Field samples where the AI matched on-site observations

Problem

About 70% of the earth is covered by water, but only 0.34% of the supply is safe for people to use.

Checking water quality usually means sending samples to an authorised lab, which is slow and costly. Sensor kits for pH or turbidity exist, but few households own one. We wanted an early-warning tool that anyone can use with just a phone.

Pipeline

  1. Extract five dominant coloursThe Color Thief module pulls the five dominant colour groups from the photo. An interactive crop removes reflections and shadows first.
  2. Classify the coloursTwo methods run side by side. Euclidean distance matches each colour to red, green or blue. A Keras network, trained for 5,000 iterations, sorts it into 11 basic colours.
  3. Add what the user observesDropdowns capture odour, signs of aquatic life and location. Each answer that matches the database adds 25 points, on top of 25 for a successful colour output.
  4. Predict and recommendThe system returns likely pollution sources, handling methods and a confidence score.
Pool water photo with five extracted colour swatches, shown with and without cropping
Stage 1: the five dominant colours with cropping (b) and without (a). Cropping removes the background and shadows that skew the palette.

Results

The classifier reaches 88% accuracy on held-out data.

F1 score by colour class on the 20% test split. Green is easiest to classify. Grey is hardest because its tones overlap with white and black.

Green 0.94
Blue 0.93
Black 0.90
Pink 0.86
Brown 0.86
Yellow 0.83
White 0.83
Red 0.82
Purple 0.81
Orange 0.78
Grey 0.75

Field test

Four real samples were measured on site (pH, smell, colour) and compared with the app’s output.

Field test: four water samples, measured on site and read by the app
SampleOn-fieldDetected coloursApp result
Yellow, turbid water sample in a container pH 5.2 · oily · yellow turbid Yellow, Green, Yellow, Yellow, Yellow Yellow · Match
Frothy white, soapy water sample pH 8.3 · soapy · frothy white White, White, White, Gray, White White · Match
Clear chlorinated water in a grey container pH 6.6 · chlorine · clear Gray, Gray, Gray, Gray, Gray Gray · Miss
Dark brown, muddy water sample pH 7.3 · earthy · dark brown Brown, Brown, Black, Brown, Brown Brown · Match

The clear sample was misread because the water is transparent: the algorithm picked up the grey container behind it.

The app

Three phone screens showing the camera view, crop guidance and cropping frame
Capture: the user frames the water and crops to the clearest area of colour.
Four phone screens with dropdowns for smell, living creatures and water location
Supporting inputs: smell, living creatures and location.
Phone screens showing the scanning state and a results screen with pollution sources and handling methods
Output: likely pollution sources and handling methods, with a confidence score.

Next

Colour alone cannot see dissolved oxygen (DO), one of the most important quality indicators. The next stage proposes a convolutional neural network trained on images of light-scattering patterns from samples with known DO levels. It would draw on Rayleigh scattering and use intensity, colour, texture and edge features to estimate DO from a phone camera.

Economic Efficiency of Cap-and-Trade Systems in Carbon Emissions Reduction Next case study