Merge branch 'feat/update-calamari1' of https://github.com/OCR-D/ocrd_calamari into feat/update-calamari1

fix/readme-no-checkpoint
Gerber, Mike 4 years ago
commit 4eb4f97f6b

@ -72,13 +72,16 @@ class CalamariRecognize(Processor):
textlines = region.get_TextLine() textlines = region.get_TextLine()
log.info("About to recognize %i lines of region '%s'", len(textlines), region.id) log.info("About to recognize %i lines of region '%s'", len(textlines), region.id)
for (line_no, line) in enumerate(textlines):
log.debug("Recognizing line '%s' in region '%s'", line.id, region.id)
line_images_np = []
for (line_no, line) in enumerate(textlines):
line_image, line_coords = self.workspace.image_from_segment(line, region_image, region_xywh) line_image, line_coords = self.workspace.image_from_segment(line, region_image, region_xywh)
line_image_np = np.array(line_image, dtype=np.uint8) line_image_np = np.array(line_image, dtype=np.uint8)
line_images_np.append(line_image_np)
raw_results_all = self.predictor.predict_raw(line_images_np, progress_bar=False)
for line, raw_results in zip(textlines, raw_results_all):
raw_results = list(self.predictor.predict_raw([line_image_np], progress_bar=False))[0]
for i, p in enumerate(raw_results): for i, p in enumerate(raw_results):
p.prediction.id = "fold_{}".format(i) p.prediction.id = "fold_{}".format(i)

@ -12,7 +12,7 @@ from ocrd_calamari import CalamariRecognize
from .base import assets from .base import assets
METS_KANT = assets.url_of('kant_aufklaerung_1784-page-block-line-word_glyph/data/mets.xml') METS_KANT = assets.url_of('kant_aufklaerung_1784-page-region-line-word_glyph/data/mets.xml')
WORKSPACE_DIR = '/tmp/test-ocrd-calamari' WORKSPACE_DIR = '/tmp/test-ocrd-calamari'
CHECKPOINT = os.path.join(os.getcwd(), 'gt4histocr-calamari/*.ckpt.json') CHECKPOINT = os.path.join(os.getcwd(), 'gt4histocr-calamari/*.ckpt.json')

Loading…
Cancel
Save