Views
No views yet
| Base model | EfficientNet-V2-S (ImageNet-1K pretrained) |
| Input | 224×224 RGB, ImageNet normalization |
| Output | 237-class softmax logits |
| Training data | iNaturalist research-grade observations, New York state |
| Training images | ~94,800 photos across 237 species |
| Val top-1 accuracy | 80.7% |
| Val top-5 accuracy | 94.0% |
1import json
2import numpy as np
3import onnxruntime as ort
4from PIL import Image
5from huggingface_hub import hf_hub_download
6
7# Load model and labels
8onnx_path = hf_hub_download("k10z/birdvision-efficientnet-s", "efficientnet_s_birds.onnx")
9labels_path = hf_hub_download("k10z/birdvision-efficientnet-s", "species_labels.json")
10
11session = ort.InferenceSession(onnx_path, providers=["CPUExecutionProvider"])
12species = json.loads(open(labels_path).read())
13
14# Preprocess image (224×224, ImageNet normalization)
15def preprocess(image_path):
16 img = Image.open(image_path).convert("RGB").resize((224, 224))
17 arr = np.array(img, dtype=np.float32) / 255.0
18 mean = np.array([0.485, 0.456, 0.406])
19 std = np.array([0.229, 0.224, 0.225])
20 arr = (arr - mean) / std
21 return arr.transpose(2, 0, 1)[None] # NCHW
22
23# Run inference
24logits = session.run(None, {"input": preprocess("bird.jpg")})[0][0]
25top5 = np.argsort(logits)[::-1][:5]
26for i in top5:
27 print(f"{species[i]:40s} {logits[i]:.3f}")species_labels.json for the full list.efficientnet_s_birds.hef for the Hailo-8
AI accelerator is included in this repo.