| 69 | |
| 70 | |
| 71 | def parse_args(): |
| 72 | parser = argparse.ArgumentParser( |
| 73 | description="DocTR text detection", |
| 74 | formatter_class=argparse.ArgumentDefaultsHelpFormatter, |
| 75 | ) |
| 76 | parser.add_argument("path", type=str, help="Path to process: PDF, image, directory") |
| 77 | parser.add_argument("--detection", type=str, default="fast_base", help="Text detection model to use for analysis") |
| 78 | parser.add_argument("--bin-thresh", type=float, default=0.3, help="Binarization threshold for the detection model.") |
| 79 | parser.add_argument("--box-thresh", type=float, default=0.1, help="Threshold for the detection boxes.") |
| 80 | parser.add_argument( |
| 81 | "--recognition", type=str, default="crnn_vgg16_bn", help="Text recognition model to use for analysis" |
| 82 | ) |
| 83 | parser.add_argument("-f", "--format", choices=["txt", "json", "xml"], default="txt", help="Output format") |
| 84 | return parser.parse_args() |
| 85 | |
| 86 | |
| 87 | if __name__ == "__main__": |