OrangIdentifier

Individual facial recognition for Bornean orangutans, from raw photographs to an offline Android deployment.

Overview

This project trains a face detector and an individual identification model from labeled photographs, then exports the result as a lightweight gallery JSON for an Android app that runs entirely offline. The gallery holds one embedding vector per individual. Adding a new individual requires 10 to 20 photos, takes under a minute, and requires no retraining.

Inference pipeline

Raw photo -> YOLO v2 face detection (mAP@50 = 99.4%)
          -> 224x224 crop
          -> MegaDescriptor-T-224 (Swin Transformer, 768-dim embedding)
          -> cosine similarity vs gallery
          -> Known individual (sim >= threshold) or Unknown (sim < threshold)

Android app assets

This repository also hosts the exported models and the gallery database required to run the offline Android app. To build the app, download these three files from the main branch and place them in app/src/main/assets/ of the Android project:

  • gallery.json : the identity database (embedding prototypes).
  • yolo_v2_detector.tflite : the YOLO face detector.
  • megadesc_v6_backbone.tflite : the V6 MegaDescriptor-T embedding backbone (112 MB).

Models

File Version Size Description
yolo_v1_nano_mAP92.pt V1 6 MB YOLO nano, mAP@50 = 91.98%
yolo_v2_medium_mAP99.pt V1 to V6 85 MB YOLO medium, mAP@50 = 99.39%
resnet50_classifier_10classes_acc96.pt V1 90 MB Closed-set classifier
resnet50_backbone_2048dim.pt V2 90 MB Embedding backbone, 2048-dim
megadesc_T_arcface_final_epoch21_acc99.pt V3 105 MB ArcFace, 10 individuals
megadesc_T_arcface_v4_40individuals_acc99.pt V4 105 MB ArcFace, 40 individuals
megadesc_T_arcface_v5_invariance_acc99.pt V5 105 MB ArcFace + invariance, 40 individuals
megadesc_T_arcface_v6_15ind_acc98.pt V6 (production) 105 MB Zoo only, 15 individuals, deployed
megadesc_v6_backbone.tflite V6 (app) 112 MB V6 backbone for the Android app
yolo_v2_detector.tflite app 22 MB YOLO detector for the Android app
gallery.json app 6.3 MB Identity database for the Android app

Performance

The versions were compared with a single fair evaluation: same session-level train/test split, galleries rebuilt identically, and each version scored for open-set rejection only on identities it never saw during training. Numbers below are on the 10 zoo individuals common to every version.

V1 V2 V3 V4 V5 V6
Backbone ResNet50 ResNet50 MegaDescriptor-T MegaDescriptor-T MegaDescriptor-T MegaDescriptor-T
Supervised individuals 10 10 10 40 40 15
Clean identification 96.5% 96.5% 99.2% 99.2% 99.7% 99.2%
Separability gap 0.23 0.23 0.85 0.86 0.91 0.88
Unknown rejection (ROC AUC) 0.83 0.83 0.998 0.99 0.99 0.999
Identification under moderate blur 77% 77% 11% 11% 95% 93%

Notes. A version is only scored for rejection on individuals it never learned: V1, V2, V3 and V6 against the rescue-center (BOS) animals, V4 and V5 against the 5 new zoo individuals (they were trained on the BOS animals, so a BOS rejection figure would be data leakage). Clean identification on good zoo crops saturates from V3 onward; the real separation between versions appears under degradation, where the invariance training introduced in V5 keeps V5 and V6 above 90% while V3 and V4 fall to chance. V6 is the deployed production model.

Dataset

Source Individuals Crops Role
Captive collection (zoo) 15 2,127 + 865 Training (known)
Field rescue center (BOS) 30 1,622 Supervised in V4/V5, unknown test set for V3/V6
Internet (iNaturalist, GBIF, web) unlabeled 5,429 Background class

Images are not included.

Download

from huggingface_hub import hf_hub_download

path = hf_hub_download(
    repo_id="tit0000/OrangIdentifier",
    filename="megadesc_T_arcface_v6_15ind_acc98.pt",
)

Or via the pipeline:

python models/download_models.py --version all

Security note

These .pt files are standard PyTorch and Ultralytics checkpoints. The pickle imports flagged by Hugging Face come from trusted libraries (torch, ultralytics, collections) and contain no malicious code.

References

  • Čermák et al. (2024). WildlifeDatasets. WACV 2024.
  • Deng et al. (2019). ArcFace. CVPR 2019.
  • Deng et al. (2020). Sub-center ArcFace. ECCV 2020.
  • Liu et al. (2021). Swin Transformer. ICCV 2021.
  • Jocher et al. (2023). Ultralytics YOLO.
Downloads last month
9
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support