Datasets:
File size: 4,206 Bytes
a2b9ec1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | ---
license: cc-by-4.0
language:
- en
tags:
- biology
- animal-behavior
- animal-tracking
- pose-estimation
- mosaic
pretty_name: "CalMS21 (subset): tracks and labels for the mosaic analysis template"
size_categories:
- 10K<n<100K
---
# CalMS21 subset: tracks and behaviour labels
The CalMS21 task-1 arrays trimmed to four sequences per split, packaged as a
[mosaic](https://github.com/EcodylicScience/mosaic) dataset. Resident-intruder
assays: a black resident and a white intruder in a home cage, filmed from above at
30 fps, with seven MARS keypoints per mouse and a per-frame behaviour annotation.
Worked example:
[`notebooks/calms21-template.ipynb`](https://github.com/EcodylicScience/mosaic/blob/main/notebooks/calms21-template.ipynb).
Set `SOURCE = "download"` (the default) and it fetches the file below.
## What is in it
| File | Size | Contents |
| --- | --- | --- |
| `calms21-tracks-and-labels.tar.gz` | 12.6 MB | `dataset.yaml`, `tracks_raw/calms21_task1_{train,test}.npy`, and the two scan sources already declared |
Four sequences: two from the train split and two from the test split, about 82,700
frames of two mice. That is enough for the template's whole path.
Note what four entries mean for the supervised section. `ExtractLabeledTemplates`
splits **by sequence**, holding out `max(1, min(n - 1, round(test_fraction * n)))`
whole recordings -- so at the template's default `test_fraction=0.2` the test set is
one recording. The notebook prints that split rather than assuming it, and says to
read the classifier scores as a demonstration that the path runs rather than as a
benchmark.
**No video.** Every feature in the template reads the track table; media is only
needed for overlays and crops, and the CalMS21 clips are roughly 500 MB each. The
[mosaic-example-calms21-pose](https://huggingface.co/datasets/EcodylicScience/mosaic-example-calms21-pose)
dataset ships three of them if you want them.
## One file, two roots
`calms21_npy` is registered in mosaic as both a **track** converter and a **label**
converter, so the same `.npy` feeds `tracks/` and `labels/` with no copy. The
manifest declares both sources already; source overlap is only checked within a kind.
Note `multi_sequences_per_file: true` on each. One CalMS21 file holds many sequences,
and only that flag leaves the raw index's `sequence` cell blank, which is what
triggers the converter's `enumerate_sequences`. Without it the whole file collapses
into one entry named after the stem, and nothing fails.
## Use
```python
from mosaic.core.dataset import open_dataset
ds = open_dataset("calms21")
ds.scan_tracks()
ds.convert_all_tracks(group_from="filename")
ds.scan_labels()
ds.convert_all_labels(kind="behavior", source_format="calms21_npy")
table = ds.load_tracks(*ds.list_sequences()[0])
```
## Provenance and licence
Derived from the **Caltech Mouse Social Interactions (CalMS21) Dataset** v1.0 at
CaltechDATA, [doi:10.22002/D1.1991](https://doi.org/10.22002/D1.1991), under
[CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). The trajectories come from
`task1_classic_classification.zip`, converted with that record's own
`calms21_convert_to_npy.py` and then trimmed to eight sequences. This derivative
carries the same licence, and **attribution travels with it**: if you use this, or
anything built from it, cite the work below.
> Sun JJ, Karigo T, Anderson DJ, Perona P, Yue Y, Kennedy A (2021) *Caltech Mouse
> Social Interactions (CalMS21) Dataset* (Version 1.0) [Dataset]. CaltechDATA.
> [doi:10.22002/D1.1991](https://doi.org/10.22002/D1.1991)
>
> Sun JJ, Karigo T, Chakraborty D, Mohanty SP, Wild B, Sun Q, Chen C, Anderson DJ,
> Perona P, Yue Y, Kennedy A (2021) The Multi-Agent Behavior Dataset: Mouse Dyadic
> Social Interactions. *NeurIPS Datasets and Benchmarks*.
> [arXiv:2104.02710](https://arxiv.org/abs/2104.02710)
The keypoints are MARS (Segalin et al. 2021, *eLife* 10:e63720,
[doi:10.7554/eLife.63720](https://doi.org/10.7554/eLife.63720)).
## Downloading
The notebook uses `huggingface_hub >= 1.2.0`. The floor matters: older clients retry
a rate-limit response with a 25-second backoff against a 5-minute window, so they
fail rather than wait.
|