turkic-ocr-code / scripts /r5_linedet /ref_val_figs.sh
treoa's picture
Release 1
24aaa76
Raw History Blame Contribute Delete
1.65 kB
#!/bin/bash
# Validation-only figures of the replication split (clarification H12): R2(ii) predictions on kohtd_rand_val (the 15 % validation part of the replication split) with the
# final-epoch weights (model/latest: the compressed 3-epoch run never reached the 2000-iteration evaluation, so PaddleOCR saved no best_accuracy), then the paper metrics for
# R1(ii) (existing predictions) and R2(ii). Runs as a small step inside job 52050 (srun --jobid=52050 --overlap). No locked set is read.
CODE=/path/to/TURKIC_OCR_CODE
D=/path/to/TURKIC_OCR_DATA
unset HF_TOKEN HUGGING_FACE_HUB_TOKEN
S=$CODE/scripts/r5_ref
MAN=$D/data/processed/r5/manifests
mkdir -p $D/outputs/r5/ref/metrics
export FLAGS_allocator_strategy=auto_growth OMP_NUM_THREADS=2 MKL_NUM_THREADS=2 OPENBLAS_NUM_THREADS=2 TF_CPP_MIN_LOG_LEVEL=2
echo "=== R2(ii) predictions on kohtd_rand_val $(date -u)"
$CODE/.venv_ref_paddle/bin/python -I $S/ref_ppocr_predict.py --run ii --sets kohtd_rand_val=$MAN/kohtd_rand_val.tsv --train_dir $D/checkpoints/r5/ref/R2_ii --weights $D/checkpoints/r5/ref/R2_ii/model/latest --threads 2
RC=$?
if [ $RC -eq 3 ]; then
echo "no GPU in this step; CPU run"
$CODE/.venv_ref_paddle/bin/python -I $S/ref_ppocr_predict.py --run ii --sets kohtd_rand_val=$MAN/kohtd_rand_val.tsv --train_dir $D/checkpoints/r5/ref/R2_ii --weights $D/checkpoints/r5/ref/R2_ii/model/latest --threads 2 --cpu
fi
for R in R1 R2; do
echo "=== metrics $R(ii) $(date -u)"
$CODE/.venv_ref_tf/bin/python -I $S/ref_paper_metrics.py $D/outputs/r5/preds/$R/rand/kohtd_rand_val.tsv $D/outputs/r5/ref/metrics/${R}_rand_kohtd_rand_val.json | head -60
done
echo "=== done $(date -u)"