mirror of
https://github.com/DS4SD/docling.git
synced 2025-07-26 03:55:00 +00:00
* fix(ocr): tesseract support mis-oriented documents Signed-off-by: Clément Doumouro <clement.doumouro@gmail.com> * fix(ocr): update missing test data Signed-off-by: Clément Doumouro <clement.doumouro@gmail.com> * fix(ocr): rotate image to the natural orientation before layout prediction Signed-off-by: Clément Doumouro <clement.doumouro@gmail.com> * fix(ocr): move bounding bow rotation util to orientation.py Signed-off-by: Clément Doumouro <clement.doumouro@gmail.com> * fix(ocr): refactor rotation utilities Signed-off-by: Clément Doumouro <clement.doumouro@gmail.com> * chore(ocr): revert layout updates Signed-off-by: Clément Doumouro <clement.doumouro@gmail.com> * chore(ocr): update e2e OCR test data Signed-off-by: Clément Doumouro <clement.doumouro@gmail.com> * fix(ocr): avoid to swallow tesseract errors causing orientation detection failures Signed-off-by: Clément Doumouro <clement.doumouro@gmail.com> * chore(ocr): revert layout updates Signed-off-by: Clément Doumouro <clement.doumouro@gmail.com> * chore(ocr): update e2e OCR test data * chore(ocr): proceed to OCR without rotation when OSD fails in `TesseractOcrCliModel` * chore(ocr): proceed to OCR without rotation when OSD fails in `TesseractOcrModel` * chore(ocr): default `TesseractOcrCliModel._is_auto` to `False` * fix(ocr): fix `TesseractOcrCliModel._is_auto` computation * chore(ocr): improve logging in case of OSD failure in `TesseractOcrCliModel` and `TesseractOcrModel` --------- Signed-off-by: Clément Doumouro <clement.doumouro@gmail.com>
388 lines
12 KiB
JSON
388 lines
12 KiB
JSON
[
|
|
{
|
|
"page_no": 0,
|
|
"size": {
|
|
"width": 595.201171875,
|
|
"height": 841.9216918945312
|
|
},
|
|
"cells": [
|
|
{
|
|
"index": 0,
|
|
"rgba": {
|
|
"r": 0,
|
|
"g": 0,
|
|
"b": 0,
|
|
"a": 255
|
|
},
|
|
"rect": {
|
|
"r_x0": 73.34702132031646,
|
|
"r_y0": 97.99999977896755,
|
|
"r_x1": 503.64955224479564,
|
|
"r_y1": 97.99999977896755,
|
|
"r_x2": 503.64955224479564,
|
|
"r_y2": 76.99999977896756,
|
|
"r_x3": 73.34702132031646,
|
|
"r_y3": 76.99999977896756,
|
|
"coord_origin": "TOPLEFT"
|
|
},
|
|
"text": "Docling bundles PDF document conversion to",
|
|
"orig": "Docling bundles PDF document conversion to",
|
|
"text_direction": "left_to_right",
|
|
"confidence": 1.0,
|
|
"from_ocr": true
|
|
},
|
|
{
|
|
"index": 1,
|
|
"rgba": {
|
|
"r": 0,
|
|
"g": 0,
|
|
"b": 0,
|
|
"a": 255
|
|
},
|
|
"rect": {
|
|
"r_x0": 70.90211866351085,
|
|
"r_y0": 124.83139551297342,
|
|
"r_x1": 504.8720079864275,
|
|
"r_y1": 124.83139551297342,
|
|
"r_x2": 504.8720079864275,
|
|
"r_y2": 102.66666671251768,
|
|
"r_x3": 70.90211866351085,
|
|
"r_y3": 102.66666671251768,
|
|
"coord_origin": "TOPLEFT"
|
|
},
|
|
"text": "JSON and Markdown in an easy self contained",
|
|
"orig": "JSON and Markdown in an easy self contained",
|
|
"text_direction": "left_to_right",
|
|
"confidence": 1.0,
|
|
"from_ocr": true
|
|
},
|
|
{
|
|
"index": 2,
|
|
"rgba": {
|
|
"r": 0,
|
|
"g": 0,
|
|
"b": 0,
|
|
"a": 255
|
|
},
|
|
"rect": {
|
|
"r_x0": 73.10852522817731,
|
|
"r_y0": 152.70503335218433,
|
|
"r_x1": 153.04479435252625,
|
|
"r_y1": 152.70503335218433,
|
|
"r_x2": 153.04479435252625,
|
|
"r_y2": 130.00136157890958,
|
|
"r_x3": 73.10852522817731,
|
|
"r_y3": 130.00136157890958,
|
|
"coord_origin": "TOPLEFT"
|
|
},
|
|
"text": "package",
|
|
"orig": "package",
|
|
"text_direction": "left_to_right",
|
|
"confidence": 1.0,
|
|
"from_ocr": true
|
|
}
|
|
],
|
|
"parsed_page": null,
|
|
"predictions": {
|
|
"layout": {
|
|
"clusters": [
|
|
{
|
|
"id": 0,
|
|
"label": "text",
|
|
"bbox": {
|
|
"l": 70.90211866351085,
|
|
"t": 76.99999977896756,
|
|
"r": 504.8720079864275,
|
|
"b": 152.70503335218433,
|
|
"coord_origin": "TOPLEFT"
|
|
},
|
|
"confidence": 0.9715733528137207,
|
|
"cells": [
|
|
{
|
|
"index": 0,
|
|
"rgba": {
|
|
"r": 0,
|
|
"g": 0,
|
|
"b": 0,
|
|
"a": 255
|
|
},
|
|
"rect": {
|
|
"r_x0": 73.34702132031646,
|
|
"r_y0": 97.99999977896755,
|
|
"r_x1": 503.64955224479564,
|
|
"r_y1": 97.99999977896755,
|
|
"r_x2": 503.64955224479564,
|
|
"r_y2": 76.99999977896756,
|
|
"r_x3": 73.34702132031646,
|
|
"r_y3": 76.99999977896756,
|
|
"coord_origin": "TOPLEFT"
|
|
},
|
|
"text": "Docling bundles PDF document conversion to",
|
|
"orig": "Docling bundles PDF document conversion to",
|
|
"text_direction": "left_to_right",
|
|
"confidence": 1.0,
|
|
"from_ocr": true
|
|
},
|
|
{
|
|
"index": 1,
|
|
"rgba": {
|
|
"r": 0,
|
|
"g": 0,
|
|
"b": 0,
|
|
"a": 255
|
|
},
|
|
"rect": {
|
|
"r_x0": 70.90211866351085,
|
|
"r_y0": 124.83139551297342,
|
|
"r_x1": 504.8720079864275,
|
|
"r_y1": 124.83139551297342,
|
|
"r_x2": 504.8720079864275,
|
|
"r_y2": 102.66666671251768,
|
|
"r_x3": 70.90211866351085,
|
|
"r_y3": 102.66666671251768,
|
|
"coord_origin": "TOPLEFT"
|
|
},
|
|
"text": "JSON and Markdown in an easy self contained",
|
|
"orig": "JSON and Markdown in an easy self contained",
|
|
"text_direction": "left_to_right",
|
|
"confidence": 1.0,
|
|
"from_ocr": true
|
|
},
|
|
{
|
|
"index": 2,
|
|
"rgba": {
|
|
"r": 0,
|
|
"g": 0,
|
|
"b": 0,
|
|
"a": 255
|
|
},
|
|
"rect": {
|
|
"r_x0": 73.10852522817731,
|
|
"r_y0": 152.70503335218433,
|
|
"r_x1": 153.04479435252625,
|
|
"r_y1": 152.70503335218433,
|
|
"r_x2": 153.04479435252625,
|
|
"r_y2": 130.00136157890958,
|
|
"r_x3": 73.10852522817731,
|
|
"r_y3": 130.00136157890958,
|
|
"coord_origin": "TOPLEFT"
|
|
},
|
|
"text": "package",
|
|
"orig": "package",
|
|
"text_direction": "left_to_right",
|
|
"confidence": 1.0,
|
|
"from_ocr": true
|
|
}
|
|
],
|
|
"children": []
|
|
}
|
|
]
|
|
},
|
|
"tablestructure": {
|
|
"table_map": {}
|
|
},
|
|
"figures_classification": null,
|
|
"equations_prediction": null,
|
|
"vlm_response": null
|
|
},
|
|
"assembled": {
|
|
"elements": [
|
|
{
|
|
"label": "text",
|
|
"id": 0,
|
|
"page_no": 0,
|
|
"cluster": {
|
|
"id": 0,
|
|
"label": "text",
|
|
"bbox": {
|
|
"l": 70.90211866351085,
|
|
"t": 76.99999977896756,
|
|
"r": 504.8720079864275,
|
|
"b": 152.70503335218433,
|
|
"coord_origin": "TOPLEFT"
|
|
},
|
|
"confidence": 0.9715733528137207,
|
|
"cells": [
|
|
{
|
|
"index": 0,
|
|
"rgba": {
|
|
"r": 0,
|
|
"g": 0,
|
|
"b": 0,
|
|
"a": 255
|
|
},
|
|
"rect": {
|
|
"r_x0": 73.34702132031646,
|
|
"r_y0": 97.99999977896755,
|
|
"r_x1": 503.64955224479564,
|
|
"r_y1": 97.99999977896755,
|
|
"r_x2": 503.64955224479564,
|
|
"r_y2": 76.99999977896756,
|
|
"r_x3": 73.34702132031646,
|
|
"r_y3": 76.99999977896756,
|
|
"coord_origin": "TOPLEFT"
|
|
},
|
|
"text": "Docling bundles PDF document conversion to",
|
|
"orig": "Docling bundles PDF document conversion to",
|
|
"text_direction": "left_to_right",
|
|
"confidence": 1.0,
|
|
"from_ocr": true
|
|
},
|
|
{
|
|
"index": 1,
|
|
"rgba": {
|
|
"r": 0,
|
|
"g": 0,
|
|
"b": 0,
|
|
"a": 255
|
|
},
|
|
"rect": {
|
|
"r_x0": 70.90211866351085,
|
|
"r_y0": 124.83139551297342,
|
|
"r_x1": 504.8720079864275,
|
|
"r_y1": 124.83139551297342,
|
|
"r_x2": 504.8720079864275,
|
|
"r_y2": 102.66666671251768,
|
|
"r_x3": 70.90211866351085,
|
|
"r_y3": 102.66666671251768,
|
|
"coord_origin": "TOPLEFT"
|
|
},
|
|
"text": "JSON and Markdown in an easy self contained",
|
|
"orig": "JSON and Markdown in an easy self contained",
|
|
"text_direction": "left_to_right",
|
|
"confidence": 1.0,
|
|
"from_ocr": true
|
|
},
|
|
{
|
|
"index": 2,
|
|
"rgba": {
|
|
"r": 0,
|
|
"g": 0,
|
|
"b": 0,
|
|
"a": 255
|
|
},
|
|
"rect": {
|
|
"r_x0": 73.10852522817731,
|
|
"r_y0": 152.70503335218433,
|
|
"r_x1": 153.04479435252625,
|
|
"r_y1": 152.70503335218433,
|
|
"r_x2": 153.04479435252625,
|
|
"r_y2": 130.00136157890958,
|
|
"r_x3": 73.10852522817731,
|
|
"r_y3": 130.00136157890958,
|
|
"coord_origin": "TOPLEFT"
|
|
},
|
|
"text": "package",
|
|
"orig": "package",
|
|
"text_direction": "left_to_right",
|
|
"confidence": 1.0,
|
|
"from_ocr": true
|
|
}
|
|
],
|
|
"children": []
|
|
},
|
|
"text": "Docling bundles PDF document conversion to JSON and Markdown in an easy self contained package"
|
|
}
|
|
],
|
|
"body": [
|
|
{
|
|
"label": "text",
|
|
"id": 0,
|
|
"page_no": 0,
|
|
"cluster": {
|
|
"id": 0,
|
|
"label": "text",
|
|
"bbox": {
|
|
"l": 70.90211866351085,
|
|
"t": 76.99999977896756,
|
|
"r": 504.8720079864275,
|
|
"b": 152.70503335218433,
|
|
"coord_origin": "TOPLEFT"
|
|
},
|
|
"confidence": 0.9715733528137207,
|
|
"cells": [
|
|
{
|
|
"index": 0,
|
|
"rgba": {
|
|
"r": 0,
|
|
"g": 0,
|
|
"b": 0,
|
|
"a": 255
|
|
},
|
|
"rect": {
|
|
"r_x0": 73.34702132031646,
|
|
"r_y0": 97.99999977896755,
|
|
"r_x1": 503.64955224479564,
|
|
"r_y1": 97.99999977896755,
|
|
"r_x2": 503.64955224479564,
|
|
"r_y2": 76.99999977896756,
|
|
"r_x3": 73.34702132031646,
|
|
"r_y3": 76.99999977896756,
|
|
"coord_origin": "TOPLEFT"
|
|
},
|
|
"text": "Docling bundles PDF document conversion to",
|
|
"orig": "Docling bundles PDF document conversion to",
|
|
"text_direction": "left_to_right",
|
|
"confidence": 1.0,
|
|
"from_ocr": true
|
|
},
|
|
{
|
|
"index": 1,
|
|
"rgba": {
|
|
"r": 0,
|
|
"g": 0,
|
|
"b": 0,
|
|
"a": 255
|
|
},
|
|
"rect": {
|
|
"r_x0": 70.90211866351085,
|
|
"r_y0": 124.83139551297342,
|
|
"r_x1": 504.8720079864275,
|
|
"r_y1": 124.83139551297342,
|
|
"r_x2": 504.8720079864275,
|
|
"r_y2": 102.66666671251768,
|
|
"r_x3": 70.90211866351085,
|
|
"r_y3": 102.66666671251768,
|
|
"coord_origin": "TOPLEFT"
|
|
},
|
|
"text": "JSON and Markdown in an easy self contained",
|
|
"orig": "JSON and Markdown in an easy self contained",
|
|
"text_direction": "left_to_right",
|
|
"confidence": 1.0,
|
|
"from_ocr": true
|
|
},
|
|
{
|
|
"index": 2,
|
|
"rgba": {
|
|
"r": 0,
|
|
"g": 0,
|
|
"b": 0,
|
|
"a": 255
|
|
},
|
|
"rect": {
|
|
"r_x0": 73.10852522817731,
|
|
"r_y0": 152.70503335218433,
|
|
"r_x1": 153.04479435252625,
|
|
"r_y1": 152.70503335218433,
|
|
"r_x2": 153.04479435252625,
|
|
"r_y2": 130.00136157890958,
|
|
"r_x3": 73.10852522817731,
|
|
"r_y3": 130.00136157890958,
|
|
"coord_origin": "TOPLEFT"
|
|
},
|
|
"text": "package",
|
|
"orig": "package",
|
|
"text_direction": "left_to_right",
|
|
"confidence": 1.0,
|
|
"from_ocr": true
|
|
}
|
|
],
|
|
"children": []
|
|
},
|
|
"text": "Docling bundles PDF document conversion to JSON and Markdown in an easy self contained package"
|
|
}
|
|
],
|
|
"headers": []
|
|
}
|
|
}
|
|
] |