Use GT4HistOCR_2000000 model from qurator-data for Tesseract

pull/27/head
Gerber, Mike 5 years ago
parent 57ff3fc19b
commit bdab016e2c

@ -2,8 +2,10 @@ FROM ubuntu:18.04
ENV LC_ALL=C.UTF-8 LANG=C.UTF-8 ENV LC_ALL=C.UTF-8 LANG=C.UTF-8
RUN mkdir /var/lib/calamari-models ENV LEPTONICA_VERSION 1.78.0
COPY data/calamari-models/GT4HistOCR /var/lib/calamari-models/GT4HistOCR ENV TESSERACT_VERSION 4.1.0
ENV TESSDATA_BEST_VERSION 4.0.0
ENV TESSDATA_PREFIX /usr/local/share/tessdata
RUN apt-get update && \ RUN apt-get update && \
@ -24,12 +26,6 @@ RUN apt-get update && \
# Build Leptonica and Tesseract. # Build Leptonica and Tesseract.
# XXX Use a multi stage build for this. # XXX Use a multi stage build for this.
ENV LEPTONICA_VERSION 1.78.0
ENV TESSERACT_VERSION 4.1.0
ENV TESSDATA_BEST_VERSION 4.0.0
ENV TESSDATA_PREFIX /usr/local/share/tessdata
RUN curl -sSL -O https://github.com/DanBloomberg/leptonica/releases/download/$LEPTONICA_VERSION/leptonica-$LEPTONICA_VERSION.tar.gz && \ RUN curl -sSL -O https://github.com/DanBloomberg/leptonica/releases/download/$LEPTONICA_VERSION/leptonica-$LEPTONICA_VERSION.tar.gz && \
tar xvzf leptonica-$LEPTONICA_VERSION.tar.gz && \ tar xvzf leptonica-$LEPTONICA_VERSION.tar.gz && \
cd leptonica-$LEPTONICA_VERSION && \ cd leptonica-$LEPTONICA_VERSION && \
@ -45,9 +41,16 @@ RUN curl -sSL -O https://github.com/tesseract-ocr/tesseract/archive/$TESSERACT_V
RUN curl -sSL -O https://github.com/tesseract-ocr/tessdata_best/archive/$TESSDATA_BEST_VERSION.tar.gz && \ RUN curl -sSL -O https://github.com/tesseract-ocr/tessdata_best/archive/$TESSDATA_BEST_VERSION.tar.gz && \
tar xvzf $TESSDATA_BEST_VERSION.tar.gz && \ tar xvzf $TESSDATA_BEST_VERSION.tar.gz && \
mv tessdata_best-$TESSDATA_BEST_VERSION $TESSDATA_PREFIX && \ mv tessdata_best-$TESSDATA_BEST_VERSION $TESSDATA_PREFIX && \
rm -rf $TESSDATA_BEST_VERSION.tar.gz && \ rm -rf $TESSDATA_BEST_VERSION.tar.gz
tesseract --list-langs
# Copy OCR models
RUN mkdir /var/lib/calamari-models
COPY data/calamari-models/GT4HistOCR /var/lib/calamari-models/GT4HistOCR
RUN mkdir $TESSDATA_PREFIX
COPY data/tesseract-models/GT4HistOCR/GT4HistOCR_2000000.traineddata $TESSDATA_PREFIX
RUN tesseract --list-langs
COPY requirements.txt /tmp COPY requirements.txt /tmp

@ -3,8 +3,10 @@ set -e
( (
cd data cd data
git annex get calamari-models/GT4HistOCR git annex init
git annex unlock calamari-models/GT4HistOCR # So they are not symlinks git annex upgrade
git annex get calamari-models/GT4HistOCR/*.ckpt*
git annex get tesseract-models/GT4HistOCR/*.traineddata
) )
docker build -t my_ocrd_workflow . docker build -t my_ocrd_workflow .

@ -1 +1 @@
Subproject commit ca541f5ebb4593fde2aaef217bf606f7c2bf148a Subproject commit eb7412a1efbcba53567ec37237732e96e839dbe8

@ -79,7 +79,7 @@ do_linesegmentation() {
do_ocr() { do_ocr() {
# Perform OCR on the segmented lines # Perform OCR on the segmented lines
ocrd_tesserocr_recognize_parameters='{ "model": "frk" }' # TODO mods:language + fontident → model ocrd_tesserocr_recognize_parameters='{ "model": "GT4HistOCR_2000000" }' # TODO mods:language + fontident → model
remove_filegrp OCR-D-OCR-TESS mets.xml remove_filegrp OCR-D-OCR-TESS mets.xml
ocrd-tesserocr-recognize -l $LOG_LEVEL \ ocrd-tesserocr-recognize -l $LOG_LEVEL \
-m mets.xml -I OCR-D-SEG-LINE -O OCR-D-OCR-TESS \ -m mets.xml -I OCR-D-SEG-LINE -O OCR-D-OCR-TESS \

Loading…
Cancel
Save