$ docker start t4cmp
$ docker exec -it t4cmp bash
# cd /home/workspace/tesseract
# TESSDATA_PREFIX=/root/tesstutorial/tesseract/tessdata
# vi src/training/tesstrain_util.sh
尋找 phase_E_extract_features()
在 run_command tesseract ${img_file} ${img_file%.*} 後面加入 --psm 7
在 ${box_config} ${config} & 去除 &
移除 jobs="$jobs $!" 和 wait $jobs
# vi src/training/language-specific.sh
加入 你要增加的語言
src/training/tesstrain.sh --fonts_dir /usr/share/fonts --lang plate \
--linedata_only --my_boxtiff_dir /home/tmp --noextract_font_properties \
--langdata_dir ../langdata --tessdata_dir ~/tesstutorial/tesseract/tessdata \
--output_dir ~/tesstutorial/platetrain
lstmtraining --model_output ~/tesstutorial/impact_from_full/impact \
--continue_from ~/tesstutorial/impact_from_full/eng.lstm \
--traineddata ~/tesstutorial/tesseract/tessdata/eng.traineddata \
--train_listfile ~/tesstutorial/platetrain/plate.training_files.txt \
--max_iterations 400
lstmtraining --stop_training \
--continue_from ~/tesstutorial/impact_from_full/impact_0.031000_2_400.checkpoint \
--traineddata ~/tesstutorial/tesseract/tessdata/best/eng.traineddata \
--model_output ~/tesstutorial/impact_from_full/plate.traineddata
刪除無法訓練的圖
for i in `find /tmp/plate-2021-04-13.u4C -name "*.tif"`
do
LSTMF=${i//.tif/.lstmf}
if [ ! -f "$LSTMF" ]; then
LSTMF=`basename "$LSTMF"`
TIF=${LSTMF//.lstmf/.tif}
BOX=${LSTMF//.lstmf/.box}
rm /home/tmp/$TIF /home/tmp/$BOX
fi
done
沒有留言:
張貼留言