Lab 3 · Run YOLO and MegaDetector on Oregon Critters

Worth: 20 points  |  Due: end of Day 2  |  Files to submit: detections_megadetector.csv, detections_yolov8.csv, pr_curves.png, and a 1-page PDF.
Pre-reading: YOLO & Darknet tutorial.

Biological motivation

Most camera-trap workflows in 2026 start with a "where is the animal?" detector before any species classifier. MegaDetector is the standard baseline. In this lab you'll compare MegaDetector v5 to a generic Ultralytics YOLOv8 on the same image set and reason about the precision/recall tradeoff for an ecologist's actual workflow.

Data

Get the data: aiecol_cameratraps.zip (297 MB) — or the full bundle aiecol_data_sample.zip (395 MB). See the downloads page for layout.

A 2,000-image evaluation set drawn from Oregon Critters with hand-drawn ground-truth bounding boxes for every animal. Provided as oregon_critters_eval/{images,labels_yolo}/ in YOLO format.

Tasks

Task 1 — MegaDetector baseline (5 pts)

Install the megadetector package:

pip install megadetector
megadetector run_detector_batch \
    --model_file MDV5A.0.0.pt \
    --image_dir oregon_critters_eval/images \
    --output_file detections_megadetector.json \
    --recursive

Convert the JSON to a tidy CSV with the columns image, class_id, class_name, confidence, x1, y1, x2, y2.

Task 2 — YOLOv8 generic (4 pts)

Run detect_oregon_critters.py with yolov8s.pt. (Note: YOLOv8 generic is trained on COCO — classes like "dog", "horse", "bear". It will mis-classify many Oregon species, but for detection only we'll collapse all classes to "animal".)

Task 3 — precision-recall curves (5 pts)

Match each predicted box to a ground-truth box at IoU ≥ 0.5. For each model:

A helper function for IoU is in iou_utils.py.

Task 4 — pick a threshold (3 pts)

You're advising a biologist who has 800,000 camera-trap images and will hand-verify every above-threshold detection. They can verify ~5,000 images. Which threshold do you recommend for MegaDetector to keep their workload under budget while losing as few real animals as possible? Show the math.

Task 5 — interpretation (3 pts)

In 150 words: where does each detector fail? Small animals far away? Cropped/edge animals? Glare? Show 2–3 thumbnails of failure modes in your PDF.

Go-further

Repeat the analysis stratified by daytime vs nighttime (use your Lab 2 classifier!) and report whether either detector is meaningfully worse at night.

Rubric

ComponentPoints
Both detectors run and produce tidy CSVs9
P-R curves correctly computed and plotted4
Threshold recommendation with quantitative justification3
Interpretation4
Total20