tit0000 commited on
Commit
6a815cb
·
verified ·
1 Parent(s): 84e3b48

Replace HF repo with V1-V6 models, app assets and updated card

Browse files
README.md CHANGED
@@ -1,6 +1,8 @@
1
  ---
2
  license: mit
3
  tags:
 
 
4
  - wildlife
5
  - animal-re-identification
6
  - face-recognition
@@ -13,64 +15,82 @@ pipeline_tag: image-feature-extraction
13
 
14
  # OrangIdentifier
15
 
16
- **Individual facial recognition for Bornean orangutans** — end-to-end pipeline from raw photographs to offline Android deployment.
17
 
18
- Source code (ML Pipeline): [github.com/tit-exe/OrangIdentifier](https://github.com/tit-exe/OrangIdentifier)
19
- Source code (Android App): [github.com/tit-exe/OrangIdentifier-Android](https://github.com/tit-exe/OrangIdentifier-Android)
20
 
21
  ## Overview
22
 
23
- This pipeline 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.
24
-
25
- The gallery is a JSON file containing one averaged embedding vector per individual. Adding a new individual requires 10–20 photos, takes under a minute, and requires no retraining.
26
-
27
- ## Android App Assets
28
-
29
- This repository also hosts the exported `.tflite` models and the gallery database required to run the **offline Android app**.
30
-
31
- If you are building the Android app, download these three files from the `main` branch and place them in the `app/src/main/assets/` folder of the Android project:
32
- - `gallery.json`: The database containing the identity prototypes.
33
- - `yolo_v2_detector.tflite`: The optimized YOLO face detector model.
34
- - `megadesc_T_arcface_backbone.tflite`: The MegaDescriptor-T embedding backbone (112 MB).
35
 
36
  ## Inference pipeline
37
 
38
  ```
39
- Raw photo YOLO face detection (mAP@50=99.4%)
40
- 224×224 crop
41
- MegaDescriptor-T-224 (Swin Transformer, 768-dim embedding)
42
- Cosine similarity vs gallery
43
- Known individual (sim 0.22) or Unknown (sim < 0.22)
44
  ```
45
 
 
 
 
 
 
 
 
 
 
 
46
  ## Models
47
 
48
- | File | Used in | Size | Description |
49
  |------|---------|------|-------------|
50
- | `yolo_v1_nano_mAP92.pt` | V1 | 6 MB | YOLO nano mAP@50 = 91.98% |
51
- | `yolo_v2_medium_mAP99.pt` | V1–V4 | 85 MB | YOLO medium mAP@50 = 99.39% |
52
- | `resnet50_classifier_10classes_acc96.pt` | V1 | 90 MB | Closed-set classifier, acc = 96.3% |
53
  | `resnet50_backbone_2048dim.pt` | V2 | 90 MB | Embedding backbone, 2048-dim |
54
  | `megadesc_T_arcface_final_epoch21_acc99.pt` | V3 | 105 MB | ArcFace, 10 individuals |
55
- | `megadesc_T_arcface_v4_40individuals_acc99.pt` | V4 | 105 MB | ArcFace, 40 individuals |
 
 
 
 
 
56
 
57
  ## Performance
58
 
59
- | | V1 | V2 | V3 | **V4** |
60
- |--|----|----|----|----|
61
- | Backbone | ResNet50 | ResNet50 | MegaDescriptor-T | **MegaDescriptor-T** |
62
- | Supervised individuals | 10 | 10 | 10 | **40** |
63
- | Closed-set accuracy | 96.3% | ~98% | 99.2% | **99.2%** |
64
- | Unknown rejection (1,622 unseen crops) || 27.5% | 97.5% | **97.5%** |
65
- | Wild internet rejection | | 48.5% | 93.2% | **93.0%** |
66
- | Separability gap | | 0.294 | 0.883 | **0.885** |
 
 
 
 
 
 
 
 
 
 
 
67
 
68
  ## Dataset
69
 
70
  | Source | Individuals | Crops | Role |
71
  |--------|-------------|-------|------|
72
- | Captive collection | 10 | 2,127 | Training (known) |
73
- | Field rescue center | 30 | 1,622 | Open-set test only |
74
  | Internet (iNaturalist, GBIF, web) | unlabeled | 5,429 | Background class |
75
 
76
  Images are not included.
@@ -82,20 +102,21 @@ from huggingface_hub import hf_hub_download
82
 
83
  path = hf_hub_download(
84
  repo_id="tit0000/OrangIdentifier",
85
- filename="megadesc_T_arcface_v4_40individuals_acc99.pt"
86
  )
87
  ```
88
 
89
  Or via the pipeline:
 
90
  ```bash
91
- python models/download_models.py
92
  ```
93
 
94
  ## Security note
95
 
96
- These `.pt` files are standard PyTorch/Ultralytics checkpoints. The pickle imports
97
- flagged by HuggingFace are all from trusted libraries (torch, ultralytics, collections)
98
- and contain no malicious code.
99
 
100
  ## References
101
 
@@ -103,4 +124,4 @@ and contain no malicious code.
103
  - Deng et al. (2019). ArcFace. CVPR 2019.
104
  - Deng et al. (2020). Sub-center ArcFace. ECCV 2020.
105
  - Liu et al. (2021). Swin Transformer. ICCV 2021.
106
- - Jocher et al. (2023). Ultralytics YOLOv8.
 
1
  ---
2
  license: mit
3
  tags:
4
+ - image-feature-extraction
5
+ - LiteRT
6
  - wildlife
7
  - animal-re-identification
8
  - face-recognition
 
15
 
16
  # OrangIdentifier
17
 
18
+ Individual facial recognition for Bornean orangutans, from raw photographs to an offline Android deployment.
19
 
20
+ - Source code (ML pipeline): https://github.com/tit-exe/OrangIdentifier
21
+ - Source code (Android app): https://github.com/tit-exe/OrangIdentifier_AndroidApp
22
 
23
  ## Overview
24
 
25
+ This project trains a face detector and an individual identification model from labeled
26
+ photographs, then exports the result as a lightweight gallery JSON for an Android app that
27
+ runs entirely offline. The gallery holds one embedding vector per individual. Adding a new
28
+ individual requires 10 to 20 photos, takes under a minute, and requires no retraining.
 
 
 
 
 
 
 
 
29
 
30
  ## Inference pipeline
31
 
32
  ```
33
+ Raw photo -> YOLO v2 face detection (mAP@50 = 99.4%)
34
+ -> 224x224 crop
35
+ -> MegaDescriptor-T-224 (Swin Transformer, 768-dim embedding)
36
+ -> cosine similarity vs gallery
37
+ -> Known individual (sim >= threshold) or Unknown (sim < threshold)
38
  ```
39
 
40
+ ## Android app assets
41
+
42
+ This repository also hosts the exported models and the gallery database required to run the
43
+ offline Android app. To build the app, download these three files from the `main` branch and
44
+ place them in `app/src/main/assets/` of the Android project:
45
+
46
+ - `gallery.json` : the identity database (embedding prototypes).
47
+ - `yolo_v2_detector.tflite` : the YOLO face detector.
48
+ - `megadesc_v6_backbone.tflite` : the V6 MegaDescriptor-T embedding backbone (112 MB).
49
+
50
  ## Models
51
 
52
+ | File | Version | Size | Description |
53
  |------|---------|------|-------------|
54
+ | `yolo_v1_nano_mAP92.pt` | V1 | 6 MB | YOLO nano, mAP@50 = 91.98% |
55
+ | `yolo_v2_medium_mAP99.pt` | V1 to V6 | 85 MB | YOLO medium, mAP@50 = 99.39% |
56
+ | `resnet50_classifier_10classes_acc96.pt` | V1 | 90 MB | Closed-set classifier |
57
  | `resnet50_backbone_2048dim.pt` | V2 | 90 MB | Embedding backbone, 2048-dim |
58
  | `megadesc_T_arcface_final_epoch21_acc99.pt` | V3 | 105 MB | ArcFace, 10 individuals |
59
+ | `megadesc_T_arcface_v4_40individuals_acc99.pt` | V4 | 105 MB | ArcFace, 40 individuals |
60
+ | `megadesc_T_arcface_v5_invariance_acc99.pt` | V5 | 105 MB | ArcFace + invariance, 40 individuals |
61
+ | `megadesc_T_arcface_v6_15ind_acc98.pt` | **V6 (production)** | 105 MB | Zoo only, 15 individuals, deployed |
62
+ | `megadesc_v6_backbone.tflite` | V6 (app) | 112 MB | V6 backbone for the Android app |
63
+ | `yolo_v2_detector.tflite` | app | 22 MB | YOLO detector for the Android app |
64
+ | `gallery.json` | app | 6.3 MB | Identity database for the Android app |
65
 
66
  ## Performance
67
 
68
+ The versions were compared with a single fair evaluation: same session-level train/test split,
69
+ galleries rebuilt identically, and each version scored for open-set rejection only on identities
70
+ it never saw during training. Numbers below are on the 10 zoo individuals common to every version.
71
+
72
+ | | V1 | V2 | V3 | V4 | V5 | V6 |
73
+ |---|---|---|---|---|---|---|
74
+ | Backbone | ResNet50 | ResNet50 | MegaDescriptor-T | MegaDescriptor-T | MegaDescriptor-T | MegaDescriptor-T |
75
+ | Supervised individuals | 10 | 10 | 10 | 40 | 40 | 15 |
76
+ | Clean identification | 96.5% | 96.5% | 99.2% | 99.2% | 99.7% | 99.2% |
77
+ | Separability gap | 0.23 | 0.23 | 0.85 | 0.86 | 0.91 | 0.88 |
78
+ | Unknown rejection (ROC AUC) | 0.83 | 0.83 | 0.998 | 0.99 | 0.99 | 0.999 |
79
+ | Identification under moderate blur | 77% | 77% | 11% | 11% | 95% | 93% |
80
+
81
+ Notes. A version is only scored for rejection on individuals it never learned: V1, V2, V3 and V6
82
+ against the rescue-center (BOS) animals, V4 and V5 against the 5 new zoo individuals (they were
83
+ trained on the BOS animals, so a BOS rejection figure would be data leakage). Clean identification
84
+ on good zoo crops saturates from V3 onward; the real separation between versions appears under
85
+ degradation, where the invariance training introduced in V5 keeps V5 and V6 above 90% while V3 and
86
+ V4 fall to chance. V6 is the deployed production model.
87
 
88
  ## Dataset
89
 
90
  | Source | Individuals | Crops | Role |
91
  |--------|-------------|-------|------|
92
+ | Captive collection (zoo) | 15 | 2,127 + 865 | Training (known) |
93
+ | Field rescue center (BOS) | 30 | 1,622 | Supervised in V4/V5, unknown test set for V3/V6 |
94
  | Internet (iNaturalist, GBIF, web) | unlabeled | 5,429 | Background class |
95
 
96
  Images are not included.
 
102
 
103
  path = hf_hub_download(
104
  repo_id="tit0000/OrangIdentifier",
105
+ filename="megadesc_T_arcface_v6_15ind_acc98.pt",
106
  )
107
  ```
108
 
109
  Or via the pipeline:
110
+
111
  ```bash
112
+ python models/download_models.py --version all
113
  ```
114
 
115
  ## Security note
116
 
117
+ These `.pt` files are standard PyTorch and Ultralytics checkpoints. The pickle imports flagged by
118
+ Hugging Face come from trusted libraries (torch, ultralytics, collections) and contain no malicious
119
+ code.
120
 
121
  ## References
122
 
 
124
  - Deng et al. (2019). ArcFace. CVPR 2019.
125
  - Deng et al. (2020). Sub-center ArcFace. ECCV 2020.
126
  - Liu et al. (2021). Swin Transformer. ICCV 2021.
127
+ - Jocher et al. (2023). Ultralytics YOLO.
gallery.json CHANGED
The diff for this file is too large to render. See raw diff
 
megadesc_T_arcface_v5_invariance_acc99.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4380d5ebb8df0028fd3319bdb81412e02a9e9322803df21293817f7969ca98a2
3
+ size 110316482
megadesc_T_arcface_v6_15ind_acc98.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3ebb1e04993afa73238db1885018072fd7de15a094da06b0bf8a89d70bbd23ea
3
+ size 110252694
megadesc_T_arcface_backbone.tflite → megadesc_v6_backbone.tflite RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:045c91a822e22f60aecabfdcc749ecc35678e84824ad927d40f89271219936ef
3
  size 112476636
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:14775fd4593b8e621b9af8def66b3b1b8c4b32b6a5d446d05427e15770343e3d
3
  size 112476636