Command line interface
birdnet_analyzer.analyze
Run birdnet_analyzer.analyze to analyze an audio file or a directory containing audio files.
You need to set paths for the audio file and selection table output. Here is an example:
python -m birdnet_analyzer.analyze /path/to/audio/folder -o /path/to/output/folder
Here are two more example commands:
python -m birdnet_analyzer.analyze /path/to/audio/folder --slist /path/to/species_list.txt --min_conf 0.5 --n_workers 4
python -m birdnet_analyzer.analyze /path/to/audio/folder --lat 42.5 --lon -76.45 --week 4 --sensitivity 1.0
Directory analyses are resumable: progress is saved continuously to a
.birdnet-resume folder in the output directory, so an interrupted run (crash,
power loss, Ctrl+C) can be continued by re-running the same command — files that
were already analyzed are skipped. The settings that affect the detections have to
match the interrupted run, otherwise the analysis starts over; see
Resumable Analysis for details.
usage: birdnet_analyzer.analyze [-h] [--birdnet [{2.4,3.0}]] [-o OUTPUT]
[--fmin FMIN] [--fmax FMAX] [--lat LAT]
[--lon LON] [--week WEEK]
[--sf_thresh SF_THRESH] [--slist SLIST]
[--sensitivity SENSITIVITY]
[--overlap OVERLAP]
[--audio_speed AUDIO_SPEED]
[--min_conf MIN_CONF]
[-l {af,ar,bg,ca,cs,cy,da,de,en_uk,en_us,es,es_ec,es_es,es_mx,fa,fi,fr,hr,hu,it,ja,ko,lt,nl,no,pl,pt,pt_pt,ro,ru,sk,sl,sr,sv,th,tr,uk,zh}]
[-b BATCH_SIZE] [--n_workers N_WORKERS]
[--n_producers N_PRODUCERS]
[--load_params PARAMS_FILE] [-v | --quiet]
[--rtype {table,audacity,kaleidoscope,csv,parquet} [{table,audacity,kaleidoscope,csv,parquet} ...]]
[--additional_columns {lat,lon,week,overlap,sensitivity,min_conf,species_list,model} [{lat,lon,week,overlap,sensitivity,min_conf,species_list,model} ...]]
[-c CLASSIFIER]
[--cc_species_list CC_SPECIES_LIST]
[--top_n TOP_N]
[--merge_consecutive MERGE_CONSECUTIVE]
[--use_perch]
[--split_tables | --no-split_tables]
[--strict]
INPUT
Positional Arguments
- INPUT
Path to input file or folder.
Named Arguments
- --birdnet
Possible choices: 2.4, 3.0
Use the BirdNET model. Specify the version to use.
Default:
'3.0'- -o, --output
Path to output folder. Defaults to the input path.
- --fmin
Minimum frequency for bandpass filter in Hz.
Default:
0- --fmax
Maximum frequency for bandpass filter in Hz.
Default:
15000- --lat
Recording location latitude in decimal degrees. Cannot be used together with –slist, use either the species list or the location coordinates.
- --lon
Recording location longitude in decimal degrees. Cannot be used together with –slist, use either the species list or the location coordinates.
- --week
Week of the year when the recording was made. Values in [1, 48] (4 weeks per month). Only effective when –lat and –lon are provided. Leave blank for year-round species list.
- --sf_thresh
Minimum species occurrence frequency threshold for location filter. Values in [0.0001, 0.99].
Default:
0.03- --slist
Path to species list file or folder. If folder is provided, species list needs to be named “species_list.txt”. Cannot be used together with –lat and –lon, use either the species list or the location coordinates.
- --sensitivity
Detection sensitivity; Higher values result in higher sensitivity. Values in [0.5, 1.5]. Values other than 1.0 will shift the sigmoid function on the x-axis. Use complementary to the cut-off threshold. Applies to every BirdNET model and custom classifier; ignored for Perch.
Default:
1.0- --overlap
Overlap of prediction segments. Values in [0.0, 2.9], or [0.0, 4.9] with –use_perch.
Default:
0.0- --audio_speed
Speed factor for audio playback. Values < 1.0 will slow down the audio, values > 1.0 will speed it up. At a 10x decrease (audio speed 0.1), a 384 kHz recording becomes a 38.4 kHz recording.
Default:
1.0- --min_conf
Minimum confidence threshold. Values in [0.00001, 0.99]. Perch confidences are softmax probabilities: simultaneous vocalizations share the probability mass, so dense soundscapes may need a lower threshold than BirdNET models.
Default:
0.25- -l, --locale
Possible choices: af, ar, bg, ca, cs, cy, da, de, en_uk, en_us, es, es_ec, es_es, es_mx, fa, fi, fr, hr, hu, it, ja, ko, lt, nl, no, pl, pt, pt_pt, ro, ru, sk, sl, sr, sv, th, tr, uk, zh
Locale for translated species common names.
Default:
en_us- -b, --batch_size
Number of samples to process at the same time. A custom classifier trained on BirdNET 3.0 always processes 1.
Default:
1- --n_workers
Number of worker processes for audio processing. Defaults to as many as fit the available memory, at most one per CPU core.
- --n_producers
Number of producer processes for audio processing. Defaults to 1.
Default:
1- --load_params
Read default settings from the parameters file of a previous analysis (birdnet.analyze-params.csv). Arguments given on the command line take precedence. Parameters files of earlier BirdNET-Analyzer versions are understood too.
- -v, --verbose
Also show debug messages and stacktraces on the console.
- --quiet
Only show warnings and errors on the console.
- --rtype
Possible choices: table, audacity, kaleidoscope, csv, parquet
Specifies output format.
Default:
['table']- --additional_columns
Possible choices: lat, lon, week, overlap, sensitivity, min_conf, species_list, model
Additional columns to include in the output, only applied to the csv and parquet output formats.
- -c, --classifier
Path to custom trained classifier. Its species names come from its labels file, so –locale is ignored. –lat and –lon keep only its species that the geo model predicts there, or, with a warning, all of them if it predicts none.
- --cc_species_list
Path to custom species list file for the custom classifier. The default search path is <custom_classifier_without_extension>_Labels.txt in the same directory.
- --top_n
Saves at most the top N predictions for each segment. –min_conf still applies.
- --merge_consecutive
Maximum number of consecutive detections above the threshold to merge for each detected species. This will result in fewer entries in the result file with segments longer than 3 seconds. Set to 0 or 1 to disable merging. A merged detection has the mean score of the detections it was made of.
Default:
1- --use_perch
Use the Perch model for detection.
Default:
False- --split_tables, --no-split_tables
Saves separate result tables for each input audio file in the output.
Default:
False- --strict
Fail if any species in –slist is not in the model. By default such species are skipped with a warning: labels drift across model versions (a renamed genus or common name), so the list is matched to the model by scientific and common name first, and only genuinely unknown species are dropped.
Default:
False
birdnet_analyzer.embeddings
Run birdnet_analyzer.embeddings to extract feature embeddings instead of class predictions.
The embedding of each 3-second segment is stored in a database folder, which birdnet_analyzer.search and the Search tab of the GUI search; --file_output also writes all embeddings of the database to a CSV file.
Embeddings can be used for clustering or similarity analysis. Here is an example:
python -m birdnet_analyzer.embeddings -i /path/to/audio/folder -db /path/to/database --batch_size 16
A new database is filled with the embeddings of BirdNET 3.0, or of the version named with --birdnet.
An existing database keeps the version it was created with, and birdnet_analyzer.search uses that version for the query.
usage: birdnet_analyzer.embeddings [-h] -db DATABASE [--fmin FMIN]
[--fmax FMAX] [--audio_speed AUDIO_SPEED]
[--overlap OVERLAP] [-b BATCH_SIZE]
[--n_workers N_WORKERS]
[--n_producers N_PRODUCERS] [-v | --quiet]
-i AUDIO_INPUT [--birdnet {2.4,3.0}]
[--file_output FILE_OUTPUT]
Named Arguments
- -db, --database
Path to the database folder.
- --fmin
Minimum frequency for bandpass filter in Hz.
Default:
0- --fmax
Maximum frequency for bandpass filter in Hz.
Default:
15000- --audio_speed
Speed factor for audio playback. Values < 1.0 will slow down the audio, values > 1.0 will speed it up. At a 10x decrease (audio speed 0.1), a 384 kHz recording becomes a 38.4 kHz recording.
Default:
1.0- --overlap
Overlap of prediction segments. Values in [0.0, 2.9].
Default:
0.0- -b, --batch_size
Number of samples to process at the same time. A custom classifier trained on BirdNET 3.0 always processes 1.
Default:
8- --n_workers
Number of worker processes for audio processing. Defaults to as many as fit the available memory, at most one per CPU core.
- --n_producers
Number of producer processes for audio processing. Defaults to 1.
Default:
1- -v, --verbose
Also show debug messages and stacktraces on the console.
- --quiet
Only show warnings and errors on the console.
- -i, --input
Path to input file or folder.
- --birdnet
Possible choices: 2.4, 3.0
BirdNET version to extract the embeddings with. Defaults to the version of the database if it exists, and to the newest version for a new one.
- --file_output
Saves all embeddings contained in the database in a csv file.
birdnet_analyzer.search
Run birdnet_analyzer.search, installed as the birdnet-search command and part of the embeddings extra, to find the segments of an embeddings database that sound most like a query file.
--audio_root is the folder that held the input folder of birdnet_analyzer.embeddings. Here is an example for the database above:
python -m birdnet_analyzer.search -db /path/to/database -q /path/to/query.wav -o /path/to/results --audio_root /path/to/audio
Embedding Extraction and Search describes the search in the GUI, where you can listen to the results and export them.
usage: birdnet_analyzer.search [-h] [--overlap OVERLAP] -db DATABASE [-v |
--quiet] -q QUERYFILE -o OUTPUT
[--n_results N_RESULTS]
[--score_function {cosine,euclidean,dot}]
[--crop_mode {center,first,segments}]
--audio_root AUDIO_ROOT
Named Arguments
- --overlap
Overlap of prediction segments. Values in [0.0, 2.9].
Default:
0.0- -db, --database
Path to the database folder.
- -v, --verbose
Also show debug messages and stacktraces on the console.
- --quiet
Only show warnings and errors on the console.
- -q, --queryfile
Path to the query file.
- -o, --output
Path to the output folder.
- --n_results
Number of results to return.
Default:
10- --score_function
Possible choices: cosine, euclidean, dot
Scoring function to use.
Default:
'cosine'- --crop_mode
Possible choices: center, first, segments
Crop mode for the query sample.
Default:
'center'- --audio_root
Folder that the audio paths in the database are relative to: the parent of the input path the embeddings were extracted from.
birdnet_analyzer.evaluation
Run birdnet_analyzer.evaluation, installed as the birdnet-evaluate command, to compare the result tables of an analysis with your annotations of the same recordings, as the Evaluation tab of the GUI does.
Evaluation Tool explains how the recordings are cut into windows (--sample_duration), how tables and classes are paired and what the metrics mean.
The columns are detected from the tables’ headers, so BirdNET’s result tables, and Raven selection tables with a class column such as Class or Species, need no column options. Here is an example:
python -m birdnet_analyzer.evaluation --annotation_path annotations/ --prediction_path results/ --class_wise --output_dir evaluation/ --plot_metrics_all_thresholds
For tables with other column names, name the columns in a JSON object, for example --columns_annotations '{"Start Time": "onset", "End Time": "offset", "Class": "species"}', and likewise with --columns_predictions, which also takes a "Confidence" column.
The fields an object leaves out are still detected, and null means no column, such as {"Recording": null} to pair by file names only.
The prediction class column detected is the common name; if your annotations use scientific names, pass --columns_predictions '{"Class": "Scientific Name"}' ("Scientific name" in CSV files).
With a file instead of a folder for both paths, the two files are compared as one recording if each holds one recording, whatever their names. A combined result table holds several recordings: then only the one named like the annotation file is scored.
Unlike the GUI, the command does not read the analysis’ parameters file: pass --sample_duration 5 for Perch results.
Without --selected_classes, every class of both sides is scored, and the classes without annotations are left out of the overall score.
Evaluate BirdNET predictions against annotations
usage: birdnet_analyzer.evaluation [-h] [-v | --quiet]
--annotation_path ANNOTATION_PATH
--prediction_path PREDICTION_PATH
[--mapping_path MAPPING_PATH]
[--sample_duration SAMPLE_DURATION]
[--min_overlap MIN_OVERLAP]
[--recording_duration RECORDING_DURATION]
[--columns_annotations COLUMNS_ANNOTATIONS]
[--columns_predictions COLUMNS_PREDICTIONS]
[--selected_classes SELECTED_CLASSES [SELECTED_CLASSES ...]]
[--selected_recordings SELECTED_RECORDINGS [SELECTED_RECORDINGS ...]]
[--metrics {accuracy,recall,precision,f1,ap,auroc} [{accuracy,recall,precision,f1,ap,auroc} ...]]
[--threshold THRESHOLD] [--class_wise]
[--averaging {macro,micro,weighted}]
[--score_unannotated_as_empty]
[--plot_metrics] [--plot_confusion_matrix]
[--plot_metrics_all_thresholds]
[--output_dir OUTPUT_DIR]
Named Arguments
- -v, --verbose
Also show debug messages and stacktraces on the console.
- --quiet
Only show warnings and errors on the console.
- --annotation_path
Path to an annotation table, or a folder searched for them (.txt, .csv)
- --prediction_path
Path to a prediction table, or a folder searched for them (.txt, .csv)
- --mapping_path
Path to a JSON file mapping predicted class names to annotated ones (optional)
- --sample_duration
Sample duration in seconds
Default:
3.0- --min_overlap
Seconds an annotation or prediction must overlap a window to count for it
Default:
0.5- --recording_duration
Recording duration in seconds
- --columns_annotations
JSON object naming the annotation tables’ column for “Start Time”, “End Time”, “Class”, “Recording” and “Duration”; the fields it leaves out are detected from the tables’ headers, null means no column
- --columns_predictions
JSON object naming the prediction tables’ column for “Start Time”, “End Time”, “Class”, “Confidence”, “Recording” and “Duration”; the fields it leaves out are detected from the tables’ headers, null means no column
- --selected_classes
List of selected classes
- --selected_recordings
Recordings to score, named as their files are without the extension and the BirdNET or Raven suffix (rec for rec.BirdNET.selection.table.txt)
- --metrics
Possible choices: accuracy, recall, precision, f1, ap, auroc
List of metrics (accuracy is excluded by default; in this sample-based multilabel setting it is dominated by true negatives and misleadingly high)
Default:
['auroc', 'precision', 'recall', 'f1', 'ap']- --threshold
Threshold value, strictly between 0 and 1
Default:
0.1- --class_wise
Calculate class-wise metrics
Default:
False- --averaging
Possible choices: macro, micro, weighted
How to aggregate per-class metrics into the overall score
Default:
'macro'- --score_unannotated_as_empty
Score recordings that have predictions but no annotation table as all-negative; without this option they are dropped
Default:
False- --plot_metrics
Plot metrics
Default:
False- --plot_confusion_matrix
Plot confusion matrix
Default:
False- --plot_metrics_all_thresholds
Plot metrics for all thresholds
Default:
False- --output_dir
Folder to write results_table.csv, data_table.csv and the requested plots to; without it the plots are shown
birdnet_analyzer.segments
After the analysis, run birdnet_analyzer.segments to extract short audio segments for species detections to verify results.
This way, it might be easier to review results instead of loading hundreds of result files manually.
usage: birdnet_analyzer.segments [-h] [--audio_speed AUDIO_SPEED] [-t THREADS]
[--min_conf MIN_CONF] [-v | --quiet]
[-r RESULTS] [-o OUTPUT]
[--max_segments MAX_SEGMENTS]
[--seg_length SEG_LENGTH]
[--max_conf MAX_CONF]
[--collection_mode {random,confidence,balanced}]
[--n_bins N_BINS]
INPUT
Positional Arguments
- INPUT
Path to folder containing audio files.
Named Arguments
- --audio_speed
Speed factor for audio playback. Values < 1.0 will slow down the audio, values > 1.0 will speed it up. At a 10x decrease (audio speed 0.1), a 384 kHz recording becomes a 38.4 kHz recording.
Default:
1.0- -t, --threads
Number of CPU threads.
Default:
2- --min_conf
Minimum confidence threshold. Values in [0.00001, 0.99]. Perch confidences are softmax probabilities: simultaneous vocalizations share the probability mass, so dense soundscapes may need a lower threshold than BirdNET models.
Default:
0.25- -v, --verbose
Also show debug messages and stacktraces on the console.
- --quiet
Only show warnings and errors on the console.
- -r, --results
Path to folder containing result files. Defaults to the input path.
- -o, --output
Output folder path for extracted segments. Defaults to the input path.
- --max_segments
Number of randomly extracted segments per species.
Default:
100- --seg_length
Minimum length of extracted segments in seconds. If a segment is shorter than this value, it will be padded with audio from the source file.
Default:
3.0- --max_conf
Maximum confidence threshold. Values in [0.00001, 1.0].
Default:
1.0- --collection_mode
Possible choices: random, confidence, balanced
Collection mode for selecting the segments. Can be ‘random’, ‘confidence’ or ‘balanced’.
Default:
'random'- --n_bins
Number of bins to use for the balanced collection mode
Default:
10
birdnet_analyzer.species
usage: birdnet_analyzer.species [-h] [--lat LAT] [--lon LON] [--week WEEK]
[--sf_thresh SF_THRESH]
[-l {bg,ca,cs,cy,da,de,en_us,es,es_ec,es_es,es_mx,fa,fi,fr,hr,ja,lt,nl,no,pl,pt,pt_pt,ru,sk,sr,sv,tr,uk,zh}]
[-v | --quiet]
OUTPUT
Positional Arguments
- OUTPUT
Path to output file or folder. If this is a folder, file will be named ‘species_list.txt’.
Named Arguments
- --lat
Recording location latitude in decimal degrees.
- --lon
Recording location longitude in decimal degrees.
- --week
Week of the year when the recording was made. Values in [1, 48] (4 weeks per month). Only effective when –lat and –lon are provided. Leave blank for year-round species list.
- --sf_thresh
Minimum species occurrence frequency threshold for location filter. Values in [0.0001, 0.99].
Default:
0.03- -l, --locale
Possible choices: bg, ca, cs, cy, da, de, en_us, es, es_ec, es_es, es_mx, fa, fi, fr, hr, ja, lt, nl, no, pl, pt, pt_pt, ru, sk, sr, sv, tr, uk, zh
Locale for translated species common names.
Default:
en_us- -v, --verbose
Also show debug messages and stacktraces on the console.
- --quiet
Only show warnings and errors on the console.
birdnet_analyzer.train
You can train your own custom classifier on top of BirdNET. This is useful if you want to detect species that are not included in the default species list. You can also use this to train a classifier for a specific location or season.
All you need is a dataset of labeled audio files, organized in folders by species (we use folder names as labels). This also works for non-bird species, as long as you have a dataset of labeled audio files.
Audio files will be resampled to the sample rate of the base model (48 kHz for BirdNET 2.4, 32 kHz for BirdNET 3.0) and converted into 3-second segments (we support different crop segmentation modes for files longer than 3 seconds; we pad with zeros if the file is shorter). We recommend using at least 100 audio files per species (although training also works with less data).
The classifier is trained on the embeddings of one BirdNET version, chosen with --birdnet (3.0 by default), and only works with that version.
You can download a sample training data set here.
Collect training data and organize in folders based on species names.
Species labels should be in the format
<scientific name>_<species common name>(e.g.,Poecile atricapillus_Black-capped Chickadee), but other formats work as well.It can be helpful to include a non-event class. If you name a folder ‘Noise’, ‘Background’, ‘Other’ or ‘Silence’, it will be treated as a non-event class.
Run the training script with
python -m birdnet_analyzer.train <path to training data folder> -o <path to trained classifier model output>.
Training stops early once the validation score (``–autotune_metric``, AUPRC by default) stops improving, and the saved classifier keeps the weights of its best epoch.
After training, you can use the custom trained classifier with the --classifier argument of the birdnet_analyzer.analyze script.
If you want to use the custom classifier in Raven, make sure to set --model_formats raven.
Note
The defaults, including a learning rate chosen for the base model, were chosen by comparing training runs on real recordings; changing the other hyperparameters rarely improved a classifier.
To experiment anyway, see the hyperparameters. --autotune searches them automatically (it needs the train extra, pip install birdnet_analyzer[train], which provides optuna).
Example usage (when downloading and unzipping the sample training data set):
python -m birdnet_analyzer.train train_data/ -o checkpoints/custom/Custom_Classifier.tflite
python -m birdnet_analyzer.analyze /path/to/audio/folder --classifier checkpoints/custom/Custom_Classifier.tflite
Note
Setting a custom classifier will also set the new labels file. The species names come from that file, so --locale has no effect. A location (--lat/--lon) keeps only the classifier’s species that the geo model predicts there, or, with a warning, all of them if it predicts none.
Negative samples
You can include negative samples for classes by prefixing the folder names with a ‘-’ (e.g., -Poecile atricapillus_Black-capped Chickadee).
Do this with samples that definitely do not contain the species.
Negative samples will only be used for training and not for validation.
Also keep in mind that negative samples will only be used when a corresponding folder with positive samples exists.
Negative samples cannot be used for binary classification, instead include these samples in the non-event folder.
Multi-label data
To train with multi-label data separate the class labels with commas in the folder names (e.g., Poecile atricapillus_Black-capped Chickadee,Cardinalis cardinalis_Northern Cardinal).
This can also be combined with negative samples as described above.
A negative sample also counts as not containing any other class, so a recording that does contain another trained species belongs in a combined folder (e.g., Cardinalis cardinalis_Northern Cardinal,-Poecile atricapillus_Black-capped Chickadee).
The validation split is made per combination of classes, so give each combination at least two files.
When using multi-label data the upsampling mode will be limited to ‘repeat’.
Note
Custom classifiers trained with BirdNET-Analyzer are subject to the license terms of the model they were trained with: the Apache License 2.0 with its acceptable use policy for BirdNET 3.0, the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (CC BY-NC-SA 4.0) for BirdNET 2.4.
usage: birdnet_analyzer.train [-h] [--fmin FMIN] [--fmax FMAX]
[--audio_speed AUDIO_SPEED] [-t THREADS]
[-b BATCH_SIZE] [--overlap OVERLAP]
[--load_params PARAMS_FILE] [-v | --quiet]
[--test_data TEST_DATA]
[--crop_mode {center,first,segments,smart}]
[--birdnet {2.4,3.0}] [-o OUTPUT]
[--epochs EPOCHS] [--val_split VAL_SPLIT]
[--learning_rate LEARNING_RATE]
[--focal-loss | --no-focal-loss]
[--focal-loss-gamma FOCAL_LOSS_GAMMA]
[--focal-loss-alpha FOCAL_LOSS_ALPHA]
[--hidden_units HIDDEN_UNITS]
[--dropout DROPOUT]
[--label_smoothing | --no-label_smoothing]
[--mixup | --no-mixup]
[--upsampling_ratio UPSAMPLING_RATIO]
[--upsampling_mode {repeat,linear,mean,smote}]
[--model_formats {tflite,raven,detached} [{tflite,raven,detached} ...]]
[--model_save_mode {replace,append}]
[--save_cache_to SAVE_CACHE_TO]
[--autotune | --no-autotune]
[--autotune_trials AUTOTUNE_TRIALS]
[--autotune_n_splits AUTOTUNE_N_SPLITS]
[--autotune_n_repeats AUTOTUNE_N_REPEATS]
[--autotune_metric {val_AUPRC,val_AUROC}]
INPUT
Positional Arguments
- INPUT
Path to training data folder. Subfolder names are used as labels. Can also be path to cache file
Named Arguments
- --fmin
Minimum frequency for bandpass filter in Hz.
Default:
0- --fmax
Maximum frequency for bandpass filter in Hz.
Default:
15000- --audio_speed
Speed factor for audio playback. Values < 1.0 will slow down the audio, values > 1.0 will speed it up. At a 10x decrease (audio speed 0.1), a 384 kHz recording becomes a 38.4 kHz recording.
Default:
1.0- -t, --threads
Number of CPU threads.
Default:
2- -b, --batch_size
Number of samples to process at the same time. A custom classifier trained on BirdNET 3.0 always processes 1.
Default:
32- --overlap
Overlap of training data segments in seconds if crop_mode is ‘segments’. Values in [0.0, 2.9].
Default:
0.0- --load_params
Read default settings from the parameters file of a previous training run (*.birdnet.train-params.csv). Arguments given on the command line take precedence. Parameters files of earlier BirdNET-Analyzer versions are understood too.
- -v, --verbose
Also show debug messages and stacktraces on the console.
- --quiet
Only show warnings and errors on the console.
- --test_data
Path to test data folder. It is only used to evaluate the trained classifier; tuning and early stopping use the validation split of the training data.
- --crop_mode
Possible choices: center, first, segments, smart
Crop mode for training data.
Default:
'center'- --birdnet
Possible choices: 2.4, 3.0
BirdNET version to train on. Its embeddings are the classifier’s input, so the classifier only works with this version. A cache file keeps the version it was created with.
Default:
'3.0'- -o, --output
Path to trained classifier model output.
Default:
'checkpoints/custom/Custom_Classifier'- --epochs
Number of training epochs.
Default:
50- --val_split
The share of each class’s training files that is not used for training, but for validation scores and early stopping during training. All segments of a file stay on the same side. Must be above 0.
Default:
0.2- --learning_rate
Learning rate. If not set, the one measured for the base model: 0.1 for BirdNET 3.0, 0.01 for BirdNET 2.4. One read with –load_params applies only to the base model it was recorded for.
- --focal-loss, --no-focal-loss
Use focal loss for training (helps with imbalanced classes and hard examples).
Default:
False- --focal-loss-gamma
Focal loss gamma parameter (focusing parameter). Higher values give more weight to hard examples.
Default:
2.0- --focal-loss-alpha
Focal loss alpha parameter (balancing parameter). Controls weight between positive and negative examples.
Default:
0.25- --hidden_units
Number of hidden units. If set to >0, a two-layer classifier is used.
Default:
0- --dropout
Dropout rate. Higher values result in more regularization. Values in [0.0, 0.9].
Default:
0.0- --label_smoothing, --no-label_smoothing
Whether to use label smoothing for training.
Default:
False- --mixup, --no-mixup
Whether to use mixup for training.
Default:
False- --upsampling_ratio
Balance train data and upsample minority classes. Values between 0 and 1.
Default:
0.0- --upsampling_mode
Possible choices: repeat, linear, mean, smote
Upsampling mode.
Default:
'repeat'- --model_formats
Possible choices: tflite, raven, detached
Model output format(s).
Default:
['tflite']- --model_save_mode
Possible choices: replace, append
Model save mode. ‘replace’ will overwrite the original classification layer and ‘append’ will combine the original classification layer with the new one.
Default:
'replace'- --save_cache_to
Path to save the extracted training data to, as a cache file that later runs can use as INPUT. No cache is written unless this is set.
- --autotune, --no-autotune
Whether to use automatic hyperparameter tuning (this will execute multiple training runs to search for optimal hyperparameters).
Default:
False- --autotune_trials
Number of training runs for hyperparameter tuning.
Default:
50- --autotune_n_splits
Number of folds for cross-validation during hyperparameter tuning. If set to >1, the training data will be split into k folds and each training run will be executed k times with a different fold as validation data and the rest as training data. A fold takes whole files. This multiplies the tuning time and is mainly worth it for small datasets of a few hundred files.
Default:
1- --autotune_n_repeats
Number of repetitions for each training run during hyperparameter tuning. If set to >1, each training run will be executed multiple times and the average validation score across all repetitions will be used as the score for the training run. This can help to get more robust estimates of the validation scores for each training run, but it will also increase the runtime of the hyperparameter tuning process. Only used when –autotune_n_splits is greater than 1.
Default:
1- --autotune_metric
Possible choices: val_AUPRC, val_AUROC
Validation metric to optimize during hyperparameter tuning. Training also stops early on it and keeps the weights of its best epoch.
Default:
'val_AUPRC'