| 186 | |
| 187 | |
| 188 | def parse_args(): |
| 189 | import argparse |
| 190 | |
| 191 | parser = argparse.ArgumentParser( |
| 192 | description="DocTR end-to-end evaluation", formatter_class=argparse.ArgumentDefaultsHelpFormatter |
| 193 | ) |
| 194 | |
| 195 | parser.add_argument("detection", type=str, help="Text detection model to use for analysis") |
| 196 | parser.add_argument("recognition", type=str, help="Text recognition model to use for analysis") |
| 197 | parser.add_argument("--iou", type=float, default=0.5, help="IoU threshold to match a pair of boxes") |
| 198 | parser.add_argument("--dataset", type=str, default="FUNSD", help="choose a dataset: FUNSD, CORD") |
| 199 | parser.add_argument("--img_folder", type=str, default=None, help="Only for local sets, path to images") |
| 200 | parser.add_argument("--label_file", type=str, default=None, help="Only for local sets, path to labels") |
| 201 | parser.add_argument("--rotation", dest="rotation", action="store_true", help="run rotated OCR + postprocessing") |
| 202 | parser.add_argument("-b", "--batch_size", type=int, default=32, help="batch size for recognition") |
| 203 | parser.add_argument("--size", type=int, default=1024, help="model input size, H = W") |
| 204 | parser.add_argument("--keep_ratio", action="store_true", help="keep the aspect ratio of the input image") |
| 205 | parser.add_argument("--symmetric_pad", action="store_true", help="pad the image symmetrically") |
| 206 | parser.add_argument("--samples", type=int, default=None, help="evaluate only on the N first samples") |
| 207 | parser.add_argument( |
| 208 | "--eval-straight", |
| 209 | action="store_true", |
| 210 | help="evaluate on straight pages with straight bbox (to use the quick and light metric)", |
| 211 | ) |
| 212 | args = parser.parse_args() |
| 213 | |
| 214 | return args |
| 215 | |
| 216 | |
| 217 | if __name__ == "__main__": |