Skip to content

Commit

Permalink
[demo] Update demo & benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
felixdittrich92 committed Oct 22, 2024
1 parent 7f63662 commit 143111b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,15 +321,15 @@ Benchmarking performed on the FUNSD dataset and CORD dataset.

docTR / OnnxTR models used for the benchmarks are `fast_base` (full precision) | `db_resnet50` (8-bit variant) for detection and `crnn_vgg16_bn` for recognition.

The smallest combination in OnnxTR (docTR) of `db_mobilenet_v3_large` and `crnn_mobilenet_v3_small` takes as comparison `~0.17s / Page` on the FUNSD dataset and `~0.12s / Page` on the CORD dataset in **full precision**.
The smallest combination in OnnxTR (docTR) of `db_mobilenet_v3_large` and `crnn_mobilenet_v3_small` takes as comparison `~0.17s / Page` on the FUNSD dataset and `~0.12s / Page` on the CORD dataset in **full precision** on CPU.

- CPU benchmarks:

|Library |FUNSD (199 pages) |CORD (900 pages) |
|---------------------------------|-------------------------------|-------------------------------|
|docTR (CPU) - v0.8.1 | ~1.29s / Page | ~0.60s / Page |
|**OnnxTR (CPU)** - v0.4.1 | ~0.57s / Page | **~0.25s / Page** |
|**OnnxTR (CPU) 8-bit** - v0.4.1 | **~0.38s / Page** | **~0.14s / Page** |
|**OnnxTR (CPU)** - v0.5.1 | ~0.57s / Page | **~0.25s / Page** |
|**OnnxTR (CPU) 8-bit** - v0.5.1 | **~0.38s / Page** | **~0.14s / Page** |
|EasyOCR (CPU) - v1.7.1 | ~1.96s / Page | ~1.75s / Page |
|**PyTesseract (CPU)** - v0.3.10 | **~0.50s / Page** | ~0.52s / Page |
|Surya (line) (CPU) - v0.4.4 | ~48.76s / Page | ~35.49s / Page |
Expand All @@ -341,7 +341,8 @@ The smallest combination in OnnxTR (docTR) of `db_mobilenet_v3_large` and `crnn_
|-------------------------------------|-------------------------------|-------------------------------|
|docTR (GPU) - v0.8.1 | ~0.07s / Page | ~0.05s / Page |
|**docTR (GPU) float16** - v0.8.1 | **~0.06s / Page** | **~0.03s / Page** |
|OnnxTR (GPU) - v0.4.1 | **~0.06s / Page** | ~0.04s / Page |
|OnnxTR (GPU) - v0.5.1 | **~0.06s / Page** | ~0.04s / Page |
|**OnnxTR (GPU) float16 - v0.5.1** | **~0.05s / Page** | **~0.03s / Page** |
|EasyOCR (GPU) - v1.7.1 | ~0.31s / Page | ~0.19s / Page |
|Surya (GPU) float16 - v0.4.4 | ~3.70s / Page | ~2.81s / Page |
|**PaddleOCR (GPU) - no cls - v2.7.3**| ~0.08s / Page | **~0.03s / Page** |
Expand Down
12 changes: 6 additions & 6 deletions demo/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def analyze_page(
)
with gr.Row():
with gr.Column(scale=1):
upload = gr.File(label="Upload File [JPG | PNG | PDF]", file_types=["pdf", "jpg", "png"])
upload = gr.File(label="Upload File [JPG | PNG | PDF]", file_types=[".pdf", ".jpg", ".png"])
page_selection = gr.Slider(minimum=1, maximum=10, step=1, value=1, label="Page selection")
det_model = gr.Dropdown(choices=DET_ARCHS, value=DET_ARCHS[0], label="Text detection model")
reco_model = gr.Dropdown(
Expand All @@ -260,14 +260,14 @@ def analyze_page(
analyze_button = gr.Button("Analyze page")
with gr.Column(scale=3):
with gr.Row():
input_image = gr.Image(label="Input page", width=600)
segmentation_heatmap = gr.Image(label="Segmentation heatmap", width=600)
output_image = gr.Image(label="Output page", width=600)
input_image = gr.Image(label="Input page", width=700, height=500)
segmentation_heatmap = gr.Image(label="Segmentation heatmap", width=700, height=500)
output_image = gr.Image(label="Output page", width=700, height=500)
with gr.Row():
with gr.Column(scale=3):
ocr_output = gr.JSON(label="OCR output", render=True, scale=1)
ocr_output = gr.JSON(label="OCR output", render=True, scale=1, height=500)
with gr.Column(scale=3):
synthesized_page = gr.Image(label="Synthesized page", width=600)
synthesized_page = gr.Image(label="Synthesized page", width=700, height=500)

analyze_button.click(
analyze_page,
Expand Down

0 comments on commit 143111b

Please sign in to comment.