Built to order

Snake Species Identification from Photos using CNN (SnakeCLEF Dataset)

This project trains a convolutional neural network on the SnakeCLEF 2021 challenge dataset to identify snake species from a single photograph, returning the predicted species with per-class probabilities and a species information card covering venom status, region and identifying features. It ships with a complete training notebook, the trained weights, an evaluation suite with confusion matrix and per-class metrics, and a working web demo with photo upload. Every result screen carries a prominent safety disclaimer: the system is an educational prototype and must never be used for real

AI & Machine Learning Jupyter notebookPython 3scikit-learn metricsHTML5 · CSS · JavaScript demoGrad-CAM explainabilityPyTorch · torchvision/timmSnakeCLEF 2021 datasetEfficientNet-B3 CNNSoftware
Snake Species Identification from Photos using CNN (SnakeCLEF Dataset) — project thumbnail preview
More project photos (2)

The problem

Telling a venomous snake from a harmless lookalike is genuinely hard: an Indian rat snake can pass for a cobra at a glance, and kraits are most active at night when visibility is worst. Field guides help only if the observer already knows what to look at, and generic image classifiers trained on a few clean stock photos collapse on real field photos with cluttered backgrounds, partial bodies and harsh lighting. The SnakeCLEF challenge (CLEF / LifeCLEF, hosted on AIcrowd) turned this into a proper benchmark: its 2021 release contains 414,424 photographs of 772 snake species from 188 countries, sourced from iNaturalist, HerpMapper and Flickr, with a heavy long-tailed class distribution. This project builds the complete fine-grained classification pipeline on that dataset — a curated regionally-relevant species subset, transfer learning from an ImageNet-pretrained EfficientNet-B3 backbone, class-weighted training for the long tail, and a web demo that presents predictions with full probability distributions and species cards. The safety framing is part of the engineering: the demo is explicitly an educational prototype, not a field identification tool.

SYSTEM FLOW

5 components 6 connections

Live flow
Drag to explore
100%
storageSnakeCLEF 2021

Curated regionally-relevant species subset with a stratified train and validation split.

Follow the working sequence

How it works

  1. The SnakeCLEF 2021 release is downloaded from AIcrowd; a curated subset of regionally-relevant species is selected, unreadable and non-snake images are cleaned, and a stratified train/validation split is created.
  2. Training applies augmentation — random crops, flips, rotations, colour jitter and CutMix — so the model tolerates messy real field photos.
  3. The EfficientNet-B3 backbone (ImageNet-pretrained) is fine-tuned with a dropout + dense + softmax head, using AdamW, a cosine learning-rate schedule, label smoothing and class-weighted loss for the long tail.
  4. The best weights are checkpointed on validation accuracy; the held-out split is then scored once for top-1/top-5 accuracy, per-class precision/recall/F1 and the confusion matrix.
  5. In the web demo, an uploaded or sample photo is EXIF-corrected, resized to 300×300 and normalized identically to training data, then passed through the exported weights.
  6. The app renders the predicted species with confidence, the top-5 probability bars, the species information card, and the safety disclaimer on every result.

Tech stack:

  • Python 3, PyTorch, torchvision/timm
  • scikit-learn, Matplotlib (metrics & plots)
  • Jupyter Notebook (training & evaluation)
  • HTML5 + CSS + JavaScript (photo-upload web demo)
  • SnakeCLEF 2021 dataset (AIcrowd / CLEF LifeCLEF)

Dataset & model details

  • Dataset: SnakeCLEF 2021 (CLEF / LifeCLEF, hosted on AIcrowd) — 414,424 photographs of 772 snake species from 188 countries, sourced from iNaturalist, HerpMapper and Flickr (noisy web-scraped subset), plus 28,418 expert-identified test images from private collections and museums. Official split: 347,406 train / 38,601 validation. Heavy long tail: the most frequent species (Thamnophis sirtalis) has ~22,000 images; the rarest (Achalinus formosanus) has ~10. The built-to-order training run uses a curated regionally-relevant subset (design target ~40–60 species) with a stratified split.
  • Task: Fine-grained image classification; input = 300×300×3 photo, output = probability distribution over the trained species classes.
  • Model: EfficientNet-B3 backbone (~12M parameters) pretrained on ImageNet and fine-tuned, with global average pooling, dropout and a dense softmax head; AdamW optimizer, cosine LR schedule, label smoothing, class-weighted cross-entropy.
  • Metrics: Top-1 accuracy ~78–85% and top-5 ~93–96% as design targets for the built-to-order training run, plus per-class precision/recall/F1 and confusion matrix. No accuracy is claimed as measured until the training run is executed for the order.
Parameter Value
Input format 300 × 300 RGB photo, ImageNet-normalized
Classes Curated subset, design target ~40–60 species
Backbone EfficientNet-B3, ~12M parameters (published figure)
Top-1 accuracy ~78–85% (design target, not a measured claim)
Top-5 accuracy ~93–96% (design target, not a measured claim)
Inference ~40–60 ms per photo on laptop CPU, ~12 ms on GPU (expected)
Model file ~45 MB exported weights (expected)
Training hardware GPU required (Colab/Kaggle free tier sufficient); CPU-only training not practical
Demo Single-file web app with photo upload; runs the exported weights

Project features

  • [Transfer-learning CNN] EfficientNet-B3 pretrained on ImageNet, fine-tuned on the curated SnakeCLEF subset with a dropout + dense + softmax head — documented layer by layer for the viva.
  • [Curated species subset] A regionally-relevant subset (design target ~40–60 species) drawn from SnakeCLEF 2021 with a stratified train/validation split and published class counts, so training is feasible on student-grade GPUs.
  • [Per-class probabilities + species card] The demo shows the top-5 probability bars plus a card with venom badge, venom type, region, key identifying features and commonly-confused species.
  • [Photo upload demo] Upload any snake photo or pick from 8 built-in sample field photos; the pipeline preprocesses it exactly like training data before inference.
  • [Safety-first UI] Every result screen carries the educational-prototype disclaimer — the project treats responsible framing as a feature, not a footnote.
  • [Full training notebook] Data curation, augmentation, model definition, AdamW + cosine-schedule training loop, checkpointing and evaluation in one reproducible notebook.
  • [Confusion matrix & per-class metrics] Precision, recall and F1 per species, so the viva can discuss exactly which species pairs confuse the model (typically cobra/rat snake, viper/python).
  • [Grad-CAM explainability] Activation heatmaps showing which image regions drove each prediction — a strong viva talking point on model interpretability.

What is included

  • Complete training & evaluation Jupyter notebook (curation, augmentation, training loop, metrics)
  • Trained CNN weights with the preprocessing/inference pipeline
  • Photo-upload web demo with per-class probabilities and species information cards
  • Confusion matrix, per-class metrics and Grad-CAM visualizations
  • Project report PDF (background, dataset analysis, architecture rationale, methodology, results)
  • PPT presentation for final review
  • Viva Q&A preparation document (CNNs, transfer learning, fine-grained classification, long-tailed data, evaluation metrics)

Limitations & prerequisites

  • This is an educational/prototype build — it must NEVER be used for real snakebite identification decisions; always consult herpetology experts and medical professionals for any real encounter.
  • The trained model covers only the curated subset (~40–60 species), not all 772 SnakeCLEF classes — species outside the subset cannot be identified.
  • Long-tailed classes with few training images are expected to score lower; the report shows per-class metrics honestly rather than hiding weak classes.
  • Heavy occlusion, extreme blur or night-flash photos outside the training distribution can misclassify; the top-5 list is shown precisely so uncertainty is visible.
  • The browser front-end demo simulates the trained pipeline's output format — the real trained weights ship with the order and run in the Python inference code.
  • Accuracy figures are design targets stated honestly — the report documents the actual achieved figures after the training run for the order.

Frequently Asked Questions

Which dataset is used and why?

SnakeCLEF 2021 from the CLEF/LifeCLEF challenge, hosted on AIcrowd: 414,424 photos of 772 species from 188 countries, drawn from iNaturalist, HerpMapper and Flickr. It is the standard public benchmark for snake species identification, with real field photos and a realistic long-tailed class distribution.

Why train on a subset instead of all 772 species?

The full 772-class problem needs serious GPU time and careful long-tail engineering beyond a student training budget. A curated ~40–60 species subset keeps training feasible on free-tier GPUs while teaching the exact same pipeline; the report documents how to scale toward the full set.

How does the demo classify my uploaded photo?

The photo is EXIF-corrected, resized to 300×300 and normalized exactly like training data, passed through the exported model weights, and the app shows the predicted species with the top-5 probability bars and a species card (venom status, region, ID features).

Which species does the model confuse most?

Typically visually similar pairs — cobra vs rat snake, Russell's viper vs python, krait vs wolf snake. The confusion matrix in the report makes this explicit and it is one of the strongest viva discussion points.

Can this app be used to identify a real snake I found?

No — and the demo says so on every screen. It is an educational prototype for learning fine-grained classification. For any real snake encounter, keep distance and contact local wildlife/herpetology experts or medical professionals.

Is this project suitable for a final-year project?

Yes — for Computer Science, AI & Machine Learning and related programs. It demonstrates transfer learning, fine-grained classification, long-tailed dataset handling, rigorous evaluation and a deployed demo, plus responsible AI framing around a safety-critical use case. Suitable for B.E./B.Tech final-year projects in Computer Science, AI & Machine Learning and related branches.

Components & software requirements
  • Python 3, PyTorch, torchvision/timm
  • scikit-learn, Matplotlib (metrics & plots)
  • Jupyter Notebook (training & evaluation)
  • HTML5 + CSS + JavaScript (photo-upload web demo)
  • SnakeCLEF 2021 dataset (AIcrowd / CLEF LifeCLEF)

Dataset & model details

  • Dataset: SnakeCLEF 2021 (CLEF / LifeCLEF, hosted on AIcrowd) — 414,424 photographs of 772 snake species from 188 countries, sourced from iNaturalist, HerpMapper and Flickr (noisy web-scraped subset), plus 28,418 expert-identified test images from private collections and museums. Official split: 347,406 train / 38,601 validation. Heavy long tail: the most frequent species (Thamnophis sirtalis) has ~22,000 images; the rarest (Achalinus formosanus) has ~10. The built-to-order training run uses a curated regionally-relevant subset (design target ~40–60 species) with a stratified split.
  • Task: Fine-grained image classification; input = 300×300×3 photo, output = probability distribution over the trained species classes.
  • Model: EfficientNet-B3 backbone (~12M parameters) pretrained on ImageNet and fine-tuned, with global average pooling, dropout and a dense softmax head; AdamW optimizer, cosine LR schedule, label smoothing, class-weighted cross-entropy.
  • Metrics: Top-1 accuracy ~78–85% and top-5 ~93–96% as design targets for the built-to-order training run, plus per-class precision/recall/F1 and confusion matrix. No accuracy is claimed as measured until the training run is executed for the order.
Delivery information

Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.

Support terms

Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.

Download free synopsis (PDF)

Enter your name and email — the synopsis PDF downloads immediately. We may send occasional project updates; no spam, unsubscribe anytime.

Get a quotation