operational
birdnet_stm32.evaluation.operational
¶
Device-facing quality gate for converted INT8 models.
The gate scores the deployed artifact without using a float model. It works per file, the way a recording is judged in the field: every file is cut into overlapping chunks, each chunk is scored by the model, and the chunk scores are pooled into one score per class. A single random chunk is not a fair test of a catalog recording, because many chunks of it hold no call at all; pooling asks whether the model finds the species anywhere in the file.
Two views of the pooled scores are reported. At configured operating thresholds: correct top-1 detections and confident false alarms, both across files and equally across classes, plus the alarm rate on hard negatives. And threshold-free, as a ranked species list: how often the labelled species is within the top k. Directory labels are a stable release-to-release proxy, not a substitute for annotated soundscapes.
measure_operational(model_path, model_config, data_path, num_files, seed, thresholds=DEFAULT_THRESHOLDS, batch_size=16, pooling=DEFAULT_POOLING, chunk_overlap=None)
¶
Score one converted model on an exact, stratified draw of whole files.
Each file is chunked like the catalog evaluation (first
MAX_FILE_SECONDS; chunk_overlap seconds of overlap, by default half
the chunk), every chunk is scored in bounded batches, and the chunk scores
are pooled per file.
Source code in birdnet_stm32/evaluation/operational.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | |
operating_point(labels, top1, peak, threshold)
¶
Return detection and false-alarm rates at one confidence threshold.
Source code in birdnet_stm32/evaluation/operational.py
ranking_metrics(labels, scores, top_k=TOP_K)
¶
Score the pooled outputs as a ranked species list, without a threshold.
The rank of the labelled species counts every class scoring at least as high, so ties go against it: an INT8 output that saturates several classes at the same code has not ranked the right one first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
labels
|
ndarray
|
[N] class index per file, negative for hard negatives (ignored). |
required |
scores
|
ndarray
|
[N, C] pooled scores. |
required |
top_k
|
Sequence[int]
|
List lengths to report; values above C are dropped. |
TOP_K
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Micro and macro top-k rates, mean reciprocal rank and median rank. |
Source code in birdnet_stm32/evaluation/operational.py
summarize_draws(draws, seeds, model_path, data_path, num_files)
¶
Combine per-seed draws and report the spread a release floor must clear.
Source code in birdnet_stm32/evaluation/operational.py
evaluate_release_gate(summary, profile)
¶
Apply explicit release limits to the worst draw at one operating point.