Skip to content

Commit c87ad57

Browse files
committed
move line-gt extraction out of ocr to eynollah-training
1 parent 5644fd9 commit c87ad57

File tree

4 files changed

+487
-416
lines changed

4 files changed

+487
-416
lines changed

src/eynollah/cli/cli_ocr.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,6 @@
5959
is_flag=True,
6060
help="if this parameter set to true, transformer ocr will be applied, otherwise cnn_rnn model.",
6161
)
62-
@click.option(
63-
"--export_textline_images_and_text",
64-
"-etit/-noetit",
65-
is_flag=True,
66-
help="if this parameter set to true, images and text in xml will be exported into output dir. This files can be used for training a OCR engine.",
67-
)
6862
@click.option(
6963
"--do_not_mask_with_textline_contour",
7064
"-nmtc/-mtc",
@@ -76,11 +70,6 @@
7670
"-bs",
7771
help="number of inference batch size. Default b_s for trocr and cnn_rnn models are 2 and 8 respectively",
7872
)
79-
@click.option(
80-
"--dataset_abbrevation",
81-
"-ds_pref",
82-
help="in the case of extracting textline and text from a xml GT file user can add an abbrevation of dataset name to generated dataset",
83-
)
8473
@click.option(
8574
"--min_conf_value_of_textline_text",
8675
"-min_conf",
@@ -97,7 +86,6 @@ def ocr_cli(
9786
dir_out_image_text,
9887
overwrite,
9988
tr_ocr,
100-
export_textline_images_and_text,
10189
do_not_mask_with_textline_contour,
10290
batch_size,
10391
dataset_abbrevation,
@@ -106,18 +94,11 @@ def ocr_cli(
10694
"""
10795
Recognize text with a CNN/RNN or transformer ML model.
10896
"""
109-
assert not export_textline_images_and_text or not tr_ocr, "Exporting textline and text -etit can not be set alongside transformer ocr -tr_ocr"
110-
# FIXME: refactor: move export_textline_images_and_text out of eynollah.py
111-
# assert not export_textline_images_and_text or not model, "Exporting textline and text -etit can not be set alongside model -m"
112-
assert not export_textline_images_and_text or not batch_size, "Exporting textline and text -etit can not be set alongside batch size -bs"
113-
assert not export_textline_images_and_text or not dir_in_bin, "Exporting textline and text -etit can not be set alongside directory of bin images -dib"
114-
assert not export_textline_images_and_text or not dir_out_image_text, "Exporting textline and text -etit can not be set alongside directory of images with predicted text -doit"
115-
assert bool(image) != bool(dir_in), "Either -i (single image) or -di (directory) must be provided, but not both."
97+
assert bool(image) ^ bool(dir_in), "Either -i (single image) or -di (directory) must be provided, but not both."
11698
from ..eynollah_ocr import Eynollah_ocr
11799
eynollah_ocr = Eynollah_ocr(
118100
model_zoo=ctx.obj.model_zoo,
119101
tr_ocr=tr_ocr,
120-
export_textline_images_and_text=export_textline_images_and_text,
121102
do_not_mask_with_textline_contour=do_not_mask_with_textline_contour,
122103
batch_size=batch_size,
123104
pref_of_dataset=dataset_abbrevation,

0 commit comments

Comments
 (0)