OpenPecha / OCR-Pipelines

1 stars 0 forks source link

Google OCR symbol duplication #8

Closed ngawangtrinley closed 1 year ago

ngawangtrinley commented 1 year ago

Describe the bug Google OCR duplicates some symbols in pages. We OCRed using 3 model configs as recommended by Forest and found that the handwrit language_hint (Config 2 and 3 below) duplicates symbols at random places.

Here's the config together with the json output for this image.

  1. Model Config 1
    model="builtin/weekly" & language_hints=[None]:
    input_path = Test/Input/I001
    output_opf_path = Test/Output/T001

    Json output: model_config_1_I1PD958780125.json

2 last lines without duplication:

གཟུང་དུ་མེད་པ་རྟོག་པ་མེད་པ། སྤྲོས་པ་མེད་པ། ཀུན་ནས་ཉོན་མོངས་པ་་\nམེད་པ། རང་རིག་པ་རང་གསལ་བ་ཙམ་དུ་ཡང་ གྲུབ་པ་ཡིན་ཏེ། དེ་ལྟར་ན་\n33-86
  1. Model Config 2
    model="builtin/weekly" & language_hints=["bo-t-i0-handwrit"]:
    input_path = Test/Input/I002
    output_opf_path = Test/Output/T002

    Json output: model_config_2_I1PD958780125.json

2 last lines with duplication of སྤྲོས་པ་མེད་པ།\n:

གཟུང་དུ་མེད་པ་རྟོག་པ་མེད་པ། སྤྲོས་པ་མེད་པ།\nསྤྲོས་པ་མེད་པ། ཀུན་ནས་ཉོན་མོངས་པ་་\nམེད་པ། རང་རིག་པ་རང་གསལ་བ་ཙམ་དུ་ཡང་ གྲུབ་པ་ཡིན་ཏེ། དེ་ལྟར་ན་\n33--86

Duplication in the symbols:

        {
            "description": "སྤྲོས་",
            "boundingPoly": {
                "vertices": [
                    {
                        "x": 590,
                        "y": 1643
                    },
                    {
                        "x": 652,
                        "y": 1643
                    },
                    {
                        "x": 652,
                        "y": 1712
                    },
                    {
                        "x": 590,
                        "y": 1712
                    }
                ],
                "normalizedVertices": []
            },
            "mid": "",
            "locale": "",
            "score": 0.0,
            "confidence": 0.0,
            "topicality": 0.0,
            "locations": [],
            "properties": []
        },
        {
            "description": "པ་",
            "boundingPoly": {
                "vertices": [
                    {
                        "x": 657,
                        "y": 1643
                    },
                    {
                        "x": 690,
                        "y": 1643
                    },
                    {
                        "x": 690,
                        "y": 1712
                    },
                    {
                        "x": 657,
                        "y": 1712
                    }
                ],
                "normalizedVertices": []
            },
            "mid": "",
            "locale": "",
            "score": 0.0,
            "confidence": 0.0,
            "topicality": 0.0,
            "locations": [],
            "properties": []
        },
        {
            "description": "མེད་",
            "boundingPoly": {
                "vertices": [
                    {
                        "x": 694,
                        "y": 1642
                    },
                    {
                        "x": 756,
                        "y": 1642
                    },
                    {
                        "x": 756,
                        "y": 1711
                    },
                    {
                        "x": 694,
                        "y": 1711
                    }
                ],
                "normalizedVertices": []
            },
            "mid": "",
            "locale": "",
            "score": 0.0,
            "confidence": 0.0,
            "topicality": 0.0,
            "locations": [],
            "properties": []
        },
        {
            "description": "པ",
            "boundingPoly": {
                "vertices": [
                    {
                        "x": 761,
                        "y": 1642
                    },
                    {
                        "x": 784,
                        "y": 1642
                    },
                    {
                        "x": 784,
                        "y": 1711
                    },
                    {
                        "x": 761,
                        "y": 1711
                    }
                ],
                "normalizedVertices": []
            },
            "mid": "",
            "locale": "",
            "score": 0.0,
            "confidence": 0.0,
            "topicality": 0.0,
            "locations": [],
            "properties": []
        },
        {
            "description": "།",
            "boundingPoly": {
                "vertices": [
                    {
                        "x": 790,
                        "y": 1642
                    },
                    {
                        "x": 794,
                        "y": 1642
                    },
                    {
                        "x": 794,
                        "y": 1711
                    },
                    {
                        "x": 790,
                        "y": 1711
                    }
                ],
                "normalizedVertices": []
            },
            "mid": "",
            "locale": "",
            "score": 0.0,
            "confidence": 0.0,
            "topicality": 0.0,
            "locations": [],
            "properties": []
        },
        {
            "description": "སྤྲོས་",
            "boundingPoly": {
                "vertices": [
                    {
                        "x": 590,
                        "y": 1648
                    },
                    {
                        "x": 654,
                        "y": 1647
                    },
                    {
                        "x": 655,
                        "y": 1714
                    },
                    {
                        "x": 591,
                        "y": 1715
                    }
                ],
                "normalizedVertices": []
            },
            "mid": "",
            "locale": "",
            "score": 0.0,
            "confidence": 0.0,
            "topicality": 0.0,
            "locations": [],
            "properties": []
        },
        {
            "description": "པ་",
            "boundingPoly": {
                "vertices": [
                    {
                        "x": 660,
                        "y": 1648
                    },
                    {
                        "x": 695,
                        "y": 1648
                    },
                    {
                        "x": 696,
                        "y": 1714
                    },
                    {
                        "x": 661,
                        "y": 1714
                    }
                ],
                "normalizedVertices": []
            },
            "mid": "",
            "locale": "",
            "score": 0.0,
            "confidence": 0.0,
            "topicality": 0.0,
            "locations": [],
            "properties": []
        },
        {
            "description": "མེད་",
            "boundingPoly": {
                "vertices": [
                    {
                        "x": 699,
                        "y": 1647
                    },
                    {
                        "x": 761,
                        "y": 1646
                    },
                    {
                        "x": 762,
                        "y": 1712
                    },
                    {
                        "x": 700,
                        "y": 1713
                    }
                ],
                "normalizedVertices": []
            },
            "mid": "",
            "locale": "",
            "score": 0.0,
            "confidence": 0.0,
            "topicality": 0.0,
            "locations": [],
            "properties": []
        },
        {
            "description": "པ",
            "boundingPoly": {
                "vertices": [
                    {
                        "x": 769,
                        "y": 1647
                    },
                    {
                        "x": 778,
                        "y": 1647
                    },
                    {
                        "x": 779,
                        "y": 1713
                    },
                    {
                        "x": 770,
                        "y": 1713
                    }
                ],
                "normalizedVertices": []
            },
            "mid": "",
            "locale": "",
            "score": 0.0,
            "confidence": 0.0,
            "topicality": 0.0,
            "locations": [],
            "properties": []
        },
        {
            "description": "།",
            "boundingPoly": {
                "vertices": [
                    {
                        "x": 777,
                        "y": 1647
                    },
                    {
                        "x": 783,
                        "y": 1647
                    },
                    {
                        "x": 784,
                        "y": 1713
                    },
                    {
                        "x": 778,
                        "y": 1713
                    }
                ],
                "normalizedVertices": []
            },
            "mid": "",
            "locale": "",
            "score": 0.0,
            "confidence": 0.0,
            "topicality": 0.0,
            "locations": [],
            "properties": []
        },
  1. Model Config 3
    model="builtin/weekly" & language_hints=["und-t-i0-handwrit"]:
    input_path = Test/Input/I003
    output_opf_path = Test/Output/T003

    Json output: model_config_3_I1PD958780125.json

2 last lines with duplication of སྤྲོས་པ་མེད་པ།:

གཟུང་དུ་མེད་པ་རྟོག་པ་མེད་པ། སྤྲོས་པ་མེད་པ།\nསྤྲོས་པ་མེད་པ། ཀུན་ནས་ཉོན་མོངས་པ་་\nམེད་པ། རང་རིག་པ་རང་གསལ་བ་ཙམ་དུ་ཡང་ གྲུབ་པ་ཡིན་ཏེ། དེ་ལྟར་ན་\n33-86

To Reproduce Steps to reproduce the behavior:

  1. OCR this image
  2. Check the json output for potential duplicated symbols

Screenshots Coming soon...

Additional context Add any other context about the problem here.

eroux commented 1 year ago

response from Google: in short it seems fixed in the latest version of the model

eroux commented 1 year ago

@10zinten could you run GV on just this image with

"language_hints": ["bo-t-i0-handwrit"]

and

"model": "builtin/weekly"

and post the resulting json here so that we can check if the issue is fixed on Google's end?

10zinten commented 1 year ago

@eroux here the result

I1PD958780125bo-t-i0-handwritbuiltin.weekly.json

eroux commented 1 year ago

thanks! Well, the duplication disappeared indeed... good news for the future OCRs!