--- license: cc-by-4.0 pretty_name: Augmented MABe 2022 Fly Behavior Data tags: - animal-behavior - representation-learning - neuroscience - ethology - pose-forecasting size_categories: - 10B1 billion elements each), so loading is memory-intensive. For random access, consider extracting the arrays you need and slicing, or converting to a chunked format such as Zarr or HDF5. ### With AnimalPoseForecasting library (`flyllm` / `apf`) These files are the input format for the [AnimalPoseForecasting](https://github.com/kristinbranson/AnimalPoseForecasting) pose-forecasting code; the schema above is exactly what `apf.io.load_raw_npz_data` expects. To load and filter by category: ```python from apf.data import load_raw_npz_data, filter_data_by_categories data = load_raw_npz_data('usertrain_v3.npz') # keep only male flies from courtship experiments filter_data_by_categories(data, ['courtship', 'male'], fn='isdata') # additionally restrict prediction targets to well-tracked frames filter_data_by_categories(data, ['BadTracking==0'], fn='useoutputmask') keep = data['isdata'] & data['useoutputmask'] # selected (frame, fly) pairs ``` `filter_data_by_categories` narrows the mask named by `fn` (in place) to the `(frame, fly)` entries whose labels match **every** listed category. Each entry is either a bare category name — selecting frames where that category `== 1` — or a `Name==value` expression such as `BadTracking==0` selecting a specific value; `male` is a special alias for `female==0`. The higher-level `apf.io.load_and_filter_data(infile, config)` wraps this: it calls `load_raw_npz_data`, applies `config['categories']` (e.g. `["courtship", "male"]`) to `isdata` and `config['output_categories']` (e.g. `["BadTracking==0"]`) to `useoutputmask`, then drops empty videos and optionally adds left/right-flip augmentation. ## Credits Dataset constructed by Kristin Branson. Data collected by Alice Robie and Katie Schretter. Raw videos processed by Alice Robie, Adam Taylor, and Kristin Branson to create trajectories.