Pretrained model weights for the
Cattle Vision Framework, an MS thesis project on multi-behavior recognition in dairy cattle from surveillance video.
Cross-dataset evaluation uses IDs 0–4 only.
1experiment_name: videomae_combined_v1
2model_name: MCG-NJU/videomae-base-finetuned-kinetics
3num_classes: 7
4
5train:
6 dataset_filter: null # combined CBVD-5 + CVB
7 split_filter: train
8
9batch_size: 8
10grad_accum_steps: 4 # effective batch = 32
11num_epochs: 30
12lr: 5.0e-5
13lr_head: 1.0e-3
14weight_decay: 0.05
15warmup_epochs: 3
16early_stopping_patience: 8
17use_class_weights: true
1experiment_name: rfdetr_combined_v1
2model:
3 type: RFDETRMedium
4 pretrained: true
5dataset:
6 name: combined
7 num_classes: 1 # single class: cattle
8training:
9 epochs: 100
10 batch_size: 2
11 grad_accum_steps: 8 # effective batch = 16
12 resolution: 576 # must be divisible by 64
13 lr: 1.0e-4
14 lr_encoder: 1.5e-4
15 gradient_checkpointing: true
16 use_ema: true
1# Install CLI
2pip install huggingface-hub
3
4# Download best behavior model
5huggingface-cli download sakifkhan98/cattle-vision-framework videomae_combined_v1.pt \
6 --local-dir weights/
7
8# Download backbone
9huggingface-cli download sakifkhan98/cattle-vision-framework rf-detr-medium.pth \
10 --local-dir weights/
1import torch
2from transformers import VideoMAEForVideoClassification
3
4# Load checkpoint
5ckpt = torch.load("weights/videomae_combined_v1.pt", map_location="cpu")
6model = VideoMAEForVideoClassification.from_pretrained(
7 "MCG-NJU/videomae-base-finetuned-kinetics",
8 num_labels=7,
9 ignore_mismatched_sizes=True,
10)
11model.load_state_dict(ckpt["model_state_dict"])
12model.eval()
13
14LABEL_NAMES = {
15 0: "Standing", 1: "Lying", 2: "Foraging",
16 3: "Drinking", 4: "Ruminating", 5: "Grooming", 6: "Other"
17}
1from rfdetr import RFDETRMedium
2import torch
3
4model = RFDETRMedium()
5ckpt = torch.load("weights/rfdetr_combined_v1_best.pth", map_location="cpu")
6model.load_state_dict(ckpt["model"])
7model.eval()
1@mastersthesis{khan2026cattle,
2 author = {Sakif Khan},
3 title = {Multi-Behavior Recognition in Dairy Cattle from Surveillance Video},
4 school = {Texas State University},
5 year = {2026},
6}