Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify and document procedure to process text #4

Open
mikegerber opened this issue Jan 11, 2022 · 3 comments
Open

Verify and document procedure to process text #4

mikegerber opened this issue Jan 11, 2022 · 3 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@mikegerber
Copy link
Member

This seems to work:

OUT_DIR=.
apply-sliding-window \                                                                                                                                       
  test-ocr.txt \                                                                                                                                             
  test-ocr.json                                                                                                                                              
                                                                                                                                                             
run-two-step-pipeline-on-single-page \                                                                                                                       
  test-ocr.json \                                                                                                                                            
  ~/devel/qurator-data/sbb_ocr_postcorrection/data_models_final_121121/models/trained_detector_model_512_3L_LSTM_bidirec_070920_138.pt \                     
  ~/devel/qurator-data/sbb_ocr_postcorrection/data_models_final_121121/models/trained_translator_model_256_1L_LSTM_monodirec_100920_876.pt \                 
  ~/devel/qurator-data/sbb_ocr_postcorrection/data_models_final_121121/hyper_params/hyper_params_detector.json \                                             
  ~/devel/qurator-data/sbb_ocr_postcorrection/data_models_final_121121/hyper_params/hyper_params_translator.json \                                           
  ~/devel/qurator-data/sbb_ocr_postcorrection/data_models_final_121121/code_to_token/code_to_token_mapping_detector_150620.json \                            
  ~/devel/qurator-data/sbb_ocr_postcorrection/data_models_final_121121/code_to_token/code_to_token_mapping_translator_080920.json \                          
  $OUT_DIR 
@mikegerber mikegerber added the documentation Improvements or additions to documentation label Jan 11, 2022
@mikegerber mikegerber self-assigned this Jan 11, 2022
@mikegerber
Copy link
Member Author

I was testing with a dummy Lorem Ipsum text and didn't notice that this produces 3x the output text due to the sliding window processing.

→ Back to figuring out how to preprocess text into the JSON format

@mikegerber
Copy link
Member Author

With the newest changes, this works:

#!/bin/sh
OUT_DIR=.

create-ocr-json-of-single-page \
  test-ocr.txt \
  test-ocr.json

run-two-step-pipeline-on-single-page \
  test-ocr.json \
  ~/devel/qurator-data/sbb_ocr_postcorrection/data_models_final_121121/models/trained_detector_model_512_3L_LSTM_bidirec_070920_138.pt \
  ~/devel/qurator-data/sbb_ocr_postcorrection/data_models_final_121121/models/trained_translator_model_256_1L_LSTM_monodirec_100920_876.pt \
  ~/devel/qurator-data/sbb_ocr_postcorrection/data_models_final_121121/hyper_params/hyper_params_detector.json \
  ~/devel/qurator-data/sbb_ocr_postcorrection/data_models_final_121121/hyper_params/hyper_params_translator.json \
  ~/devel/qurator-data/sbb_ocr_postcorrection/data_models_final_121121/code_to_token/code_to_token_mapping_detector_150620.json \
  ~/devel/qurator-data/sbb_ocr_postcorrection/data_models_final_121121/code_to_token/code_to_token_mapping_translator_080920.json \
  $OUT_DIR

@mikegerber
Copy link
Member Author

With additional reconstructing of the original line boundaries:

#!/bin/sh
set -ex

OUT_DIR=.

create-ocr-json-of-single-page \
  actevedef_718448162_00000024.txt \
  actevedef_718448162_00000024.txt.json

run-two-step-pipeline-on-single-page \
  actevedef_718448162_00000024.txt.json \
  ~/devel/qurator-data/sbb_ocr_postcorrection/data_models_final_121121/models/trained_detector_model_512_3L_LSTM_bidirec_070920_138.pt \
  ~/devel/qurator-data/sbb_ocr_postcorrection/data_models_final_121121/models/trained_translator_model_256_1L_LSTM_monodirec_100920_876.pt \
  ~/devel/qurator-data/sbb_ocr_postcorrection/data_models_final_121121/hyper_params/hyper_params_detector.json \
  ~/devel/qurator-data/sbb_ocr_postcorrection/data_models_final_121121/hyper_params/hyper_params_translator.json \
  ~/devel/qurator-data/sbb_ocr_postcorrection/data_models_final_121121/code_to_token/code_to_token_mapping_detector_150620.json \
  ~/devel/qurator-data/sbb_ocr_postcorrection/data_models_final_121121/code_to_token/code_to_token_mapping_translator_080920.json \
  $OUT_DIR

reconstruct-single-page-line-boundaries \
  corrected_page.txt \
  line_ids.json \
  corrected_page_reconst.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant