Automating camera trap analysis for the 14 km Mount Kenya Elephant Corridor — replacing a week of manual work with a pipeline that runs in minutes.
The Problem
The wildlife corridor linking Lewa Wildlife Conservancy to Mount Kenya is one of northern Kenya's most ecologically significant landscape features — enabling free movement for elephants, Grevy's zebra, giraffe, and buffalo across an increasingly fragmented landscape.
Over 50,000 crossing events were recorded across all species in 2022 alone. Three camera traps continuously photographed this movement. The problem? Manually reviewing a single week's footage could consume up to a full week of staff time. Consistent analysis was nearly impossible to sustain at scale.
The goal: replace manual review with an automated pipeline that could detect animals by species, classify direction of movement through the corridor, and export structured count data — all in a fraction of the time.
Study Area
Three camera trap sites positioned across the full 14 km passage, capturing movement between Lewa/Ngare Ndare in the north and Mount Kenya National Reserve in the south.
How It Was Built
5,000 camera trap images compiled from the three corridor sites, supplemented with Google Images for species diversity. Each image was manually annotated in Roboflow using bounding boxes — labelling animals at species level plus background objects (bushes, rocks) to improve robustness.
A custom YOLOv8 object detection model — lewa-elephants/3 — was trained on the annotated dataset. Roboflow handled preprocessing, training, and deployment, exposing the model via an API for programmatic access.
A local Python script connected to the Roboflow API to process batches of images. Images were resized to max 1280px using Pillow, passed to the model, and predictions (species label, confidence score, bounding box coordinates) were returned for each frame.
A key design decision: the horizontal centre (x-position) of each detection's bounding box was tracked across sequential frames. Left-to-right movement classified as INTO Lewa; right-to-left as OUT OF Lewa. This prevented the same animal from being double-counted across frames.
Final species-level IN/OUT counts exported to formatted_results.csv. Images with no detections skipped automatically. Data structured for longitudinal analysis and integration with Lewa's broader ecological datasets.
Performance
Click a species to learn more about detection challenges and performance.
Select a species above to see detailed notes.
Operational Impact
The most immediate benefit is speed. What previously required up to a week of staff time can now be processed in a single session. A full month's camera trap data runs through the pipeline in minutes, dramatically increasing the frequency and consistency of corridor monitoring.
One month of footage processed in a single pipeline run, down from weeks of manual review.
Species-level IN/OUT counts enable longitudinal analysis and seasonal movement tracking.
Pipeline architecture accommodates new camera placements or additional species classes.
Comparative test against manual count: within +3 inbound / -10 outbound over 300+ images.