--- license: other license_name: per-source license_link: https://huggingface.co/datasets/owlgebra-ai/babycry/blob/main/README.md#licensing pretty_name: 'babycry v1 — infant/child vocalization: valence (positive vs distress)' task_categories: - audio-classification language: - en tags: - audio - infant-cry - baby-cry - affective-computing - vocalization - embeddings - frozen-features - non-commercial size_categories: - 1K ℹ️ An alert-gate target (`attend` vs `ignore`) was explored on this corpus and **dropped** > for v1 (near-chance on this data). The revertible local snapshot + `label_map.yaml` still > retain it, but it is **not** a column in this published dataset. > ⚠️ **Per-source licensing — no single combined license.** Each clip keeps its source's > license, recorded per row in the **`source_license`** column: ReCANVo **CC-BY-4.0**, > DonateACry **ODbL-1.0**, ESC-50 **CC-BY-NC-3.0**. The **ESC-50 subset (40 clips) is > non-commercial**; filter `source_license != "CC-BY-NC-3.0"` for a commercial-friendly > subset (7,534 clips). See **Licensing** below. > ⚠️ **Research preview.** ReCANVo speakers are **ages 6–23, not infants** (affect > *transfer*, not infant data); DonateACry is **8 kHz** vs 44.1 kHz for the others > (sample-rate/domain confound). Read **Caveats** before drawing conclusions. ## Intended use - Train and compare **last-layer heads** (logistic regression, RF, small MLP) on frozen embeddings under **leave-one-speaker-out** evaluation. - Probe **valence** (positive vs distress) and cross-dataset generalization. Not intended for: clinical decisions; commercial deployment without removing the non-commercial subset; treating ReCANVo as infant data. ## Sources | source_dataset | clips | original release | license | native SR | |---|--:|---|---|--:| | **recanvo** | 7,077 | ReCANVo, Zenodo record [5786859](https://zenodo.org/records/5786859) · [paper](https://www.nature.com/articles/s41597-023-02405-7) | **CC-BY-4.0** | 44.1 kHz | | **donateacry** | 457 | [github.com/gveres/donateacry-corpus](https://github.com/gveres/donateacry-corpus) (`donateacry_corpus_cleaned_and_updated_data/`) | **ODbL-1.0** | 8 kHz | | **esc50** | 40 | [github.com/karolpiczak/ESC-50](https://github.com/karolpiczak/ESC-50) (`crying_baby` only) | **CC-BY-NC-3.0** | 44.1 kHz | **Considered but excluded (gated / not openly redistributable):** BabbleCor (OSF `rz4tx` — audio + annotation tags require a signed Data Use Agreement), CRIED (ComParE 2018 EULA), Baby Chillanto (written permission). No clips from these are included. ### Citation / BibTeX ```bibtex @article{johnson2023recanvo, title = {ReCANVo: A database of real-world communicative and affective nonverbal vocalizations}, author = {Johnson, Kristina T. and others}, journal = {Scientific Data}, volume = {10}, year = {2023}, doi = {10.1038/s41597-023-02405-7} } @misc{donateacry, title = {DonateACry corpus}, howpublished = {\url{https://github.com/gveres/donateacry-corpus}}, note = {ODbL-1.0} } @inproceedings{piczak2015esc50, title = {ESC: Dataset for Environmental Sound Classification}, author = {Piczak, Karol J.}, booktitle = {ACM Multimedia}, year = {2015} } ``` ## Schema (column dictionary) | column | dtype | meaning | |---|---|---| | `clip_id` | string | globally unique id, `":"` | | `source_dataset` | string | `recanvo` \| `donateacry` \| `esc50` | | `orig_label` | string | verbatim source label (e.g. `dysregulated`, `hungry`, `crying_baby`) | | `valence` | string | `positive` \| `distress` \| `ambiguous` (see mapping) | | `speaker_id` | string | speaker/group id (`recanvo:P01`; per-clip-unique for donateacry/esc50) | | `lobo_group` | string | **recommended CV grouping key** (= `speaker_id`); group on this for LeaveOneGroupOut / GroupKFold | | `source_license` | string | per-row license (`CC-BY-4.0` / `ODbL-1.0` / `CC-BY-NC-3.0`) — filter for commercial use | | `duration_s` | float32 | clip duration in seconds | | `orig_sr` | int32 | native sample rate of the stored audio (Hz) | | `emb_ast` | list[768] | mean-pooled AST embedding | | `emb_wav2vec2` | list[768] | mean-pooled wav2vec2 embedding | | `emb_clap` | list[512] | mean-pooled CLAP embedding | | `audio` | Audio (decode=True) | raw waveform; decodes to `{array, sampling_rate}` at **native** SR | The `audio` column is stored at native SR (no resampling). Decoding returns the native `sampling_rate` (== `orig_sr`). The audio bytes are embedded directly in the parquet shards (self-contained — no external files needed). > **Decoding audio needs a backend (embeddings/metadata do not).** `datasets >= 4` > decodes audio via **torchcodec**, which requires system **FFmpeg** (libav versions 4–8) > installed. `datasets < 4` (e.g. 3.6.x) decodes via **soundfile** and needs no FFmpeg. > Every other column — `emb_ast` / `emb_wav2vec2` / `emb_clap` and all metadata — loads on > **any** `datasets` version; only `ds[i]["audio"]` decode needs the backend. If audio > decode errors, either `pip install "datasets<4" soundfile`, or install FFmpeg and > `pip install torchcodec`. To skip decoding entirely: > `ds = ds.cast_column("audio", datasets.Audio(decode=False))` (yields raw bytes/path). ## Label definitions & mapping rationale The verbatim source labels are mapped to **valence** via the single source of truth in `data/datasets/v1_attend_ignore/label_map.yaml`. **`valence`** — `positive` vs `distress` (`ambiguous` is excluded from the binary task): - **positive** ← ReCANVo `delighted, laughter, laugh, happy, glee, affectionate` - **distress** ← ReCANVo `frustrated, dysregulated, dysregulation-sick, dysregulation-bathroom`; **all** DonateACry classes; ESC-50 `crying_baby` - **ambiguous** ← all other ReCANVo labels (`selftalk, social, request, yes, help, more, protest, bathroom, no, tablet, hunger, greeting`) > An alert-gate target (`attend` vs `ignore`) was explored on this corpus and dropped for > v1 (near-chance under leave-one-speaker-out). Its mapping is retained in the local > `label_map.yaml` snapshot for reference but is not published here. ## Sampling, coverage & evaluation **Class balance** | task | classes (kept) | counts | dropped | |---|---|---|---| | `valence` | positive / distress | **1,571 / 2,829** (4,400) | 3,174 `ambiguous` | Per source: ReCANVo positive 1,571 · distress 2,332 · ambiguous 3,174; DonateACry 457 (all distress); ESC-50 40 (all distress). **Recommended protocol.** Group by **`lobo_group`** (= `speaker_id`) with `sklearn.model_selection.LeaveOneGroupOut` or `GroupKFold` so no speaker is in both train and test. Use `class_weight="balanced"` and report **balanced accuracy / macro-F1 / ROC-AUC**, not raw accuracy. ReCANVo is the only multi-speaker source; DonateACry/ESC-50 are per-clip groups (each its own fold) and are single-class (all distress), best used for the **cross-dataset distress test**, not pooled clean training (see Caveats). ## Feature extraction (reproducible) Each clip is resampled per-encoder, sliced into **2.0 s windows with a 1.0 s hop**, each window embedded with a **frozen** encoder (eval mode, no grad), then windows are **mean-pooled** to one vector per clip. | column | encoder model id | resample | dim | |---|---|--:|--:| | `emb_ast` | `MIT/ast-finetuned-audioset-10-10-0.4593` | 16 kHz | 768 | | `emb_wav2vec2` | `facebook/wav2vec2-base` | 16 kHz | 768 | | `emb_clap` | `laion/clap-htsat-unfused` | 48 kHz | 512 | Resampling applies **only to embedding extraction**; the stored `audio` keeps its native SR. Reproduce with `src/babycry/embed.py` in the project repo. ## Baselines (what to expect) Leave-one-speaker-out, frozen embeddings + linear/RF probe (from `results/`): - **valence (positive vs distress).** Pooled GroupKFold/5, **CLAP/RF: balanced-acc 0.662, ROC-AUC 0.757** (CLAP/logreg 0.662 / 0.725; AST/RF 0.644 / 0.750). Within-ReCANVo (44.1 kHz, no SR confound) **CLAP/RF: 0.673 / 0.740**. CLAP **zero-shot** floor (no training): 0.615 / 0.648. ## Quickstart ```python from datasets import load_dataset import numpy as np from sklearn.linear_model import LogisticRegression from sklearn.model_selection import LeaveOneGroupOut, cross_val_predict from sklearn.metrics import balanced_accuracy_score, roc_auc_score # Load locally (this directory) or from the Hub once published: ds = load_dataset("parquet", data_files="data/train-*.parquet", split="train") # --- VALENCE: positive vs distress, leave-one-speaker-out on CLAP embeddings --- # Restrict to ReCANVo: 8 real speaker groups at 44.1 kHz = the CLEAN number. # (Pooling DonateACry/ESC-50 inflates results -- they're all-distress and 8 kHz, # so LOBO exploits the sample-rate shortcut. See Caveats.) keep = [v in ("positive", "distress") and d == "recanvo" for v, d in zip(ds["valence"], ds["source_dataset"])] sub = ds.select([i for i, k in enumerate(keep) if k]) X = np.array(sub["emb_clap"], dtype="float32") y = np.array([1 if v == "distress" else 0 for v in sub["valence"]]) groups = np.array(sub["lobo_group"]) # speaker grouping clf = LogisticRegression(max_iter=2000, class_weight="balanced") proba = cross_val_predict(clf, X, y, groups=groups, cv=LeaveOneGroupOut(), method="predict_proba")[:, 1] print("valence bal-acc", balanced_accuracy_score(y, proba > 0.5), " ROC-AUC", roc_auc_score(y, proba)) # ~0.69 / ~0.76 (RF ROC-AUC ~0.74) # --- AUDIO: decode a waveform at native sample rate --- a = ds[0]["audio"] # {"array": np.ndarray, "sampling_rate": int} print(ds[0]["clip_id"], a["sampling_rate"], a["array"].shape) # --- COMMERCIAL-FRIENDLY subset (drop CC-BY-NC ESC-50) --- commercial = ds.filter(lambda r: r["source_license"] != "CC-BY-NC-3.0") # 7,534 rows ``` A runnable, fuller example (logreg + RF heads, proper LOBO) is in **`examples/train_head.py`** in the project repo. ## Provenance & build Built from `data/datasets/v1_attend_ignore/manifest.csv` (immutable v1 snapshot) + `data/emb/{ast,wav2vec2,clap}.npz` via `scripts/build_hf_dataset.py`. To retarget labels, edit `data/datasets/v1_attend_ignore/label_map.yaml` and rebuild. ## Licensing This dataset asserts **no single combined license** — each clip is governed by its **original source license**, recorded per row in the **`source_license`** column: | source | clips | license | links | |---|--:|---|---| | ReCANVo | 7,077 | **CC-BY-4.0** | [license](https://creativecommons.org/licenses/by/4.0/) · [source](https://zenodo.org/records/5786859) | | DonateACry | 457 | **ODbL-1.0** | [license](https://opendatacommons.org/licenses/odbl/1-0/) · [source](https://github.com/gveres/donateacry-corpus) | | ESC-50 | 40 | **CC-BY-NC-3.0** | [license](https://creativecommons.org/licenses/by-nc/3.0/) · [source](https://github.com/karolpiczak/ESC-50) | The **ESC-50 subset is non-commercial (CC-BY-NC-3.0)**. There is no blanket license over the whole collection — honor each source's terms individually. For a commercial-friendly subset, filter to `source_license != "CC-BY-NC-3.0"` (ReCANVo + DonateACry, 7,534 clips). Always cite the original datasets.