Skip to content

Commit

Permalink
Fix cli for cross_fold_train (#235)
Browse files Browse the repository at this point in the history
* Fix cli for cross_fold_train

* Migration: BIDI_NORMALIZER fixed

* Migration: BIDI_NORMALIZER fixed in 3to4
  • Loading branch information
andbue authored May 11, 2021
1 parent 4006ff0 commit 8f72bc3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions calamari_ocr/ocr/savedmodel/migrations/version2to4.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ def recurse_convert(p: dict):
elif t == 'STRIP_NORMALIZER':
flat.append(text_processor("StripTextProcessor"))
elif t == 'BIDI_NORMALIZER':
conv = [None, 'L', 'R']
flat.append(text_processor("BidiTextProcessor", args={'bidi_direction': conv[p.get('bidiDirection', 0)]}))
conv = {'BIDI_AUTO': None, 'BIDI_LTR': 'L', 'BIDI_RTL': 'R'}
flat.append(text_processor("BidiTextProcessor", args={'bidi_direction': conv[p.get('bidiDirection', 'BIDI_AUTO')]}))
elif t == 'TEXT_NORMALIZER':
conv = ['NFC', 'NFKC', 'NFD', 'NFKD']
flat.append(text_processor("TextNormalizer", args={'unicode_normalization': conv[p.get('unicodeNormalization', 0)]}))
Expand Down
1 change: 1 addition & 0 deletions calamari_ocr/ocr/savedmodel/migrations/version3to4.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def migrate3to4(trainer_params: dict) -> dict:
"FinalPreparation": "calamari_ocr.ocr.dataset.imageprocessors.final_preparation:FinalPreparationProcessorParams",
"AugmentationProcessor": "calamari_ocr.ocr.dataset.imageprocessors.augmentation:AugmentationProcessorParams",
"StripTextProcessor": "calamari_ocr.ocr.dataset.textprocessors.basic_text_processors:StripTextProcessorParams",
"BidiTextProcessor": "calamari_ocr.ocr.dataset.textprocessors.basic_text_processors:BidiTextProcessorParams",
"TextNormalizer": "calamari_ocr.ocr.dataset.textprocessors.text_normalizer:TextNormalizerProcessorParams",
"TextRegularizer": "calamari_ocr.ocr.dataset.textprocessors.text_regularizer:TextRegularizerProcessorParams",
"PrepareSampleProcessor": "calamari_ocr.ocr.dataset.imageprocessors.preparesample:PrepareSampleProcessorParams",
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
'calamari-predict=calamari_ocr.scripts.predict:main',
'calamari-resume-training=calamari_ocr.scripts.resume_training:main',
'calamari-train=calamari_ocr.scripts.train:run',
'calamari-cross-fold-train=calamari_ocr.scripts.cross_fold_train:main',
'calamari-cross-fold-train=calamari_ocr.scripts.cross_fold_train:run',
'calamari-predict-and-eval=calamari_ocr.scripts.predict_and_eval:run',
'calamari-dataset-viewer=calamari_ocr.scripts.dataset_viewer:main',
'calamari-dataset-statistics=calamari_ocr.scripts.dataset_statistics:main',
Expand Down

0 comments on commit 8f72bc3

Please sign in to comment.