-
Notifications
You must be signed in to change notification settings - Fork 15
/
finetune-ocrb.sh
77 lines (62 loc) · 2.09 KB
/
finetune-ocrb.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
rm -rf ./ocrb_eval
~/tesseract/src/training/tesstrain.sh \
--fonts_dir ~/.fonts \
--lang eng --linedata_only \
--noextract_font_properties \
--langdata_dir ~/langdata \
--tessdata_dir ~/tessdata_best \
--exposures "0" \
--save_box_tiff \
--fontlist "OCRB" "OCR B MT" "OCR-B 10 BT" \
--training_text ./eng.MRZ.eval.training_text \
--workspace_dir ~/tmp \
--output_dir ./ocrb_eval
rm -rf ./ocrb
~/tesseract/src/training/tesstrain.sh \
--fonts_dir ~/.fonts \
--lang eng --linedata_only \
--noextract_font_properties \
--langdata_dir ~/langdata \
--tessdata_dir ~/tessdata_best \
--exposures "0" \
--save_box_tiff \
--fontlist "OCRB" "OCR B MT" "OCR-B 10 BT" \
--training_text ./eng.MRZ.training_text \
--workspace_dir ~/tmp \
--output_dir ./ocrb
echo "/n ****** Finetune plus tessdata_best/eng model ***********"
rm -rf ./ocrb_plus
mkdir ./ocrb_plus
combine_tessdata -e ~/tessdata_best/eng.traineddata \
~/tessdata_best/eng.lstm
lstmtraining \
--model_output ./ocrb_plus/ocrb_plus \
--traineddata ./ocrb/eng/eng.traineddata \
--continue_from ~/tessdata_best/eng.lstm \
--old_traineddata ~/tessdata_best/eng.traineddata \
--train_listfile ./ocrb/eng.training_files.txt \
--debug_interval 0 \
--max_iterations 800
lstmtraining \
--stop_training \
--traineddata ./ocrb/eng/eng.traineddata \
--continue_from ./ocrb_plus/ocrb_plus_checkpoint \
--model_output ./ocrb_plus/ocrb.traineddata
cp ./ocrb_plus/ocrb.traineddata ./
time lstmeval \
--model ./ocrb_plus/ocrb.traineddata \
--eval_listfile ./ocrb_eval/eng.training_files.txt
lstmtraining \
--stop_training \
--convert_to_int \
--traineddata ./ocrb/eng/eng.traineddata \
--continue_from ./ocrb_plus/ocrb_plus_checkpoint \
--model_output ./ocrb_plus/ocrb_int.traineddata
time lstmeval \
--model ./ocrb_plus/ocrb_int.traineddata \
--eval_listfile ./ocrb_eval/eng.training_files.txt
cp ./ocrb_plus/ocrb_int.traineddata ./
time lstmeval \
--model ~/tessdata_best/eng.traineddata \
--eval_listfile ./ocrb_eval/eng.training_files.txt