Codes and app for "Mountain gorillas in Virunga: a smartphone application for on device deep learning face recognition and identification"
Description
đŠ Gorilla Identifier — Project Files
Notebooks > Gorilla IA.ipynb
- Photo sorting and dataset preparation
- YOLO gorilla detection training
- ResNet50 individual identification training
- Grad-CAM heatmap visualization
Models
- best.pt → Best YOLO model (gorilla detection)
- best_model.pth → Best ResNet50 model (individual identification, 70 gorillas)
- class_names.txt → List of gorilla individual names (used with best_model.pth)
- export_pytorch_android.ipynb → Export model to Android format (Google Colab)
Android App
- gorilla_model.ptl → ResNet50 model optimized for mobile (converted from best_model.pth)
- labels.txt → Gorilla names for the app (same as class_names.txt)
- app-debug.apk → Android app (install on phone, works offline, shows Top-3 predictions)
Abstract
Mountain gorillas (Gorilla beringei beringei) are an endangered flagship species whose longâterm recovery depends on accurate, individualâlevel monitoring to inform conservation interventions, manage health risks, and quantify demographic and behavioural change. Nonâinvasive, scalable identification methods that reduce disturbance and logistical costs are therefore a high conservation priority. Here we present an onâdevice deepâlearning pipeline and Android application for automated face detection and individual recognition of mountain gorillas in Virunga National Park, developed from longitudinal photographic archives of two longâmonitored groups (Rugendo, Munyaga). Field images were acquired under a standardized protocol (Canon EOS 6D Mark II, 70–300 mm, no flash), annotated for face bounding boxes and stratified to train a YOLOv8 face detector and a ResNet50-based individual classifier (70 identities; mean ≈74 images/individual). The face achieved extremely high localisation performance (precision 99.5%, recall 99.9%), facilitating reliable crop extraction. The ResNet50 classifier demonstrated robust generalization with training/validation/test accuracies of 87.93%, 96.02% and 96.00% respectively; test set Topâ3 and Topâ5 accuracies were 98.54% and 99.35%. Aggregate perâindividual metrics on the test partition were mean precision = 0.96, mean recall = 0.96 and mean F1 = 0.96, with 90% of individuals achieving F1 ≥ 0.90. Attentionâmap and confusionâpair analyses indicate the model principally attends to biologically meaningful facial features, while residual errors stem from occlusion, extreme poses and class imbalance. The Android app performs all inference and storage locally, preserving data sovereignty and enabling offline field use. We discuss operational deployment, humanâinâtheâloop validation, and targeted dataâcollection strategies to further reduce ambiguous cases and support conservation monitoring at scale.
Keywords: individual identification; wildlife conservation; great apes, primates, embedded technology