Views
No views yet
| Metric | POW | PER | NES | UHH | HSN | NBP | SSW | SNE | Score | |
|---|---|---|---|---|---|---|---|---|---|---|
| AudioProtoPNet-1 | cmAP | 0.49 | 0.30 | 0.36 | 0.28 | 0.50 | 0.66 | 0.40 | 0.32 | 0.40 |
| AUROC | 0.88 | 0.79 | 0.92 | 0.85 | 0.91 | 0.92 | 0.96 | 0.84 | 0.88 | |
| T1-Acc | 0.87 | 0.59 | 0.49 | 0.42 | 0.64 | 0.71 | 0.64 | 0.70 | 0.60 | |
| AudioProtoPNet-5 | cmAP | 0.50 | 0.30 | 0.38 | 0.31 | 0.54 | 0.68 | 0.42 | 0.33 | 0.42 |
| AUROC | 0.88 | 0.79 | 0.93 | 0.87 | 0.92 | 0.93 | 0.97 | 0.88 | 0.90 | |
| T1-Acc | 0.84 | 0.59 | 0.52 | 0.49 | 0.65 | 0.71 | 0.66 | 0.74 | 0.62 | |
| AudioProtoPNet-10 | cmAP | 0.50 | 0.30 | 0.38 | 0.30 | 0.54 | 0.68 | 0.42 | 0.34 | 0.42 |
| AUROC | 0.88 | 0.80 | 0.94 | 0.86 | 0.92 | 0.93 | 0.97 | 0.86 | 0.90 | |
| T1-Acc | 0.85 | 0.59 | 0.52 | 0.47 | 0.64 | 0.72 | 0.67 | 0.74 | 0.62 | |
| AudioProtoPNet-20 | cmAP | 0.50 | 0.30 | 0.38 | 0.31 | 0.54 | 0.68 | 0.43 | 0.33 | 0.42 |
| AUROC | 0.89 | 0.80 | 0.94 | 0.86 | 0.92 | 0.93 | 0.97 | 0.87 | 0.90 | |
| T1-Acc | 0.87 | 0.60 | 0.52 | 0.42 | 0.65 | 0.72 | 0.68 | 0.75 | 0.62 |
| Model | Metric | POW | PER | NES | UHH | HSN | NBP | SSW | SNE | Score |
|---|---|---|---|---|---|---|---|---|---|---|
| AudioProtoPNet-5 | cmAP | 0.50 | 0.30 | 0.38 | 0.31 | 0.54 | 0.68 | 0.42 | 0.33 | 0.42 |
| AUROC | 0.88 | 0.79 | 0.93 | 0.87 | 0.92 | 0.93 | 0.97 | 0.86 | 0.90 | |
| T1-Acc | 0.84 | 0.59 | 0.52 | 0.49 | 0.65 | 0.71 | 0.66 | 0.74 | 0.62 | |
| ConvNeXt | cmAP | 0.41 | 0.21 | 0.35 | 0.25 | 0.49 | 0.66 | 0.38 | 0.31 | 0.38 |
| AUROC | 0.83 | 0.73 | 0.89 | 0.72 | 0.88 | 0.92 | 0.93 | 0.83 | 0.84 | |
| T1-Acc | 0.75 | 0.43 | 0.49 | 0.43 | 0.60 | 0.69 | 0.58 | 0.62 | 0.56 | |
| Perch | cmAP | 0.30 | 0.18 | 0.39 | 0.27 | 0.45 | 0.63 | 0.28 | 0.29 | 0.36 |
| AUROC | 0.84 | 0.70 | 0.90 | 0.76 | 0.86 | 0.91 | 0.91 | 0.83 | 0.84 | |
| T1-Acc | 0.85 | 0.48 | 0.66 | 0.57 | 0.58 | 0.69 | 0.62 | 0.69 | 0.61 |
transformers library.1from transformers import AutoFeatureExtractor, AutoModelForSequenceClassification
2import librosa
3import torch
4
5# Load the model and feature extractor
6model = AutoModelForSequenceClassification.from_pretrained("DBD-research-group/AudioProtoPNet-10-BirdSet-XCL",trust_remote_code=True)
7feature_extractor = AutoFeatureExtractor.from_pretrained("DBD-research-group/AudioProtoPNet-10-BirdSet-XCL", trust_remote_code=True)
8model.eval()
9
10# Load an example audio file
11audio_path = librosa.ex('robin')
12label = "eurrob1" # The eBird label for the European Robin.
13
14# The model is trained on audio sampled at 32,000 Hz
15audio, sample_rate = librosa.load(audio_path, sr=32_000)
16
17mel_spectrogram = feature_extractor(audio)
18
19outputs = model(mel_spectrogram)
20probabilities = torch.sigmoid(outputs[0]).detach()
21
22# Get the top 5 predictions by confidence
23top_n_probs, top_n_indices = torch.topk(probabilities, k=5, dim=-1)
24
25label2id = model.config.label2id
26id2label = model.config.id2label
27
28print(f'Selected species with confidence:')
29print(f"{label:<7} - {probabilities[:, label2id[label]].item():.2%}")
30print("\nTop 5 Predictions with confidence:")
31for idx, conf in zip(top_n_indices.squeeze(), top_n_probs.squeeze()):
32 print(f"{id2label[idx.item()]:<7} - {conf:.2%}")Selected species with confidence:
eurrob1 - 26.81%
Top 5 Predictions with confidence:
coatit2 - 49.99%
sablar2 - 48.29%
palwar5 - 41.58%
gretit1 - 37.51%
verdin - 34.72%@misc{heinrich2024audioprotopnet,
title={AudioProtoPNet: An interpretable deep learning model for bird sound classification},
author={René Heinrich and Lukas Rauch and Bernhard Sick and Christoph Scholz},
year={2024},
url={https://www.sciencedirect.com/science/article/pii/S1574954125000901},
}