Release BehaVERT checkpoints
Browse filesFiles changed (7)
- README.mdAdded+125
- calms21-task1/config.jsonAdded+110
- calms21-task1/model.safetensorsAdded+3
- mabe22-strain/config.jsonAdded+188
- mabe22-strain/model.safetensorsAdded+3
- oft-behavior/config.jsonAdded+234
- oft-behavior/model.safetensorsAdded+3
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125---license: mitlibrary_name: behaverttags: - animal-behavior - pose - keypoints - mouse - behavior-classification - attentiondatasets: - ShinSeungJ/behavert-data---
# BehaVERT models
Pretrained models for **BehaVERT**, a transformer that reads animal posekeypoints as a sequence of tokens and decodes behavior from them(Shin et al., *International Journal of Computer Vision* 2026,[doi:10.1007/s11263-026-02834-y](https://doi.org/10.1007/s11263-026-02834-y)).Code: <https://github.com/ShinSeungJ/BehaVERT>.
| Model | Predicts | Input | Head ||---|---|---|---|| [`calms21-task1/`](https://huggingface.co/ShinSeungJ/behavert/tree/main/calms21-task1) | attack / investigation / mount / other, every frame | 2 mice × 7 keypoints, 2D | token (per frame) || [`mabe22-strain/`](https://huggingface.co/ShinSeungJ/behavert/tree/main/mabe22-strain) | strain of a mouse triplet, WT / TG | 3 mice × 12 keypoints, 2D | sequence (`[CLS]`) || [`oft-behavior/`](https://huggingface.co/ShinSeungJ/behavert/tree/main/oft-behavior) | 7 open-field behaviors, every frame | 1 mouse × 11 keypoints, 2D | token (per frame) |
Each folder holds `config.json` (architecture, classes, keypoint layout,drawing settings) and `model.safetensors` (about 86M parameters). Thematching pose models are in [ShinSeungJ/behavert-pose](https://huggingface.co/ShinSeungJ/behavert-pose).
## Use
```bashpip install "behavert[pose] @ git+https://github.com/ShinSeungJ/BehaVERT"
behavert decode --video my_videos/ --model oft-behavior --overlay --sync # video -> behaviorbehavert decode --keypoints session.csv --model calms21-task1 --video session.mp4 --sync```
```pythonfrom behavert import BehaVERTfrom behavert.inference import predict_recording
model = BehaVERT.from_pretrained("calms21-task1") # downloads calms21-task1/ from this repopred = predict_recording(model, keypoints) # keypoints [T, mouse, keypoint, (x, y)]pred.labels # one class per frame```
`behavert decode` writes per-frame behaviors, a summary per behavior, a videowith the skeleton and behavior drawn on, and a synchronized panel video withwindow embeddings (t-SNE), attention and confidence. `behavert attention` and`behavert embed` analyse attention and embeddings over a whole dataset.
## `calms21-task1` — CalMS21 Task 1
Resident–intruder pairs; frame-level attack, investigation, mount or other.Pretrained by masked keypoint modeling on all CalMS21 keypoints, then fine-tunedon Task 1 ("BehaVERT (self-supervision)" in Table 1 of the paper).
- **Input:** 2 mice (resident, intruder) × 7 keypoints (nose, left ear, right ear, neck, left hip, right hip, tail base) × (x, y) = 28 values per frame; MARS pixel coordinates of a 1024 × 570 video.- **Windows:** 128 frames at 30 fps, step 64, overlapping predictions averaged.- **Test set** (19 sessions, 211,325 scored frames; "other" frames not scored):
| attack | investigation | mount | macro F1 ||---|---|---|---|| 0.794 | 0.889 | 0.930 | 0.871 |
## `mabe22-strain` — MABe22 strain
Mouse triplets; the strain (WT or TG) of 64-frame windows, combined into oneprediction per video. The strain model of Table 4 and the model analysed inFig. 8 (attention) of the paper.
- **Input:** 3 mice × 12 keypoints (nose, left ear, right ear, neck, left forepaw, right forepaw, center back, left hindpaw, right hindpaw, tail base, tail middle, tail tip) × (x, y) = 72 values per frame; MABe22 pixel coordinates as distributed, missing keypoints 0.- **Windows:** 64 frames at 30 fps, step 32; a video's label comes from its averaged window probabilities.- **Test set** (1,121 videos; video-level split 60/20/20, seed 42):
| | WT F1 | TG F1 | macro F1 ||---|---|---|---|| video level | 0.867 | 0.771 | 0.819 || window level | 0.809 | 0.696 | 0.753 |
## `oft-behavior` — open-field behavior
Single mouse, top-view open-field test; frame-level **supported rearing**,**unsupported rearing**, **grooming**, **freezing**, **jumping**, **backwardswalking** or **others**. Reads the keypoints of the `oft-pose` model, so`behavert decode --video … --model oft-behavior` goes from video to behavior in one step.
- **Input:** 1 mouse × 11 keypoints (nose, left ear, right ear, left forelimb, right forelimb, tail base, left hindlimb, right hindlimb, tail middle, tail tip, body center) × (x, y) = 22 values per frame, normalized to [0, 1] by frame width and height; frames without a detection are linearly interpolated. These are `oft-pose` keypoints 0, 1, 2, 4–11 (its thoracic center is not used).- **Windows:** 64 frames at 30 fps, step 32, overlapping predictions averaged.- **Training data:** top-view open-field recordings of single mice with frame-level behavior annotations made in our lab. Results depend on a similar setup (camera above a square open field, one mouse); check predictions on a few of your own videos before relying on them.
## Citation
```bibtex@article{shin2026behavert, title = {BehaVERT: A Transformer-Based Motion Language Model for Decoding Behavioral Semantics in Mice}, author = {Shin, Seung Jae and Lee, Junesu and Ko, Chang and Kim, Daesoo}, journal = {International Journal of Computer Vision}, volume = {134}, pages = {303}, year = {2026}, doi = {10.1007/s11263-026-02834-y}}```
`calms21-task1` was trained on CalMS21 (Sun et al., NeurIPS 2021 Datasets andBenchmarks) and `mabe22-strain` on MABe22 (Sun et al., ICML 2023); please citethose datasets as well when you use the models.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110{ "input_dim": 28, "num_classes": 4, "mode": "token", "max_seq_length": 128, "hidden_size": 768, "num_layers": 12, "num_heads": 12, "intermediate_size": 3072, "positional_encoding": "sinusoidal", "embedding_dropout": 0.0, "classifier_dropout": 0.1, "max_position_embeddings": 512, "label_names": [ "attack", "investigation", "mount", "other" ], "keypoints": { "dataset": "CalMS21 (Sun et al., 2021)", "num_animals": 2, "animal_names": [ "resident", "intruder" ], "names": [ "nose", "left_ear", "right_ear", "neck", "left_hip", "right_hip", "tail_base" ], "edges": [ [ 0, 1 ], [ 0, 2 ], [ 1, 3 ], [ 2, 3 ], [ 3, 4 ], [ 3, 5 ], [ 4, 6 ], [ 5, 6 ] ], "dims": 2, "units": "pixels", "frame_size": [ 1024, 570 ], "fps": 30 }, "preprocessing": { "coordinates": "raw MARS pixel coordinates (1024x570 frame), no normalization", "window": 128, "stride": 64, "ignored_label_for_metrics": "other" }, "description": "BehaVERT token model for CalMS21 Task 1 (attack / investigation / mount / other), masked-keypoint-modeling pretraining then supervised fine-tuning; 'BehaVERT (self-supervision)' row of Table 1.", "label_colors": [ "#E74C3C", "#F1C40F", "#3498DB", "#BDC3C7" ], "display": { "title": "CalMS21", "skeleton_title": "Skeleton", "embedding_title": "Sequence embedding (t-SNE)", "attention_label": "attention value", "confidence_label": "confidence", "truth_title": "GT behav", "prediction_title": "Pred", "label_overlay": "top", "label_legend": true, "animal_colors": [ "#FF5733", "#2E86C1" ], "embedding": { "perplexity_min": 2, "max_iter": 400 } }}123version https://git-lfs.github.com/spec/v1oid sha256:e7000617987c560ce096bf4efb3763820606bab4291e3b1e34368f417b7539ccsize 341930856123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188{ "input_dim": 72, "num_classes": 2, "mode": "sequence", "max_seq_length": 64, "hidden_size": 768, "num_layers": 12, "num_heads": 12, "intermediate_size": 3072, "positional_encoding": "learned", "embedding_dropout": 0.1, "classifier_dropout": 0.1, "max_position_embeddings": 512, "label_names": [ "WT", "TG" ], "keypoints": { "dataset": "MABe22 mouse triplets (Sun et al., 2023)", "num_animals": 3, "names": [ "nose", "left_ear", "right_ear", "neck", "left_forepaw", "right_forepaw", "center_back", "left_hindpaw", "right_hindpaw", "tail_base", "tail_middle", "tail_tip" ], "edges": [ [ 0, 1 ], [ 0, 2 ], [ 1, 3 ], [ 2, 3 ], [ 3, 6 ], [ 3, 4 ], [ 3, 5 ], [ 6, 7 ], [ 6, 8 ], [ 6, 9 ], [ 9, 10 ], [ 10, 11 ] ], "dims": 2, "units": "pixels", "frame_size": [ 800, 800 ], "fps": 30, "video_mapping": { "swap_xy": true, "scale": 0.44, "reference_width": 224 } }, "preprocessing": { "coordinates": "raw pixel coordinates as distributed, missing keypoints = 0, no normalization", "window": 64, "stride": 32, "video_level_prediction": "average of (p1 - p0) over windows, TG if >= 0" }, "description": "BehaVERT [CLS] sequence model for MABe22 binary strain classification (Table 4, Strain column); the model analysed in Fig. 8.", "label_colors": [ "#6FA8DC", "#E5847A" ], "display": { "title": "MaBe22 strain", "title_shows_truth": true, "skeleton_title": "3-mouse skeleton", "embedding_title": "CLS embedding (t-SNE)", "attention_label": "attention value", "confidence_label": "confidence", "truth_title": "GT strain", "prediction_title": "Pred strain", "label_overlay": "bottom", "label_legend": false, "animal_colors": [ "#FF5733", "#27AE60", "#2E86C1" ], "probability_colormap": [ "#6FA8DC", "#F2E5E2", "#E5847A" ], "embedding": { "reference_recordings": 200, "perplexity_min": 5, "max_iter": 600, "reference_alpha": 0.75, "alpha_min": 0.7 }, "extra_strip": { "title": "Behavior", "none": [ "none", "#ECECEC" ], "legend": true, "labels": [ [ "oral-oral", "#8B0000", "mabe22/task/behavior/contact/oral_oral_contact/mabe22_oral_oral_contact.pt" ], [ "oral-genital", "#D62728", "mabe22/task/behavior/contact/oral_genital_contact/mabe22_oral_genital_contact.pt" ], [ "oral-ear", "#E377C2", "mabe22/task/behavior/contact/oral_ear_contact/mabe22_oral_ear_contact.pt" ], [ "chase", "#FF7F0E", "mabe22/task/behavior/movement/chase/mabe22_chase.pt" ], [ "approach", "#FFB347", "mabe22/task/behavior/movement/approach/mabe22_approach.pt" ], [ "huddles", "#2CA02C", "mabe22/task/behavior/contact/huddles/mabe22_huddles.pt" ], [ "watching", "#17BECF", "mabe22/task/behavior/watching/mabe22_watching.pt" ], [ "close", "#9467BD", "mabe22/task/behavior/contact/close/mabe22_close.pt" ] ] } }}123version https://git-lfs.github.com/spec/v1oid sha256:282ae475093d324326f4cab036b4e9ec672d120a456d98751490cfe903b3f18asize 344625360123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234{ "input_dim": 22, "num_classes": 7, "mode": "token", "max_seq_length": 64, "hidden_size": 768, "num_layers": 12, "num_heads": 12, "intermediate_size": 3072, "positional_encoding": "sinusoidal", "embedding_dropout": 0.0, "classifier_dropout": 0.1, "head_hidden": 0, "problem": "classification", "max_position_embeddings": 512, "label_names": [ "supported_rearing", "unsupported_rearing", "grooming", "freezing", "jumping", "backwards_walking", "others" ], "keypoints": { "dataset": "open-field test (OFT), single mouse, top view", "num_animals": 1, "names": [ "nose", "left_ear", "right_ear", "left_forelimb", "right_forelimb", "tail_base", "left_hindlimb", "right_hindlimb", "tail_middle", "tail_tip", "body_center" ], "edges": [ [ 0, 1 ], [ 0, 2 ], [ 1, 10 ], [ 2, 10 ], [ 10, 3 ], [ 10, 4 ], [ 10, 5 ], [ 5, 6 ], [ 5, 7 ], [ 5, 8 ], [ 8, 9 ] ], "dims": 2, "units": "normalized", "fps": 30, "pose_model": "oft-pose", "pose_indices": [ 0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11 ] }, "preprocessing": { "coordinates": "x / frame width, y / frame height; frames without a detection are linearly interpolated", "window": 64, "stride": 32 }, "description": "BehaVERT token model for seven open-field behaviors of a single mouse.", "display": { "title": "OFT", "skeleton_title": "Skeleton", "embedding_title": "Sequence embedding (t-SNE)", "attention_label": "attention value", "confidence_label": "confidence", "truth_title": "GT behav", "prediction_title": "Pred", "label_overlay": "top", "label_legend": true, "animal_colors": [ "#FF5733" ], "embedding": { "perplexity_min": 2, "max_iter": 400 }, "overlay": { "edge_colors_bgr": [ [ 38, 32, 193 ], [ 38, 77, 229 ], [ 35, 142, 247 ], [ 21, 192, 254 ], [ 110, 37, 109 ], [ 160, 37, 209 ], [ 68, 174, 97 ], [ 176, 141, 13 ], [ 97, 97, 255 ], [ 176, 97, 13 ], [ 120, 120, 120 ] ], "label_colors_bgr": [ [ 0, 0, 255 ], [ 0, 165, 255 ], [ 0, 255, 255 ], [ 0, 255, 0 ], [ 255, 0, 0 ], [ 255, 0, 255 ], [ 200, 200, 200 ] ], "line_thickness": 2, "point_radius": 3, "point_color_bgr": [ 0, 0, 0 ], "font_scale": 1.0, "show_confidence": false } }}123version https://git-lfs.github.com/spec/v1oid sha256:221c57f1292a085887de9069c5713d1c0f89bcfde5cec6b3223d4534f137cabfsize 341921652README.mdAdded+125
calms21-task1/config.jsonAdded+110
calms21-task1/model.safetensorsAdded+3
mabe22-strain/config.jsonAdded+188
mabe22-strain/model.safetensorsAdded+3
oft-behavior/config.jsonAdded+234
oft-behavior/model.safetensorsAdded+3