The dataset viewer is not available because its heuristics could not detect any supported data files. You can try uploading some data files, or configuring the data files location manually.
Augmented MABe 2022 fly behavior data
version 3.0
20260720
This is an augmented, unblinded version of the fly behavior data from the MABe 2022 competition. Compared to the competition release, it includes more videos, the full trajectories (rather than 30-second trajectory snippets), all behavior and condition labels for every fly, and the previously secret test data.
Pose has also been re-tracked with an updated version of the APT tracker developed for the FlyDisco.
The data come from the Branson lab FlyBubble social-behavior assay: groups of ~10 flies interacting in a 5-cm diameter circular arena imaged from above at 150 frames per second, as described in the FlyDisco paper. Different videos correspond to different genotypes and thermo-/optogenetic activation protocols spanning courtship, aggression, and control conditions (see Experimental design).
Contents of this directory
Four compressed NumPy archives, one per data split:
| File | Split | Videos | Frames | ≈ Duration | Purpose |
|---|---|---|---|---|---|
usertrain_v3.npz |
usertrain | 69 | 3,545,746 | 6.6 h | Unsupervised / representation training |
testtrain_v3.npz |
testtrain | 33 | 1,662,647 | 3.1 h | Training the (linear) behavior classifier from a representation |
test1_v3.npz |
test1 | 21 | 1,054,376 | 2.0 h | Public / development test set |
test2_v3.npz |
test2 | 27 | 1,396,758 | 2.6 h | Held-out final test set (the "secret" test data) |
Totals: 150 videos, ~7.66 M frames, ~14.2 h of tracked interaction.
The split names follow the MABe 2022 competition design: usertrain was given to competitors to train an embedding, testtrain was used to fit a simple linear classifier on top of that embedding, and test1/test2 were used to score it (test2 only once, at the end). In this unblinded release all labels are provided for all splits.
File format
Each .npz file contains the following arrays.
nframesis the total number of frames concatenated across all videos in that split.nfliesis the maximum number of flies tracked in any frame of the split. All arrays are indexed so that the(frame, fly-slot)pair is consistent acrossX,y,videoidx,ids, andframes.
| Array | Shape | dtype | Description |
|---|---|---|---|
X |
(21, 2, nframes, nflies) |
float32 | Keypoint positions. Axis 0 = keypoint (see kpnames); axis 1 = (x, y); in millimeters, registered to the arena center. |
y |
(92, nframes, nflies) |
float64 | Labels. Axis 0 = category (see categories). Values are 0, 1, or NaN. |
videoidx |
(nframes, 1) |
float64 | 0-based index into expdirs giving the source video for each frame. |
frames |
(nframes, 1) |
int64 | 0-based frame number within the source video. |
ids |
(nframes, nflies) |
int64 | 0-based identity (trajectory id) of the fly in each slot, or -1 if the slot is empty in that frame. |
expdirs |
(nvideos,) |
str | Experiment directory (path) for each video; index with videoidx. |
kpnames |
(21,) |
str | Keypoint names for axis 0 of X. |
categories |
(92,) |
str | Label names for axis 0 of y. |
Notes:
- Missing data are
NaN.X[:, :, t, j]isNaNwhen slotjhas no fly in framet(e.g. when fewer thanmaxnfliesflies are tracked). If an identity is lost, a new trajectory identity is created. - Fly slots vs. identities. The
nfliesaxis is a set of slots, not stable fly identities. The fly occupying slotjat frametis the trajectory with identityids[t, j]in videovideoidx[t]. Within a contiguous run of frames from the same video, a slot holds the same fly as long as itsidsentry is unchanged. The order of flies was randomized (with a fixed seed) during packing. - Concatenation. Videos are concatenated along the frame axis, so adjacent rows
tandt+1may belong to different videos; always usevideoidxandframesto recover video/frame boundaries. - Features included.
Xcontains only the 21 APT body keypoints (x, y in mm). The scalar FlyTracker features that are part of the original MABe2022 dataset (x_mm,y_mm), orientation (cos_ori,sin_ori), body axes (maj_ax_mm,min_ax_mm), areas, image contrast, etc. — are not included in these released files.
Keypoints
X axis 0, in order (kpnames), 21 body landmarks tracked by APT:
0 wing_left 11 left_middle_femur_base
1 wing_right 12 left_middle_femur_tibia_joint
2 antennae_midpoint 13 right_front_leg_tip
3 right_eye 14 right_middle_leg_tip
4 left_eye 15 right_back_leg_tip
5 left_front_thorax 16 left_back_leg_tip
6 right_front_thorax 17 left_middle_leg_tip
7 base_thorax 18 left_front_leg_tip
8 tip_abdomen 19 right_outer_wing
9 right_middle_femur_base 20 left_outer_wing
10 right_middle_femur_tibia_joint
In the original MABe 2022 data, the wings were tracked with the FlyTracker rather than with APT. In this release, APT was used.
Label categories
y axis 0 has 92 categories (categories). Every entry is 0 (negative),
1 (positive), or NaN (unlabeled / not applicable). The categories fall into
six groups:
| Indices | Group | Count | Meaning |
|---|---|---|---|
| 0 | Sex | 1 | female (1 = female, 0 = male). The flyllm loader treats male as an alias for female==0. |
| 1–21 | Condition / genotype line | 21 | Which experimental line/condition the fly's video belongs to (e.g. control, 71G01, aIPgpublished1, pC1dpublished1). |
| 22–76 | Optogenetic stimulus contrasts | 55 | For each of 11 optogenetically activated lines, 5 stimulus-period contrasts: _offvson, _offvsstrong, _offvsweak, _weakvsstrong, _firstvslast_strong. Encodes which frames are LED-off vs. LED-on (of a given intensity). |
| 77–84 | Genotype super-classes | 8 | Coarse condition groupings: courtship, control, blind, aIPg, pC1, aggression, GMR71G01, sexseparated. |
| 85–90 | Manual behavior annotations | 6 | Sparse human JAABA labels: perframe_aggression, perframe_chase, perframe_courtship, perframe_highfence2, perframe_wingext, perframe_wingflick. |
| 91 | Tracking quality | 1 | BadTracking: per-frame output of a JAABA "not-tracking" classifier (1 = tracking is unreliable). |
Notes about the labels:
- The six behaviors are sparse ground-truth human annotations, not classifier outputs. They are the labeled intervals, so they are sparse: for these categories
1= frame manually labeled as the behavior,0= frame manually labeled "none," and the vast majority of frames areNaN(never annotated). BadTrackingcorresponds to frames automatically classified as frames the keypoint tracker is known not to generalize to. These are frames where the fly is falling off the ceiling, and were not included while training the tracker.
Coordinate system and units
- Units: millimeters where (0,0) is the arena center.
- Axes:
X[k, 0, t, j]andX[k, 1, t, j]are the (x, y) coordinates of keypointk. - Frame rate: 150 fps.
Experimental design
Videos span three broad experimental paradigms produced in the FlyBubble social assay. Activation manipulations are encoded in the experiment directory names (expdirs) and summarized by the condition and super-class labels.
- Courtship (thermogenetic, TrpA1): GAL4 driver lines
20A02,65F12,71G01,91B01have both male and female flies of the GAL4 line, whilemale20A02_femaleBDP,male65F12_femaleBDP,male71G01_femaleBDPhave male flies from the GAL4 line and female flies from the control lineBDP. - Aggression (optogenetic, CsChrimson):
aIPgsplit-GAL4 lines (aIPgpublished1/2/3,aIPgunpublished,aIPgBlind_newstim) andpC1dlines (pC1dpublished1/2,pC1dpublished1_newstim,pC1dBlind_newstim), activated with red-LED stimulus protocols, with e.g.aIPgpublished1/2/3are 3 different lines targeting the aIPg neurons. - Controls: empty-driver (
BDP) controls (control,BDP_sexseparated,Control_RGB,BlindControl), including blind (NorpAmutant) controls.
Genotype, activation type, blind-mutant status (NorpA), rig, and an acquisition timestamp are all embedded in each experiment name, e.g. nochr_TrpA71G01_Unknown_RigC_20201216T163316 (thermogenetic courtship) or NorpA_JHS_K_85321_RigB_20210903T065743 (blind control). Experiments were recorded across FlyBubble rigs A–D between 2019 and 2021.
Loading the data
Raw NumPy
import numpy as np
data = np.load('usertrain_v3.npz', allow_pickle=True)
X = data['X'] # (21, 2, nframes, nflies), mm
y = data['y'] # (92, nframes, nflies), {0, 1, NaN}
videoidx = data['videoidx'] # (nframes, 1), index into expdirs
frames = data['frames'] # (nframes, 1), frame within video
ids = data['ids'] # (nframes, nflies), fly identity, -1 = empty
expdirs = data['expdirs'] # (nvideos,), experiment paths
kpnames = data['kpnames'] # (21,), keypoint names
categories = data['categories'] # (92,), label names
# Example: x,y of the abdomen tip for every fly in the first frame
k = list(kpnames).index('tip_abdomen')
xy = X[k, :, 0, :] # (2, nflies)
# Example: frames a fly was manually labeled as courting
c = list(categories).index('perframe_courtship')
labeled = y[c] == 1 # (nframes, nflies) boolean
The arrays are large (X and y for usertrain have >1 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 pose-forecasting code; the schema above is exactly what apf.io.load_raw_npz_data expects.
To load and filter by category:
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.
- Downloads last month
- 27