Views
No views yet
| File | Purpose |
|---|---|
efficientnet_b4_512_fold0.ckpt | PyTorch Lightning checkpoint (304 MB) |
encoder_classes.npy | np.object array mapping class index → individual_id hex string |
species_map.csv | image,species,individual_id — full Happy Whale train set for ID→species lookup |
anti_fraud_threshold.yaml | Calibrated CLIP anti-fraud threshold (TNR≥0.90, TPR≥0.85) |
metrics_baseline.json | Baseline metrics snapshot for CI regression gate |
METRICS.md | Human-readable metrics table |
anti_fraud_roc.png | ROC curve from the CLIP gate calibration |
1import numpy as np
2import torch
3import torch.nn as nn
4import torch.nn.functional as F
5import timm
6from huggingface_hub import hf_hub_download
7
8REPO = "0x0000dead/ecomarineai-cetacean-effb4"
9ckpt_path = hf_hub_download(REPO, "efficientnet_b4_512_fold0.ckpt")
10classes = np.load(hf_hub_download(REPO, "encoder_classes.npy"), allow_pickle=True)
11
12class EffB4Arcface(nn.Module):
13 def __init__(self, num_classes=15587):
14 super().__init__()
15 self.backbone = timm.create_model("efficientnet_b4", pretrained=False, num_classes=0, global_pool="")
16 self.embedding = nn.Linear(1792, 512)
17 self.arc_weight = nn.Parameter(torch.zeros(num_classes, 512))
18
19 def forward(self, x):
20 feat = self.backbone(x)
21 feat = F.adaptive_avg_pool2d(feat, 1).flatten(1)
22 emb = F.normalize(self.embedding(feat), dim=1)
23 w = F.normalize(self.arc_weight, dim=1)
24 return emb @ w.T
25
26model = EffB4Arcface().eval()
27sd = torch.load(ckpt_path, map_location="cpu", weights_only=False)["state_dict"]
28remap = {}
29for k, v in sd.items():
30 if k.startswith("model."): remap["backbone." + k[6:]] = v
31 elif k.startswith("embedding."): remap[k] = v
32 elif k == "arc.weight": remap["arc_weight"] = v
33model.load_state_dict(remap, strict=False)reports/metrics_baseline.json (run scripts/compute_metrics.py in the main repo to reproduce):| Metric | Value | ТЗ target |
|---|---|---|
| TPR / Sensitivity | 0.9667 | > 0.85 |
| TNR / Specificity | 0.9333 | > 0.90 |
| Precision | 0.9355 | ≥ 0.80 |
| F1 | 0.9508 | > 0.60 |
| ROC-AUC | 0.9922 | — |
| Latency p95 (CPU) | 540 ms | ≤ 8 s |
1@software{ecomarineai2025,
2 title = {EcoMarineAI: Open Library for Cetacean Identification from Aerial Imagery},
3 author = {Baltsat, K.I. and Tarasov, A.A. and Vandanov, S.A. and Serov, A.I.},
4 year = {2025},
5 url = {https://github.com/0x0000dead/whales-identification}
6}
7
8@dataset{happy_whale_and_dolphin,
9 title = {Happy Whale and Dolphin},
10 author = {Happy Whale},
11 year = {2022},
12 url = {https://www.kaggle.com/competitions/happy-whale-and-dolphin}
13}