Dataset Viewer
The dataset could not be loaded because the splits use different data file formats, which is not supported. Read more about the splits configuration. Click for more details.
Couldn't infer the same data file format for all splits. Got {NamedSplit('train'): (None, {}), NamedSplit('validation'): ('text', {}), NamedSplit('test'): ('text', {})}
Error code:   FileFormatMismatchBetweenSplitsError

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

SLRT: Skeleton-based Sign Language Recognition and Translation

This repository implements a two-stage continuous sign language pipeline on 3D skeleton keypoints:

keypoints ──► SLR network ──► gloss sequence
                                  │
                                  ├──► (evaluation) WER
                                  │
                                  └──► SLT network (mBART) ──► spoken-language text
  • SLR (SLR.py) — Continuous sign language recognition. A CESMM backbone (pose graph over face / left-hand / right-hand parts with cross-part fusion) extracts spatial features, a 2-layer BiLSTM models temporal context, and CTC decodes glosses. Two decoding branches (ConvCTC and SeqCTC) are trained jointly with mutual distillation (VAC-style loss).
  • SLT (SLT.py) — Sign language translation. The SLR feature is projected by a small MLP and fed to an mBART encoder-decoder, which generates the spoken-language sentence.

Supported datasets: CSL-Daily and Phoenix-2014T.

eval_slp.py / eval_slp_dev.py are SLP-style evaluation scripts and are out of scope for this document.


1. Repository layout

.
├── SLR.py                      # SLR train / test entry point
├── SLT.py                      # SLT train / test entry point
├── dataloader_skeleton.py      # Dataset, frame selection, batching
├── configs/
│   ├── SLR.yaml                # SLR hyper-parameters
│   ├── SLT.yaml                # SLT hyper-parameters
│   ├── CSL-Daily.yaml          # CSL-Daily paths / tokenizers / mBART config
│   └── phoenix2014-T.yaml      # Phoenix-2014T paths / tokenizers / mBART config
├── modules/
│   ├── SkeletonNet.py          # CESMM backbone
│   ├── BiLSTM.py               # Temporal model
│   ├── slr_network.py          # SLRModel + CTC / distillation losses
│   ├── slt_network.py          # SLTModel + mBART translation network
│   └── criterions.py           # SeqKD / XentLoss
├── utils/                      # Tokenizers, decoding, metrics, optimizer, logging
├── data/<dataset>/             # Normalized keypoint pickles
├── preprocess/<dataset>/       # Per-sample metadata (.npy) and gloss vocabulary
├── pretrained_slr/<dataset>/   # Provided SLR checkpoints
├── pretrained_slt/             # Provided mBART / gloss-to-text assets
└── work_dirt/<dataset>/        # Provided SLT checkpoints and run outputs

2. Environment

Tested with Python 3.10, PyTorch 2.x, transformers 4.44.

Required Python packages:

pip install torch torchvision numpy pyyaml tqdm transformers==4.44.0 portalocker wandb tensorboard
  • ctcdecode is required even for training, because the beam-search decoder is imported at module load time. Install it from parlance/ctcdecode.
  • wandb is imported by utils/misc.py on startup; install it even if you do not log to Weights & Biases.
  • tensorboard is needed by torch.utils.tensorboard in utils/misc.py.

CUDA note: CUDA_VISIBLE_DEVICES must be set before the process starts (before CUDA is initialized). --device is the index inside the visible set, so with CUDA_VISIBLE_DEVICES=1 you must pass --device 0.


3. Data and checkpoints

3.1 What must exist

The data shipped in this checkout is already prepared. For each dataset:

Path Content
data/<dataset>/<dataset>.train, .dev, .test Pickled dict keyed by sequence id (e.g. S000020_P0000_T00, dev/11August_...). Each value is a dict with name, text, gloss, num_frames, and keypoint of shape (T, 75, 3), float32.
preprocess/<dataset>/train_info.npy, dev_info.npy, test_info.npy np.save of a dict mapping sample index → {'fileid', 'folder', 'signer', 'label', 'num_frames', 'text'}. folder is used to look the sample up in the pickle: os.path.dirname(folder).
preprocess/<dataset>/gloss2ids.pkl dict mapping gloss token → integer id. Must contain <pad>, <unk>, <s>, </s>.
configs/<dataset>.yaml Dataset-specific paths, gloss vocabulary, tokenizers, mBART settings, generation settings.

Split sizes in this checkout:

Dataset Train Dev Test Gloss classes
CSL-Daily 18,401 1,077 1,176 2,004
Phoenix-2014T 7,096 519 642 1,116

data/<dataset>/normalize.py produces the normalized pickles from the raw files in data/<dataset>/before/. Both scripts contain hard-coded absolute paths (/home/hhx22/CSLR/SLRTBack/...) that must be edited before re-running them. The Phoenix script as shipped only processes the test split, so extend it to dev / train if you need to regenerate them.

data/<dataset>/preprocess.py writes SLP-format text files under data/<dataset>/slp/ and also contains a hard-coded absolute path; it is not needed for SLR/SLT training.

3.2 Provided weights

Path Purpose
pretrained_slr/CSL-Daily/best_model.pt SLR checkpoint for CSL-Daily
pretrained_slr/phoenix2014-T/best_model.pt SLR checkpoint for Phoenix-2014T
pretrained_slt/mBart_zh/ mBART tokenizer / config / gloss embeddings for CSL-Daily
pretrained_slt/mBart_de/ mBART tokenizer / config / gloss embeddings for Phoenix-2014T
pretrained_slt/CSL-Daily_g2t/step_1000.ckpt Gloss-to-text initialization for CSL-Daily SLT
pretrained_slt/phoenix-2014T_g2t/best.ckpt Gloss-to-text initialization for Phoenix-2014T SLT
work_dirt/CSL-Daily/best_model.pt Trained SLT checkpoint for CSL-Daily
work_dirt/phoenix2014-T/best_model.pt Trained SLT checkpoint for Phoenix-2014T

4. SLR: training and inference

4.1 Train

The default configs/SLR.yaml trains CSL-Daily with Adam (lr 1e-3, cosine decay), batch size 16, 40 epochs, and loss weights SeqCTC=1.0, ConvCTC=1.0, Dist=25.0.

CUDA_VISIBLE_DEVICES=0 python SLR.py --config ./configs/SLR.yaml --dataset CSL-Daily --work-dir ./work_dir --device 0

Phoenix-2014T:

CUDA_VISIBLE_DEVICES=0 python SLR.py --config ./configs/SLR.yaml --dataset phoenix2014-T --work-dir ./work_dir --device 0

Notes:

  • The run directory is always <work-dir>/<dataset> (e.g. ./work_dir/CSL-Daily).
  • After every epoch the trainer evaluates on dev and test, saves checkpoint.pt (weights + optimizer + scheduler + RNG), and saves best_model.pt (weights only) when dev WER + test WER is the lowest so far.
  • Command-line arguments override values in the YAML file.

4.2 Resume training

CUDA_VISIBLE_DEVICES=0 python SLR.py --config ./configs/SLR.yaml --dataset CSL-Daily --work-dir ./work_dir --device 0 --load-checkpoints ./work_dir/CSL-Daily/checkpoint.pt

The resumed run starts at checkpoint_epoch + 1 and restores the optimizer, scheduler, and RNG state.

4.3 Inference / evaluation

--phase test runs on dev and test and writes per-sample predictions.

CUDA_VISIBLE_DEVICES=0 python SLR.py --config ./configs/SLR.yaml --dataset CSL-Daily --phase test --load-weights ./pretrained_slr/CSL-Daily/best_model.pt --work-dir ./work_dir/slr_eval --device 0

Phoenix-2014T:

CUDA_VISIBLE_DEVICES=0 python SLR.py --config ./configs/SLR.yaml --dataset phoenix2014-T --phase test --load-weights ./pretrained_slr/phoenix2014-T/best_model.pt --work-dir ./work_dir/slr_eval --device 0

Always pass --load-weights (or --load-checkpoints) for evaluation. If neither is given, the script only prints Please appoint --weights. and proceeds to evaluate a randomly initialized model.

Do not point --work-dir at ./pretrained_slr/ when evaluating, because the run directory also receives log.txt, dev.txt, test.txt, *_visual.txt, and config.yaml and would overwrite the bundled records. Use a separate directory such as ./work_dir/slr_eval.

4.4 Outputs

<work-dir>/<dataset>/:

File Content
config.yaml Fully resolved arguments for the run
log.txt Training log: per-epoch loss, WER, timings, best epoch
dev.txt, test.txt Per-epoch WER with insertion / deletion rates
checkpoint.pt Last epoch, resumable
best_model.pt Best weights only
dev_visual.txt, test_visual.txt Only written during --phase test: reference gloss, CNN-branch prediction, LSTM-branch prediction per sample

4.5 Metrics

utils/metrics.wer_list reports WER plus insertion (ins) and deletion (del) rates. Two branches are decoded — the convolutional head (ConvCTC) and the BiLSTM head (SeqCTC) — and the better WER is reported in log.txt.

Reference numbers from the bundled checkpoints:

Dataset Dev WER Test WER
CSL-Daily 32.52% 31.59%
Phoenix-2014T 23.19% 22.99%

The bundled log.txt records wall-clock times of roughly 4h18m (CSL-Daily, 40 epochs) and 2h39m (Phoenix-2014T) on a single GPU.


5. SLT: training and inference

SLT is built on top of SLR. Before training SLT, make sure the SLR weights referenced by pretrained_path in configs/<dataset>.yaml exist:

  • CSL-Daily: pretrained_slr/CSL-Daily/best_model.pt
  • Phoenix-2014T: pretrained_slr/phoenix2014-T/best_model.pt

The SLT trainer freezes nothing: the recognition network, the MLP mapping, and mBART are all optimized, with a separate learning rate per module.

5.1 Train

CUDA_VISIBLE_DEVICES=0 python SLT.py --config ./configs/SLT.yaml --dataset CSL-Daily --work-dir ./work_dir --device 0

Phoenix-2014T:

CUDA_VISIBLE_DEVICES=0 python SLT.py --config ./configs/SLT.yaml --dataset phoenix2014-T --work-dir ./work_dir --device 0

Notes:

  • The effective number of epochs is optimizer_args.num_epoch (40 in configs/SLT.yaml); the top-level num_epoch key is only a fallback and is ignored when optimizer_args.num_epoch is present.
  • Per-module learning rates come from optimizer_args.learning_rate: any child module whose name contains a key (e.g. mapping, translation) gets that rate; everything else uses base_lr.
  • Initialization: the recognition network is loaded from dataset_info.pretrained_path; mBART is loaded from TranslationNetwork.pretrained_model_name_or_path; a gloss-to-text checkpoint is loaded from TranslationNetwork.load_ckpt.
  • A model is saved as best_model.pt when the sum BLEU-1 + BLEU-2 + BLEU-3 + BLEU-4 + ROUGE on dev improves. Dev is evaluated after every epoch; the test split is only evaluated in --phase test.

5.2 Resume training

CUDA_VISIBLE_DEVICES=0 python SLT.py --config ./configs/SLT.yaml --dataset CSL-Daily --work-dir ./work_dir --device 0 --load-checkpoints ./work_dir/CSL-Daily/checkpoint.pt

5.3 Inference / evaluation

CUDA_VISIBLE_DEVICES=0 python SLT.py --config ./configs/SLT.yaml --dataset CSL-Daily --phase test --load-weights ./work_dirt/CSL-Daily/best_model.pt --work-dir ./work_dir/slt_eval --device 0

Phoenix-2014T:

CUDA_VISIBLE_DEVICES=0 python SLT.py --config ./configs/SLT.yaml --dataset phoenix2014-T --phase test --load-weights ./work_dirt/phoenix2014-T/best_model.pt --work-dir ./work_dir/slt_eval --device 0

--load-weights is mandatory. In --phase test the model is not initialized from the SLR / mBART / gloss-to-text checkpoints; all parameters come from the SLT checkpoint you pass. As with SLR, use a fresh --work-dir so the bundled logs in work_dirt/ are preserved.

Generation settings are read from the dataset config:

Dataset num_beams max_length length_penalty
CSL-Daily 4 60 1
Phoenix-2014T 5 100 1

For CSL-Daily (level: char), half-width , and ? in predictions are mapped to full-width , and ? before scoring.

5.4 Outputs

Same layout as SLR: <work-dir>/<dataset>/config.yaml, log.txt, dev.txt, test.txt, checkpoint.pt, best_model.pt, and — during --phase test — dev_visual.txt / test_visual.txt with gloss and text predictions per sample.

5.5 Metrics

log.txt reports, for dev and test: gloss WER (best of the CNN / LSTM branches), BLEU-1 … BLEU-4, and ROUGE.

Reference numbers from the bundled checkpoints:

Dataset Split WER BLEU-1 BLEU-2 BLEU-3 BLEU-4 ROUGE
CSL-Daily Dev 32.25 40.92 28.55 20.85 15.78 39.87
CSL-Daily Test 31.52 41.14 28.64 20.96 15.99 40.09
Phoenix-2014T Dev 23.51 49.99 36.63 28.42 22.81 48.59
Phoenix-2014T Test 23.27 50.18 37.01 28.90 23.59 48.94

The bundled logs record roughly 5h52m (CSL-Daily) and 1h55m (Phoenix-2014T) of SLT training on a single GPU.


6. Configuration reference

6.1 configs/SLR.yaml and configs/SLT.yaml

Key Meaning
phase train or test
dataset CSL-Daily or phoenix2014-T; also selects configs/<dataset>.yaml
work_dir Base output directory; <dataset> is appended automatically
input_type SLR only: keypoint, bone, keypoint_motion, bone_motion
batch_size / test_batch_size Train / eval batch size
num_worker DataLoader workers
device GPU index within CUDA_VISIBLE_DEVICES
random_fix / random_seed Reproducibility
loss_weights SLR loss terms: SeqCTC, ConvCTC, Dist
load_weights Weights-only initialization (string path or False)
load_checkpoints Resumable checkpoint (string path or False)
optimizer_args Optimizer (Adam / SGD), learning_rate, scheduler (consine = cosine annealing, otherwise multi-step), weight_decay, num_epoch, start_epoch
decode_mode beam (CTC beam search)
model_args.weight_norm Use the normalized linear classifier

SLT-specific: optimizer_args.learning_rate is a mapping. base_lr applies to any module not matched by another key; mapping and translation set the MLP and mBART rates.

6.2 configs/<dataset>.yaml

Key Meaning
keypoint Keypoint pickle base path (.train / .dev / .test are appended)
pretrained_path SLR checkpoint used to initialize SLT training
level char (CSL-Daily) or word (Phoenix-2014T)
gloss.gloss2id_file Gloss vocabulary for the CTC classifier
TranslationNetwork.TextTokenizer mBART tokenizer directory and target language
TranslationNetwork.GlossTokenizer Gloss-to-text source language and vocabulary
TranslationNetwork.GlossEmbedding Pre-computed gloss embeddings and whether to freeze them
TranslationNetwork.load_ckpt Gloss-to-text checkpoint
TranslationNetwork.pretrained_model_name_or_path mBART model directory
TranslationNetwork.overwrite_cfg Dropout overrides applied to the mBART config
TranslationNetwork.label_smoothing Cross-entropy label smoothing
translation Beam-search settings: num_beams, max_length, length_penalty

7. Data pipeline notes

  • Keypoints are stored as (T, 75, 3) and transposed to (3, T, 75) by the feeder. The 75 joints are split into face (6–32), left hand (0, 2, 4, 33–53), and right hand (1, 3, 5, 54–74) by the CESMM backbone.
  • Training samples are randomly resampled to between 0.5× and 1.5× their original length, capped at clip_len = 300; the valid length is rounded down to a multiple of 4 to match the backbone's temporal strides.
  • Evaluation samples use a center crop to 300 frames when longer, otherwise the full sequence.
  • Frames are padded by repeating the last frame. Lengths are halved twice (ceil division) to match the two temporal stride-2 stages in the backbone.
Downloads last month
65