validation
birdnet_stm32.training.validation
¶
Exact task validation and selection of the actual converted INT8 artifact.
ExactCmap
¶
Bases: Callback
Exact chunk AP for library callers without a file validation manifest.
Source code in birdnet_stm32/training/validation.py
FileCmap
¶
Bases: Callback
Use the CLI evaluator's windows, labels, pooling, and exact AP.
Source code in birdnet_stm32/training/validation.py
keras_runner(model)
¶
Return this model's cached runner, tracing it once.
Int8Selection
¶
Bases: FileCmap
Keep matching Keras/TFLite files selected only by INT8 validation cMAP.
Epoch zero is eligible, so fine-tuning cannot silently replace a better starting checkpoint. These are development artifacts, not release approval. The report is written last and records hashes of both selected files.
Source code in birdnet_stm32/training/validation.py
121 122 123 124 125 126 127 128 129 130 131 132 133 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 | |
stratified_validation_subset(val_paths, subset, *, seed=VALIDATION_SUBSET_SEED)
¶
Fixed, class-balanced draw of validation files for checkpoint selection.
Classes are visited round-robin in a seeded order, so the draw is as even
across classes as their folder sizes allow: a class with fewer files than
its share contributes all of them and the remainder is spread over the
rest. With 101 validation folders of which the smallest holds 13 files,
subset=2513 gives exactly 25 files per class and all 13 of the small
one.
Subset cMAP is biased upward -- fewer negatives per class to rank against -- and is not comparable to full-manifest numbers. It preserves the gap between checkpoints well enough to choose between arms and coarse checkpoints; confirm a final selection on the full manifest.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
val_paths
|
list[str]
|
All validation file paths, one folder per class. |
required |
subset
|
int
|
Files to draw. 0, or a value at least |
required |
seed
|
int
|
Draw seed. |
VALIDATION_SUBSET_SEED
|
Returns:
| Type | Description |
|---|---|
list[str]
|
The selected paths. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
RuntimeError
|
If the draw fails to cover every folder. |