knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(mestrado)
library(dplyr)

Annotations dataset

The function tidy_annotations() is just a wrapper around purrr::map_dfr() for stack up all the rds files generated by wavesurfer::annotator_app(). (see vignette("04-data-annotation"))

annotations_dir <-  system.file("annotations", package = "mestrado")
annotations_dir

annotations <- tidy_annotations(annotations_dir)
glimpse(annotations)
annotations %>% head() %>% knitr::kable()

Retriving the labels for the slices

By merging the slices of the wave files with the labels annotated in the previous step, we construct the final dataset with the response/targets ready for modelling. The function label_slices() take the directory of slices and the annotations dataset as inputs. The output is a map between slice and label.

slices_dir <-  system.file("wav_sample_slices_1000ms", package = "mestrado")

slices_1000ms_labels <- label_slices(
  slices_dir, 
  annotations, 
  pattern = "Glaucidium|Megascops-atricapilla"
)
glimpse(slices_1000ms_labels)
slices_1000ms_labels %>% head() %>% knitr::kable()
# stores for later use
saveRDS(slices_1000ms_labels, "../data_/slices_1000ms_labels_by_humans.rds")


Athospd/mestrado documentation built on Jan. 2, 2021, 3:59 a.m.