MVD recognizes actions in mouse behavior videos
MVD (Masked Video Distillation) is a video transformer that recognizes the action in a short clip. In Supervisely it is trained to recognize mouse behavior in lab videos: self-grooming, head and body twitches, and idle time. The result is a set of action intervals tagged on the video timeline, next to a bounding box that follows the mouse.

- Tasks
- Action recognition
- Labels
- Tags on frame ranges of videos
- Bounding boxes of the mouse from the detector
- Apps
- Train, Apply
Apps in the Supervisely Ecosystem
Every model in Supervisely comes as a Supervisely App: a module from the Ecosystem that plugs into the platform and runs on your own GPU, with no code to install. A Serve App puts the model behind the labeling tools, and where the model can be trained, a Train App fits it to your labeled project. All Apps work on the same projects, so you add a model, update it or swap it for another without changing anything else.
What is MVD?
MVD was introduced in "Masked Video Distillation: Rethinking Masked Feature Modeling for Self-supervised Video Representation Learning" (CVPR 2023, code). It pretrains a video transformer in two stages: first a teacher, an image or a video model, learns to recover low-level features of masked patches; then a student learns to predict the teacher's features of masked patches. The authors found that video teachers help more on tasks driven by motion and image teachers on tasks driven by appearance, so MVD distills students from both. With a ViT-Large backbone it reports 86.4% top-1 accuracy on Kinetics-400 and 76.7% on Something-Something v2.
Built for mouse behavior
The Supervisely apps fine-tune MVD for one job: recognizing what a mouse does in a lab video. Training starts from MVD checkpoints pretrained on Kinetics-400 (the app's table lists ViT-S, ViT-B and ViT-L, at 80.6, 83.4 and 86.0 top-1) and learns three classes:
- idle: the mouse does none of the actions of interest.
- Self-Grooming: the mouse grooms itself.
- Head/Body TWITCH: quick, jerky movements of the head or body.
MVD sees only short clips and says what happens, not where, so the pipeline adds a detector. A custom RT-DETRv2 model finds the mouse in each frame, the video is cropped to the mouse's bounding box so the background matters less, and MVD classifies the crop window by window.
From labeled videos to a trained model
- Import the videos into one video project, and add new footage to the same project later so that preprocessing can skip videos it has already handled.
- Label each action as a tag with a start and an end on the timeline of the video labeling toolbox. You do not draw boxes; the detector adds them.
- Deploy the mouse detector with Serve RT-DETRv2, then run Preprocess Data for Mouse Action Recognition. It crops the videos to the mouse, cuts them into clips of about two to three seconds, balances idle clips against self-grooming ones and keeps full-length videos aside as a test set; about ten are enough.
- Run Train Mouse Action Recognition from the Training Data project that preprocessing creates, on an agent with a GPU. The detector is not used in training, so its session can be stopped.
- Set the hyperparameters, name the experiment and follow the charts. At the end the app evaluates the best checkpoint on the full-length test videos and reports precision, recall and F1 for each action.
Training can take hours or days, depending on the amount of data and the settings, and the checkpoints are saved to Team Files.
Clip length and sampling rate
The model sees num_frames frames taken every sampling_rate frames: 16 and 2 by default, a window of 32 frames or about one second of video. A twitch is fast and can fall between sampled frames, so the tutorial recommends sampling_rate 1 with num_frames 32, which needs a high-end GPU or several GPUs. Keep the batch size at 6 to 8 or more on a single GPU. The app trains with DeepSpeed and has no ONNX or TensorRT export.
Running the trained model
Mouse action recognition runs from the context menu of a video project or dataset and needs a GPU. Give it the Team Files paths of the RT-DETRv2 checkpoint and of the trained MVD checkpoint. It slides a window along each video, predicts an action for each window and joins the results, then creates a new project with the same structure: predicted bounding boxes of the mouse and the predicted actions as tags on the timeline. Long datasets can take several hours.
Both models also run outside Supervisely, in Docker, with the inference script of the mouse-action-recognition repository.
Scope and limits
This is a pipeline for one domain, not a general action recognizer: the preprocessing app extracts clips for the three classes above, and training must start from the project it creates, since a project that has not been preprocessed can make the training app fail. MVD gives the action and its time span; where the mouse is comes from the detector. To follow other objects through a video without training, use a tracker such as MCITrack for bounding boxes or XMem for masks.
Frequently asked questions.
What is MVD (Masked Video Distillation)?
MVD is a two-stage method for pretraining video transformers, published at CVPR 2023: an image or video teacher first learns to recover masked patches, then a student learns to predict the teacher's features of masked patches. With ViT-Large it reports 86.4% top-1 accuracy on Kinetics-400.
Can Supervisely detect mouse grooming in videos automatically?
Yes, after you train on your own labeled videos. Train Mouse Action Recognition fine-tunes MVD to recognize self-grooming, head and body twitches and idle time, and the Mouse action recognition app tags those actions on the timeline of new videos.
Do I need to draw boxes around the mouse?
No. Label only the actions, as tags with a start and an end. A custom RT-DETRv2 detector finds the mouse during preprocessing and inference, and the video is cropped to it.
What is action recognition?
Action recognition classifies what happens in a video clip, such as grooming or walking, rather than which objects appear in a frame. MVD is a video transformer for this task; in Supervisely it labels the actions of a mouse as tags on the video timeline.
Train and serve models on your own data.
Label a project in a free account, train a model on it from the browser and deploy it on your own GPU. Or book a demo to run Supervisely on your servers.



