GlobalFaceNet

Reading emotion from a single face, by looking at the fine detail and the whole face at once.

A CNN–Transformer hybrid that classifies a face into one of seven emotions. Two pathways: one reads local detail, the other the global layout, then they combine.

Stage 1 · The task

Seven emotions from one face

Given a single face image, the model picks one of seven expressions from the RAF-DB dataset. No audio, no video: just the still image.

  • surprise
  • fear
  • disgust
  • happy
  • sad
  • angry
  • neutral

RAF-DB is available to researchers on request and isn't hosted here; the faces below are simple drawings, for illustration.

Stage 2 · Input

A 100×100 face

Each face is resized to 100×100 with three colour channels and normalised. Light augmentation (rotation, shifts, horizontal flip) is used during training.

100 × 100 × 3 · normalised to [0, 1]

Stage 3 · CNN backbone

Convolutions read local structure

Four convolution blocks grow the channels and shrink the map (32 → 64 → 128 → 512), turning pixels into local features (edges, brows, mouth shapes).

input100² · 3
conv150² · 32
conv225² · 64
conv313² · 128
conv46² · 512
Stage 4 · Two pathways

Local detail + global context, then fused

The feature maps feed two branches. The CNN path pools the deep 512-channel map for fine local detail. The Transformer path cuts the 128-channel map into 2×2 patches, adds positional encodings, and runs two Transformer blocks (8 heads) to capture global spatial relationships. The two are concatenated, then a dense head predicts the emotion.

face100²·3CNN32·64·128·5122×2 patches36 · + positionalTransformer × 28 heads · dim 256poolDense 256512-map poolGAPDense 256concat512GLOBAL · Vision Transformer pathLOCAL · CNN path→ Dense 512 · dropout 0.5→ softmax · 7 emotions
Stage 5 · Predict

Pick an emotion, watch it classify

Choose an expression; the face shows it and the model's seven-way output updates. (Illustrative example outputs: the shape of a confident prediction.)

surprise2%
fear1%
disgust1%
happy88%
sad3%
angry2%
neutral3%

Predicted: happy