← all researchresearch, explained simply

Counting
Bacteria

My undergraduate thesis, explained for anyone, no science or tech background needed. The short version: we taught a computer to count bacteria so people don't have to do it by eye.

the problem

Counting dots by hand

To check if water or food is contaminated, labs put a sample on a dish of jelly (called agar) and let any bacteria grow. Each bacterium multiplies into a little dot you can see, called a colony.

Count the dots, and you know roughly how much bacteria was in the sample. Today, people usually count them by eye. It's slow and tiring, and two people counting the same dish often get different numbers.

1, 2, 3… wait, was that 47?

Our goal: a program that looks at a photo of the dish and counts the dots for you. We focused on E. coli, a common bacterium used to check for contamination.

what we did, in three steps:

step 1

We made our own photo collection

Lab staff at Davao Oriental State University grew E. coli from water samples taken from campus faucets, and we photographed the dishes.

We then went through every photo, threw out the blurry, repeated, and overcrowded ones, and drew a box around every single dot on 130 of them. That's how you show a computer what the right answer looks like.

~1,900photos taken364usable130labeled
step 2

We cleaned up the photos so the dots are easier to count

A computer doesn't "see" dots the way we do. It just sees colored pixels. That causes two common mistakes, so we combined two techniques to fix them:

Problem 1: two dots touching look like one. Imagine two coins touching on a table. Trace around them and you get one peanut shape, so you'd count 1 instead of 2. The Watershed technique finds the middle of each dot and draws a dividing line where they touch, so the computer counts 2.

Problem 2: one dot looks broken into pieces. Glare or a blurry spot can leave gaps, so one dot looks like two or three bits. The Falling-Ball technique smooths the edges and fills those gaps, like coloring in the missing spots, so it's counted as 1 clean dot.

problem 1: touching dotscomputer sees: 1?counted: 2 ✓problem 2: broken dotcomputer sees: 3?counted: 1 ✓
step 3

We trained an AI to spot the dots

We used YOLOv5, an AI model that's already good at finding objects in photos. Instead of teaching it from scratch, we gave it extra training on our bacteria photos.

Think of a jeepney driver who already knows how to drive. You don't teach them driving all over again, you just teach them a new route. Reusing what an AI already knows like this is called transfer learning.

count:16

what we found

About 6 in 10

of the dots the AI flagged were real colonies (its best run).

About half

of all the colonies on a dish were found.

Up to 75%

detection accuracy at its best, as reported in the paper.

That's a promising first version, especially since it learned from only 130 labeled photos. More examples would likely help it improve.

what we couldn't finish

Our computers weren't big enough

We wanted to train the AI on the cleaned-up photos from step 2, but that needed far more computer memory than we had. Even the basic training needed 19 to 24 GB of memory.

So the biggest open question, whether the cleanup step makes the AI more accurate, is still waiting for someone with a more powerful computer.

needs 19–24 GB… we had less

Why it matters: faster, more consistent counting could help with food safety checks, water testing, and hospital labs, anywhere people still count bacteria by hand.

the thesis

Automated Bacteria Colony Counting Using Hybrid Image Segmentation Algorithm Framework and YOLOv5 Transfer Learning Model

Audrey Carmel Jay J. Nanual•Reznee Mariel R. Galope

thesis adviser: Cherry B. Lisondra, MIT

BS Computer Science•Mapúa Malayan Colleges Mindanao

Later published in IJIRMPS, Special Issue IPMESS-24 (January 2024).

read the published version ↗
next up: credentials →