Add CAM-AH ensemble-5 original weights (official Macro-F1 0.7456 @ thr 0.595)
Browse files- README.md +135 -0
- ensemble_config.json +53 -0
- members/20260711_191444/best-epoch=00-val_ap=0.8790.ckpt +3 -0
- members/20260711_191444/trainer_state.json +10 -0
- members/20260711_191555/best-epoch=00-val_ap=0.8749.ckpt +3 -0
- members/20260711_191555/trainer_state.json +10 -0
- members/20260711_191626/best-epoch=01-val_ap=0.8639.ckpt +3 -0
- members/20260711_191626/trainer_state.json +10 -0
- members/20260711_191656/best-epoch=00-val_ap=0.8769.ckpt +3 -0
- members/20260711_191656/trainer_state.json +10 -0
- members/20260711_191725/best-epoch=01-val_ap=0.8747.ckpt +3 -0
- members/20260711_191725/trainer_state.json +10 -0
README.md
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- audio
|
| 4 |
+
- text
|
| 5 |
+
- multimodal
|
| 6 |
+
- cross-attention
|
| 7 |
+
- multiple-instance-learning
|
| 8 |
+
- ambivalence
|
| 9 |
+
- hesitancy
|
| 10 |
+
- abaw
|
| 11 |
+
- pytorch-lightning
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# CAM-AH — Cross-Attention-Multimodal-Ambivalence-Hesitation
|
| 15 |
+
|
| 16 |
+
Original weights of the model behind our **best official submission** to the
|
| 17 |
+
*AH Video Recognition Challenge, 3rd edition (ABAW11 @ ECCV 2026)*: a **5-seed ensemble** of an
|
| 18 |
+
audio ⟷ text cross-attention network with psycholinguistic support features and gated
|
| 19 |
+
attention-MIL pooling, run at a **fixed decision threshold of 0.595**.
|
| 20 |
+
|
| 21 |
+
| Official private test (152 videos) | Value |
|
| 22 |
+
|---|---|
|
| 23 |
+
| Macro-F1 | **0.7456** |
|
| 24 |
+
| Average precision (class 1) | 0.8182 |
|
| 25 |
+
| Decision threshold | 0.595 (60 predicted positives) |
|
| 26 |
+
|
| 27 |
+
- Paper: [*Audio-Text Cross-Attention with Psycholinguistic Support Features for Ambivalence/Hesitancy Recognition*](https://arxiv.org/abs/2607.13345)
|
| 28 |
+
- Code: [Liga-de-IA-PUCPR/abaw-11-ah-challenge](https://github.com/Liga-de-IA-PUCPR/abaw-11-ah-challenge)
|
| 29 |
+
|
| 30 |
+
## Files
|
| 31 |
+
|
| 32 |
+
```
|
| 33 |
+
members/<run>/best-epoch=XX-val_ap=0.XXXX.ckpt # original PyTorch Lightning checkpoints (5 members)
|
| 34 |
+
members/<run>/trainer_state.json # per-member dims / fusion options
|
| 35 |
+
ensemble_config.json # members, combination rule, threshold, hyperparameters
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
Each checkpoint is the unmodified Lightning file (weights + optimizer/loop state). The model
|
| 39 |
+
weights live in `state_dict` under the `model.` prefix, about 2.96M parameters per member.
|
| 40 |
+
The `threshold` field of each `trainer_state.json` is a per-member calibration. The ensemble
|
| 41 |
+
ignores it and uses the fixed 0.595 from `ensemble_config.json`.
|
| 42 |
+
|
| 43 |
+
## Model
|
| 44 |
+
|
| 45 |
+
Each video is sliced into **5 s windows (hop 2.5 s)** aligned to the Whisper transcript by
|
| 46 |
+
timestamp. Each window gets three feature vectors:
|
| 47 |
+
|
| 48 |
+
| Input | Dim | Source |
|
| 49 |
+
|---|---|---|
|
| 50 |
+
| `feat_a` audio | 320 | librosa prosodic features (80 features × 4 statistics) |
|
| 51 |
+
| `feat_b` text | 768 | [`cardiffnlp/twitter-roberta-base-emotion`](https://huggingface.co/cardiffnlp/twitter-roberta-base-emotion), masked mean pool + L2 |
|
| 52 |
+
| `feat_tab` support | 74 | question type (7) + acoustic hesitation (18) + textual A/H cues (49) |
|
| 53 |
+
|
| 54 |
+
Per member, with inputs of shape `(B, T, ·)` and a padding mask `(B, T)`:
|
| 55 |
+
|
| 56 |
+
1. Project audio and text to 512-d. Audio is the query and text is the key/value in an 8-head
|
| 57 |
+
cross-attention, followed by a residual connection and LayerNorm.
|
| 58 |
+
2. **Token fusion.** The support features go through a masked BatchNorm, then Linear + ReLU +
|
| 59 |
+
LayerNorm, and are concatenated with each window token before a fusion layer (512-d).
|
| 60 |
+
3. **Gated attention-MIL pooling** (Ilse et al., 2018) over the windows produces one vector
|
| 61 |
+
per video.
|
| 62 |
+
4. An MLP head (512 → 512 → 1, dropout 0.3) outputs one logit per video.
|
| 63 |
+
|
| 64 |
+
**Ensemble:** average the 5 members' sigmoid probabilities. A video is predicted positive
|
| 65 |
+
(`1`) when the mean probability is at least **0.595**.
|
| 66 |
+
|
| 67 |
+
## Training
|
| 68 |
+
|
| 69 |
+
- Data: BAH `train` + `val` splits (902 videos). Checkpoint selection and early stopping
|
| 70 |
+
used AP on the internal `test` split (525 videos); this is the `val_ap` in the file names.
|
| 71 |
+
- Members: 5 identical models with seeds `{42, 1, 2, 3, 4}`.
|
| 72 |
+
- Optimization: AdamW, lr 3e-4, weight decay 0.05, gradient clip 1.0, batch size 32, early
|
| 73 |
+
stopping patience 20. The models saturate in 1–2 epochs.
|
| 74 |
+
- Threshold: the ranking comes from the ensemble, and the operating point was fixed at 0.595
|
| 75 |
+
for the official test set. Its positive rate is lower than that of the internal
|
| 76 |
+
calibration split, and the original calibrated threshold was 0.45 (official Macro-F1 0.6837).
|
| 77 |
+
|
| 78 |
+
## Usage
|
| 79 |
+
|
| 80 |
+
The features have to be produced by the project's pipeline (`make data`) or by the
|
| 81 |
+
self-contained notebook `notebooks/ensemble5_pipeline.ipynb` in the code repository. The
|
| 82 |
+
network definition is `src/models/cross_attention.py` (`_CrossAttentionFusionModule`).
|
| 83 |
+
|
| 84 |
+
```python
|
| 85 |
+
import json, torch
|
| 86 |
+
from huggingface_hub import snapshot_download
|
| 87 |
+
|
| 88 |
+
path = snapshot_download("LF-BF/CAM-AH")
|
| 89 |
+
cfg = json.load(open(f"{path}/ensemble_config.json"))
|
| 90 |
+
|
| 91 |
+
def load_member(ckpt_file, module):
|
| 92 |
+
sd = torch.load(f"{path}/{ckpt_file}", map_location="cpu", weights_only=False)["state_dict"]
|
| 93 |
+
module.load_state_dict({k.removeprefix("model."): v for k, v in sd.items()})
|
| 94 |
+
return module.eval()
|
| 95 |
+
|
| 96 |
+
# members = [load_member(f, build_module(cfg["architecture"])) for f in cfg["members"]]
|
| 97 |
+
# with torch.no_grad():
|
| 98 |
+
# p = torch.stack([m(feat_a, feat_b, pad_mask, feat_tab).sigmoid() for m in members]).mean(0)
|
| 99 |
+
# pred = (p >= cfg["threshold"]).long()
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
## Data and terms of use
|
| 103 |
+
|
| 104 |
+
The model was trained on the **BAH dataset** (Behavioural Ambivalence/Hesitancy). The
|
| 105 |
+
dataset is **not** included here and is distributed only by its authors under their EULA
|
| 106 |
+
([github.com/sbelharbi/bah-dataset](https://github.com/sbelharbi/bah-dataset)). These
|
| 107 |
+
weights are intended for non-commercial academic research.
|
| 108 |
+
|
| 109 |
+
This work was carried out using the BAH dataset: a Multimodal Dataset – created and managed by
|
| 110 |
+
the Montréal Behavioural Medicine Centre (MBMC: https://mbmc-cmcm.ca) and the Imaging, Vision
|
| 111 |
+
and Artificial Intelligence Laboratory (LIVIA: https://www.etsmtl.ca/laboratoires/livia).
|
| 112 |
+
|
| 113 |
+
## Citation
|
| 114 |
+
|
| 115 |
+
```bibtex
|
| 116 |
+
@article{martins2026audiotext,
|
| 117 |
+
title = {Audio-Text Cross-Attention with Psycholinguistic Support Features
|
| 118 |
+
for Ambivalence/Hesitancy Recognition},
|
| 119 |
+
author = {Martins, Luiz F. B. F. and Pisaia, Rodrigo W. and Girardi, Matheus M.
|
| 120 |
+
and Berkembrock, Isabella and Almeida, Jo{\~a}o A. and Hochuli, Andr{\'e} G.
|
| 121 |
+
and Laroca, Rayson and Britto Jr., Alceu S.},
|
| 122 |
+
journal = {arXiv preprint arXiv:2607.13345},
|
| 123 |
+
year = {2026},
|
| 124 |
+
doi = {10.48550/arXiv.2607.13345},
|
| 125 |
+
url = {https://arxiv.org/abs/2607.13345}
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
@inproceedings{gonzalez-26-bah,
|
| 129 |
+
title = {{BAH} Dataset for Ambivalence/Hesitancy Recognition in Videos for Digital Behavioural Change},
|
| 130 |
+
author = {González-González, M. and Belharbi, S. and Zeeshan, M. O. and Sharafi, M. and
|
| 131 |
+
Aslam, M. H and Pedersoli, M. and Koerich, A. L. and Bacon, S. L. and Granger, E.},
|
| 132 |
+
booktitle = {ICLR},
|
| 133 |
+
year = {2026}
|
| 134 |
+
}
|
| 135 |
+
```
|
ensemble_config.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "CAM-AH",
|
| 3 |
+
"full_name": "Cross-Attention-Multimodal-Ambivalence-Hesitation",
|
| 4 |
+
"task": "video-level binary classification (1 = ambivalence/hesitancy present)",
|
| 5 |
+
"members": [
|
| 6 |
+
"members/20260711_191444/best-epoch=00-val_ap=0.8790.ckpt",
|
| 7 |
+
"members/20260711_191555/best-epoch=00-val_ap=0.8749.ckpt",
|
| 8 |
+
"members/20260711_191626/best-epoch=01-val_ap=0.8639.ckpt",
|
| 9 |
+
"members/20260711_191656/best-epoch=00-val_ap=0.8769.ckpt",
|
| 10 |
+
"members/20260711_191725/best-epoch=01-val_ap=0.8747.ckpt"
|
| 11 |
+
],
|
| 12 |
+
"seeds": [42, 1, 2, 3, 4],
|
| 13 |
+
"state_dict_prefix": "model.",
|
| 14 |
+
"combine": "mean of per-video sigmoid probabilities",
|
| 15 |
+
"threshold": 0.595,
|
| 16 |
+
"threshold_note": "Fixed decision threshold used in the best official submission (predict 1 if mean probability >= 0.595). Overrides the per-member thresholds stored in each trainer_state.json.",
|
| 17 |
+
"architecture": {
|
| 18 |
+
"dim_a": 320,
|
| 19 |
+
"dim_b": 768,
|
| 20 |
+
"dim_tab": 74,
|
| 21 |
+
"common_dim": 512,
|
| 22 |
+
"num_heads": 8,
|
| 23 |
+
"dropout": 0.3,
|
| 24 |
+
"pool": "attention",
|
| 25 |
+
"tab_fusion": "token",
|
| 26 |
+
"use_tabular": true,
|
| 27 |
+
"num_outputs": 1
|
| 28 |
+
},
|
| 29 |
+
"inputs": {
|
| 30 |
+
"window": {"size_s": 5.0, "hop_s": 2.5},
|
| 31 |
+
"feat_a": "librosa prosodic features per window (80 features x 4 stats = 320-d)",
|
| 32 |
+
"feat_b": "cardiffnlp/twitter-roberta-base-emotion, masked mean pool + L2 norm, max_length 128 (768-d)",
|
| 33 |
+
"feat_tab": "74 support features per window: question type (7) + acoustic hesitation (18) + textual A/H cues (49)",
|
| 34 |
+
"key_padding_mask": "(B, T) bool, True = padded window"
|
| 35 |
+
},
|
| 36 |
+
"training": {
|
| 37 |
+
"train_splits": ["train", "val"],
|
| 38 |
+
"n_train_videos": 902,
|
| 39 |
+
"monitor_split": "test (internal, 525 videos)",
|
| 40 |
+
"monitor": "val_ap (max)",
|
| 41 |
+
"optimizer": "AdamW",
|
| 42 |
+
"lr": 3e-4,
|
| 43 |
+
"weight_decay": 0.05,
|
| 44 |
+
"gradient_clip_val": 1.0,
|
| 45 |
+
"batch_size": 32,
|
| 46 |
+
"max_epochs": 400,
|
| 47 |
+
"early_stopping_patience": 20
|
| 48 |
+
},
|
| 49 |
+
"results": {
|
| 50 |
+
"official_private_test": {"n_videos": 152, "macro_f1": 0.745595, "average_precision": 0.818211, "threshold": 0.595},
|
| 51 |
+
"internal_test_525": {"average_precision": 0.877}
|
| 52 |
+
}
|
| 53 |
+
}
|
members/20260711_191444/best-epoch=00-val_ap=0.8790.ckpt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5c1fc408b39eab9461acd7ce76d7acedd68bc4ac03979e39f9493b4f4f15e952
|
| 3 |
+
size 35608709
|
members/20260711_191444/trainer_state.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"threshold": 0.5076700448989868,
|
| 3 |
+
"ckpt_path": "/Users/lfbf/Documents/Projetos_Academicos/Liga_IA_OneDrive/abaw-11-ah-challenge/outputs/cross_attention/20260711_191444/checkpoints/best-epoch=00-val_ap=0.8790.ckpt",
|
| 4 |
+
"dim_a": 320,
|
| 5 |
+
"dim_b": 768,
|
| 6 |
+
"dim_tab": 74,
|
| 7 |
+
"use_tabular": true,
|
| 8 |
+
"pool": "attention",
|
| 9 |
+
"tab_fusion": "token"
|
| 10 |
+
}
|
members/20260711_191555/best-epoch=00-val_ap=0.8749.ckpt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8c6dcf8cba25a41a5644a025e3935cd8f9d8c446843741ad8cd986888c514f07
|
| 3 |
+
size 35608709
|
members/20260711_191555/trainer_state.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"threshold": 0.24121101200580597,
|
| 3 |
+
"ckpt_path": "/Users/lfbf/Documents/Projetos_Academicos/Liga_IA_OneDrive/abaw-11-ah-challenge/outputs/cross_attention/20260711_191555/checkpoints/best-epoch=00-val_ap=0.8749.ckpt",
|
| 4 |
+
"dim_a": 320,
|
| 5 |
+
"dim_b": 768,
|
| 6 |
+
"dim_tab": 74,
|
| 7 |
+
"use_tabular": true,
|
| 8 |
+
"pool": "attention",
|
| 9 |
+
"tab_fusion": "token"
|
| 10 |
+
}
|
members/20260711_191626/best-epoch=01-val_ap=0.8639.ckpt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4705a333555e4f61d0e03134e6a3c6b036310c37e2b6f94ded19731588d3a7e3
|
| 3 |
+
size 35608709
|
members/20260711_191626/trainer_state.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"threshold": 0.4241614043712616,
|
| 3 |
+
"ckpt_path": "/Users/lfbf/Documents/Projetos_Academicos/Liga_IA_OneDrive/abaw-11-ah-challenge/outputs/cross_attention/20260711_191626/checkpoints/best-epoch=01-val_ap=0.8639.ckpt",
|
| 4 |
+
"dim_a": 320,
|
| 5 |
+
"dim_b": 768,
|
| 6 |
+
"dim_tab": 74,
|
| 7 |
+
"use_tabular": true,
|
| 8 |
+
"pool": "attention",
|
| 9 |
+
"tab_fusion": "token"
|
| 10 |
+
}
|
members/20260711_191656/best-epoch=00-val_ap=0.8769.ckpt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:629eefa76235685943d39b8133437db82448a4f79df26b301c3fde6d24792d03
|
| 3 |
+
size 35608709
|
members/20260711_191656/trainer_state.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"threshold": 0.2708229422569275,
|
| 3 |
+
"ckpt_path": "/Users/lfbf/Documents/Projetos_Academicos/Liga_IA_OneDrive/abaw-11-ah-challenge/outputs/cross_attention/20260711_191656/checkpoints/best-epoch=00-val_ap=0.8769.ckpt",
|
| 4 |
+
"dim_a": 320,
|
| 5 |
+
"dim_b": 768,
|
| 6 |
+
"dim_tab": 74,
|
| 7 |
+
"use_tabular": true,
|
| 8 |
+
"pool": "attention",
|
| 9 |
+
"tab_fusion": "token"
|
| 10 |
+
}
|
members/20260711_191725/best-epoch=01-val_ap=0.8747.ckpt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d4b9e223a961a44aacf8ea85fac0cb06034d7285bcc238a9fe90bac84e660419
|
| 3 |
+
size 35608709
|
members/20260711_191725/trainer_state.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"threshold": 0.5483624935150146,
|
| 3 |
+
"ckpt_path": "/Users/lfbf/Documents/Projetos_Academicos/Liga_IA_OneDrive/abaw-11-ah-challenge/outputs/cross_attention/20260711_191725/checkpoints/best-epoch=01-val_ap=0.8747.ckpt",
|
| 4 |
+
"dim_a": 320,
|
| 5 |
+
"dim_b": 768,
|
| 6 |
+
"dim_tab": 74,
|
| 7 |
+
"use_tabular": true,
|
| 8 |
+
"pool": "attention",
|
| 9 |
+
"tab_fusion": "token"
|
| 10 |
+
}
|