Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,53 @@
|
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
---
|
| 3 |
license: apache-2.0
|
| 4 |
+
library_name: pytorch
|
| 5 |
+
tags:
|
| 6 |
+
- bioacoustics
|
| 7 |
+
- audio-classification
|
| 8 |
+
- bird-classification
|
| 9 |
+
- efficientnet
|
| 10 |
+
- transfer-learning
|
| 11 |
+
- perch
|
| 12 |
---
|
| 13 |
+
|
| 14 |
+
# Perch v2 — PyTorch backbone weights
|
| 15 |
+
|
| 16 |
+
PyTorch-converted backbone weights for Google's [Perch v2](https://www.kaggle.com/models/google/bird-vocalization-classifier) bioacoustic foundation model, for use with [`perch2-pytorch`](https://github.com/YOUR-USERNAME/perch2-pytorch) — a PyTorch port built for frozen-feature extraction, linear probing, and full deep fine-tuning (unlike the official [ONNX/tflite releases](https://huggingface.co/justinchuby/Perch-onnx), which are inference-only and have no autograd graph).
|
| 17 |
+
|
| 18 |
+
## What this is
|
| 19 |
+
|
| 20 |
+
- **Architecture:** stock `timm` `tf_efficientnet_b3`, single-channel input (`in_chans=1`), classification head stripped — returns a pooled **1536-dim** embedding.
|
| 21 |
+
- **Source:** extracted from Google's original JAX/Flax SavedModel (`infer.graph.variables`) and converted into a PyTorch state dict compatible with `timm`'s `tf_efficientnet_b3`.
|
| 22 |
+
- **File:** `perch_v2_backbone_timm.pt` — backbone weights only (no classification head).
|
| 23 |
+
|
| 24 |
+
## Known limitation
|
| 25 |
+
|
| 26 |
+
This is an **independent community conversion**, not an official release from Google. Per-block validation against the original (stem, expand blocks, residual blocks, head) showed 0.999+ cosine similarity, but whole-network cosine similarity plateaus around **~0.80**, likely from small numerical error accumulating across the 26 sequential MBConv blocks. Treat these weights as a strong pretrained initialization for fine-tuning, not a bit-exact reproduction of Google's model.
|
| 27 |
+
|
| 28 |
+
If you need bit-exact frozen embeddings rather than a trainable backbone, use the [official ONNX/tflite build](https://huggingface.co/justinchuby/Perch-onnx) instead.
|
| 29 |
+
|
| 30 |
+
## Usage
|
| 31 |
+
|
| 32 |
+
```python
|
| 33 |
+
from huggingface_hub import hf_hub_download
|
| 34 |
+
from perch2_finetune import Perch2Embedder
|
| 35 |
+
|
| 36 |
+
weights_path = hf_hub_download(
|
| 37 |
+
repo_id="bghani/perch2-pytorch-weights",
|
| 38 |
+
filename="perch_v2_backbone_timm.pt",
|
| 39 |
+
)
|
| 40 |
+
|
| 41 |
+
embedder = Perch2Embedder(weights_path=weights_path)
|
| 42 |
+
embedder.eval()
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
See the [main repo](https://github.com/YOUR-USERNAME/perch2-pytorch) for full usage — frozen embeddings, linear probing, and full fine-tuning, with runnable examples and a walkthrough notebook.
|
| 46 |
+
|
| 47 |
+
## License
|
| 48 |
+
|
| 49 |
+
Apache 2.0, inherited from the original Perch v2 release. See [NOTICE](https://github.com/YOUR-USERNAME/perch2-pytorch/blob/main/NOTICE) in the main repo for the full derivative-work attribution.
|
| 50 |
+
|
| 51 |
+
## Citation
|
| 52 |
+
|
| 53 |
+
If you use these weights in published work, please cite the original Perch v2 paper (arXiv:2508.04665) — check the [official repo](https://github.com/google-research/perch) for the current preferred citation — and note that these specific weights are a community PyTorch conversion.
|