All projects

Pollinator Identification: building an AI challenge

How do you test a model fairly when neighboring video frames look almost the same?

Summary

We designed and launched a machine learning competition on Codabench for recognizing pollinator species in camera footage of flowers. The hardest part was not the model but the test set: splitting the data so that a good score means the model recognizes insects, not camera angles.

Year
2026
Team
6 people
Duration
2 months
Tools
Python, NumPy, scikit-learn, Codabench, PyTorch
Six consecutive video frames of a bumblebee on a flower, all taken from the same camera.

Six frames in a row from one camera. A random train/test split would put almost identical images on both sides.

Key results

The problem

Different pollinators matter for different crops, and spotting invasive species early protects them, so farmers and researchers need models that can tell insects apart in camera footage. INRAE filmed flowers with up to 31 cameras from different angles, and the frames were turned into 1,536-number feature vectors with a pretrained ResNet. Our job was to turn this into a fair competition: a task, a dataset split, a metric, a baseline and a scoring program that other students could submit to.

What we did

  1. Measured how similar the frames are. Two frames of the same species from the same camera have a cosine similarity of about 0.79 on average and up to 0.99, so a random split would leak and even a simple nearest-neighbor model would look nearly perfect.
  2. Cleaned the labels: removed “no insect” (over 99% of frames), the vague “other” class, and two species filmed from only one angle, leaving 7 species.
  3. Split by species and camera angle instead of by frame, so a species is never tested on an angle it was trained on. Phase 1 tests on angles the model saw for other species; Phase 2 only on angles it never saw at all.
  4. Chose Macro F1 as the metric, so rare species like the bumblebee count as much as common ones.
  5. Ran a grid search over logistic regression, random forest, KNN and SVM with different PCA sizes, with bootstrapped confidence intervals. Picked a random forest on 100 PCA components as a simple, reproducible baseline.
  6. Deployed everything on Codabench (data, scoring and ingestion programs, starting kit) and ran the competition in two phases.
Grid of species by camera angle showing which angles were used for training, Phase 1 testing and Phase 2 testing.
Each square is one species filmed from one camera angle. No species is tested on an angle it was trained on.

Results

The split did its job and exposed how hard the task is: the baseline drops from 0.23 to 0.07 Macro F1 on unseen angles. The confusion matrices show the model mostly predicts the most common species (hoverfly), and species filmed from only one training angle do not generalize.

In the second half of the course we solved another team’s challenge: classifying 8 wheat grain varieties from images. A random forest on raw pixels reached 0.36 Macro F1, a small CNN 0.44, and an EfficientNet pretrained on ImageNet 0.74.

What I learned