The script uses various libraries such as pdf2image
, easyocr
, ditod
and detectron2
for processing.
Detected objects are categorized into "text", "title", "list", "table", and "figure".
The script provides detailed timing information for various processing steps, which can be useful for performance analysis.
Text extraction uses easyocr
and the results are further processed using SymSpell for word segmentation and a regular expression for filtering.
pip install -r requirements.txt
python -m pip install 'git+https://github.com/facebookresearch/detectron2.git'
apt-get install poppler-utils
- Please download the weight trained_ocr_cascade_large.pth first.
- Please set the weight path in
configs/cascade_dit_large.yaml
.
python pdf2txt.py --pdf_path path_to_pdf_file --outputs_dir path_to_output_dir
The output txt file will be stored in path_to_output_dir/txt