This repository hosts the trained models and inference code accompanying the
study on Kurdish handwritten word recognition with the proposed
Frequency-Adaptive Attention (FAA) mechanism, evaluated on the DASTNUS
Unique Words subset against three competitive attention baselines under a
controlled multi-seed protocol.
The repository includes four base architectures (Baseline, Luong, MHSA, and
the proposed FAA).
All four model families share an identical CNN and BiLSTM backbone and differ
only in the attention block placed between BiLSTM layers 2 and 3, which
isolates the contribution of each attention design.
Model
Attention Block
Parameters
Baseline
none
3,838,065
Luong
multiplicative attention
3,915,345
MHSA
Multi-Head Self-Attention (4 heads, ff = 320)
4,044,625
FAA (proposed)
Frequency-Adaptive Attention
3,997,859
Shared backbone:
CNN: 6 convolutional blocks, maximum 256 channels
RNN: 3 BiLSTM layers, hidden size 160 per direction
The inference script automatically detects the model family from the
config.json next to the chosen model.safetensors, so a single command
works for any of the seven model folders in this repository.
bash
1# Single image2python Scripts/inference.py \3 --image Sample/sample_word.tif \4 --model_path FAA-Word-Model/model.safetensors \5 --vocab_path FAA-Word-Model/vocab.json
67# Directory of images, save predictions to TSV8python Scripts/inference.py \9 --image_dir ./test_words \10 --model_path FAA-Word-Model/model.safetensors \11 --vocab_path FAA-Word-Model/vocab.json \12 --output_file predictions.tsv
Training
The training script handles all four model families via the --model_type
flag, sharing the identical backbone and hyperparameters used in the paper.