All models

DAN (Distract-your-Attention Network FER)

A ResNet-18 facial expression classifier with four attention heads trained to attend to different face regions.

Image classification · 156 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (28 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Family
DAN
Parameters
19.7M
Operations
156
Framework
PyTorch
Recurrent
No
Published
Biomimetics 2023, 8(2), 199
Cited by
316 (as of 27 October 2026)
Authors
Zhengyao Wen, Wenzhong Lin, Tao Wang, Ge Xu
License
MIT
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m15534
Graph hash
65776845d590cfa364dfe36a118395d36abfa481109eb194e0b4d3cd54ebee7c
Skeleton hash
c21991041e2e82cc2f29b50a5a40f45916ea9c099a8fa31112509c9deffc7a21
Architecture hash
719c51b1c0770e61070f42f7f7d0415493520cf965c98756fcf049e5f85a182a
Diagram SHA-256
5fde523f8b82623af22a70b0ba5a3965867b148593b1bbfd68c738d2123a2bb1
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

DAN, the Distract your Attention Network, recognizes facial expressions from face images. It starts from two observations: several expression classes share similar underlying facial appearance, and an expression shows itself through multiple facial regions at once. The authors argue that a model with only a single attention head has difficulty concentrating on various parts of the face at the same time.

The network is divided into three components. The Feature Clustering Network is a residual backbone, ResNet18 in all the paper's experiments, trained with an affinity loss that moves features closer to their class center and pushes the centers of different classes apart. The Multi-head Attention Network contains a few parallel heads, each a spatial attention unit followed by a channel attention unit. The spatial unit uses 1 × 1, 1 × 3, 3 × 1 and 3 × 3 convolution kernels to capture local features at multiple scales. The Attention Fusion Network adds a partition loss that instructs the heads to focus on different regions, then merges the attention feature vectors into one and computes class confidence with a linear layer.

Four attention heads are used throughout the paper's experiments. The paper reports accuracy of 62.09% on AffectNet-8, 65.69% on AffectNet-7, 89.70% on RAF-DB and 53.18% on SFEW 2.0.

Key idea. DAN shows that several attention heads, trained with a partition loss to attend to non-overlapping face regions, recognize expressions better than a single attention module.

  • DAN
  • Distract your Attention Network
  • facial expression recognition
  • FER
  • multi-head cross attention
  • affinity loss
  • attention fusion network
  • emotion recognition

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{wen2023distractattentionmultiheadcross,
      title={Distract Your Attention: Multi-head Cross Attention Network for Facial Expression Recognition}, 
      author={Zhengyao Wen and Wenzhong Lin and Tao Wang and Ge Xu},
      year={2023},
      eprint={2109.07270},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      doi={https://doi.org/10.3390/biomimetics8020199},
      url={https://arxiv.org/abs/2109.07270}, 
}