Skip to contents

Each call adds a new round to <detections>/<run_id>/validation/ validation_samples.csv. Events drawn in earlier rounds are never drawn again, so you can start small and add more later.

Usage

pam_validation_draw(
  cfg,
  run_id = cfg$birdnet$run_id,
  strategy = c("stratified", "random", "rare"),
  n = 100L,
  species = NULL,
  n_per_cell = cfg$validation$n_per_cell,
  pool = NULL
)

Arguments

cfg

A pam_config object (uses the validation section).

run_id

Detection run.

strategy

"stratified", "random" or "rare" (see pam_validation_sample()).

n

Events for the "random" strategy.

species

Optional species restriction.

n_per_cell

Events per species x band for "stratified". Defaults to validation$n_per_cell.

pool

Optional pool from pam_validation_pool() (computed if NULL).

Value

Invisibly, the newly added rows.

Examples

ex <- pam_example_project()
# the later stages read the master table that the scan builds
res <- suppressMessages(pam_scan_audio(ex$cfg))
new <- suppressMessages(pam_validation_draw(ex$cfg, strategy = "random", n = 5))
as.data.frame(new)[, c("sample_id", "species", "confidence", "clip_file")]
#>   sample_id                                    species confidence   clip_file
#> 1         1 Psittacula longicauda_Long-tailed Parakeet       0.81 s000001.wav
#> 2         2 Psittacula longicauda_Long-tailed Parakeet       0.66 s000002.wav
#> 3         3 Psittacula longicauda_Long-tailed Parakeet       0.58 s000003.wav
#> 4         4         Gracula religiosa_Common Hill Myna       0.95 s000004.wav
#> 5         5  Ducula nicobarica_Nicobar Imperial-Pigeon       0.71 s000005.wav
# the sample file is written to the run folder
file.exists(file.path(ex$cfg$paths$detections, "run01", "validation", "validation_samples.csv"))
#> [1] TRUE