Capstone instrument · 03
AI-Based Insect Detection System
A Malaise trap that photographs insects instead of killing them. Mesh wings funnel flying insects into a lit photo chamber; two YOLOv8 models on a Jetson Nano classify what walks in by 4 orders and 10 families at close to 95% accuracy; Grad-CAM confirms they are looking at the insect, not the backdrop.
Problem
Counting insects is destructive, slow, and done by hand.
The standard tool for surveying flying insects is a Malaise trap: a tent of mesh that intercepts insects in flight and funnels them upward into a collection jar. It works, but the sample is dead by the time anyone sees it, and identification is a human sitting at a microscope weeks later.
We kept the trap's geometry and replaced its endpoint. Instead of a jar, insects arrive at a photo chamber. The instrument images them under controlled lighting, classifies them on the spot, and lets them go.
The hard part was never the model. It was building a chamber where the same insect looks the same twice.
Approach
- Trap workflow. A Malaise-inspired structure that funnels flying insects into a photo chamber rather than a kill jar.
- Controlled lighting. ESP32-driven LED panels behind a diffuser, so exposure and colour are a constant rather than a variable.
- Edge computing. Jetson Nano processing on the trap itself — no network dependency in a field where there isn't one.
- Two YOLOv8 models. A staged pipeline classifying to 4 orders and 10 families, reaching close to 95% accuracy, rather than one model asked to do everything at once.
- Grad-CAM validation. Heat maps over each decision, alongside confidence scores, to check the model is attending to the insect.
- A structure that had to stand up outdoors. Iterated through CAD revisions from simple ground stakes to a freestanding wooden frame with custom 3D-printed joints.
Signal chain
From a moth in flight to a labelled record.
Every stage exists to remove a variable from the one after it.
Hardware
Built to sit outside and keep working.
Select an image to open it full size.
Addressable LED strips behind a diffuser, so the chamber is lit the same way every time.
Across 4 orders and 10 families, inferred on the instrument itself — no connectivity assumed in the field.
Latched and hinged — openable for service in the field, closed the rest of the time.
Evidence
A bee entering the trap.
Recorded during field testing. This is the moment the whole instrument is built around.
Field test footage — a bee entering the trap. Original capture re-encoded to H.264 for browser playback; the source file remains available here.
Validation
Why Grad-CAM was non-negotiable
A classifier can be right for the wrong reason. Trained on images from one chamber under one lighting rig, a model can quietly learn the chamber instead of the insect — and it will score beautifully right up until the day the backdrop changes.
Grad-CAM produces a heat map of which pixels drove a given prediction. Reading those alongside the confidence score turns "the model says bee" into "the model says bee, and it is looking at the bee." That distinction is the difference between a demo and an instrument.
Reception
Where it has been shown
- Demonstrated to engineering leadership at Penn State and at Ohio State.
- Research is in progress toward an official publication.
What I owned
The instrument side: the imaging chamber and lighting behaviour, the enclosure that has to open for service and close against weather, and the pipeline that carries an image from the camera to a labelled, validated record.