unilm icon indicating copy to clipboard operation
unilm copied to clipboard

Inference script for DiT text detection

Open vlaurent17 opened this issue 1 year ago • 1 comments

I am using DiT for text detection and am having difficulty finding a way to perform inference on my documents. Has anyone successfully created an inference script for this model in this task? Valentin

vlaurent17 avatar Dec 20 '23 10:12 vlaurent17

I am using it in my project here BoxProcessorUlimDit

Example:


        from marie.boxes import BoxProcessorUlimDit
        from marie.boxes.box_processor import PSMode

        box = BoxProcessorUlimDit(
            models_dir="../../model_zoo/unilm/dit/text_detection",
            cuda=True,
        )
        (
            boxes,
            fragments,
            lines,
            _,
            lines_bboxes,
        ) = box.extract_bounding_boxes("gradio", "field", image, PSMode.SPARSE)

        bboxes_img = visualize_bboxes(image, boxes, format="xywh")
        lines_img = visualize_bboxes(image, lines_bboxes, format="xywh")

gregbugaj avatar Dec 22 '23 16:12 gregbugaj