BirdNET-Analyzer icon indicating copy to clipboard operation
BirdNET-Analyzer copied to clipboard

ValueError and file path issues when running BirdNET Analyzer with --use_perch True (Windows, Python 3.9, Perch v2 model)

Open G-auravSingh opened this issue 2 months ago • 1 comments

I am able to run BirdNET Analyzer successfully in the standard (BirdNET) mode, but when enabling the Perch model using --use_perch True, the analysis fails with a series of errors related to model label length mismatch and missing paths.

Environment

  • OS: Windows 10
  • Python: 3.9 (conda environment: birdnet)
  • BirdNET-Analyzer version: latest from GitHub (cloned October 2025)
  • Command used: python -m birdnet_analyzer.analyze ^ --i "D:\xxxxxx" ^ --o "D:\xxxxxxx" ^ --lat 24.29 --lon 87.25 --week 30 ^ --min_conf 0.1 ^ --use_perch True

Observed behavior

The script begins downloading the Perch model via kagglehub successfully and finds the model: Model found!

Then it fails with the following traceback:ValueError: zip() argument 2 is longer than argument 1 File "birdnet_analyzer/model.py", line 1021, in explore l_filter = list(zip(l_filter, cfg.LABELS, strict=True))

In some runs, it also throws: FileNotFoundError: [Errno 2] No such file or directory: 'perch\\assets\\label.csv'

or Error: Cannot analyze audio file ...

Expected behavior

The Perch model should analyze the input WAV files in the same way as the standard BirdNET model, producing .BirdNET.results CSVs and allowing --use_perch True to act as a direct model switch.

What works

Running without --use_perch (default BirdNET model) works perfectly:

Troubleshooting attempted

Confirmed both .labels.csv and ._labels.csv exist under

  • C:\Users<User>.cache\kagglehub\models\google\bird-vocalization-classifier\tensorFlow2\perch_v2_cpu\1\assets\
  • Tried adjusting LABELS_FILE paths and re-running — same error.
  • Verified audio sample rates (32 kHz, 44.1 kHz) — same issue.
  • Also confirmed Perch model loads (≈388 MB) before crashing.

Request

Could you please clarify:

  1. Whether --use_perch True requires a specific configuration format or a separate label file structure,
  2. If the label alignment mismatch (zip() argument 2 is longer than argument 1) indicates a known issue between BirdNET-Analyzer and the Perch v2 model,
  3. Or if any modification is needed in cfg.LABELS_FILE or species/utils.py to ensure compatibility?
  4. Or any other solution?

G-auravSingh avatar Oct 23 '25 15:10 G-auravSingh

I'm a little confused by your CLI call, because the parameters used are long deprecated, but --use_perch is a current addition. Are you using a fork? Are you using the current repo?

Josef-Haupt avatar Oct 27 '25 10:10 Josef-Haupt