Max Krehbiel

All projects

Camera Trap Pipeline

Our trail cameras on Heart 7 took about 13,000 photos. A lot of them are empty, and one deer walking past shows up as a burst of several frames. I built a pipeline that sets the empty photos aside, isolates each animal in its own box and identifies the species from that crop.

Photos from the same visit are grouped, so one deer counts once, not once per photo. It also flags camera problems, like a clock that reset when the batteries died or a camera that went dark for days, and it saves its progress after every step so a crashed run picks up where it stopped.

Camera Trap Pipeline: example output

View the code (opens in a new tab)Read the README (opens in a new tab)Open the live report (opens in a new tab)

The problem

Turn folders of trail-camera photos, with empty frames, bursts, reset clocks and dead cameras, into counts that can be trusted.

What I built

A resumable pipeline: photo quality checks and near-duplicate grouping, MegaDetector to box each animal, SpeciesNet to identify the species in each box, and grouping of each camera's bursts into visits.

What it produces

Tables of photos, detections, species and visits, per-camera health checks, charts and an HTML report.

The public version runs on drawn, synthetic photos with the same field problems planted in them.

The demo photos are drawn by code, with planted field problems. Real public camera-trap data can be fetched separately.

In pictures

Independent sightings per species after grouping photo bursts; white-tailed deer lead with 37 events in the synthetic set.
Share of each species' events by hour: raccoons, opossums and coyotes cluster at night, while turkeys and squirrels are active by day. Synthetic data.
Events per species at each of the three synthetic cameras; darker cells mean more events.
Photos per camera per day, with the 3.2-day silence on cam_03 flagged. The photos and the outage are synthetic.

How it works

  1. Ingest. Resolves each photo's camera and capture time, and flags unreadable files and unset clocks.
  2. Quality. Scores sharpness, brightness and night shots, and groups near-duplicates.
  3. Detect. Finds animal, person and vehicle boxes with MegaDetector.
  4. Classify. Labels each animal with SpeciesNet's top species, rolling up when the model is unsure.
  5. Events. Groups each camera's bursts into sightings and counts animals per species.
  6. Report. Species totals, activity by hour, camera health, charts and one HTML page.

Where to look in the code

README sections

Files