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