Einstein Platform Services

Detect Text and Tables

Some images contain tabular data. To return the table data for each text element, specify the tabulatev2 model and a task parameter value of table.

Table Image

Table Image

The cURL call looks like this.

curl -X POST -H "Authorization: Bearer <TOKEN>" -F sampleContent="@/filepath/table.png" -F task="table" -F modelId="tabulatev2" https://api.einstein.ai/v2/vision/ocr

The response looks like this JSON.

{
  "task": "table",
  "probabilities": [
    {
      "probability": 0.9952141,
      "label": "City",
      "boundingBox": {
        "minX": 158,
        "minY": 50,
        "maxX": 214,
        "maxY": 82
      },
      "attributes": {
        "cellLocation": {
          "rowIndex": 1,
          "colIndex": 1
        },
        "pageNumber": "1"
      }
    },
    {
      "probability": 0.99889404,
      "label": "Number of Events",
      "boundingBox": {
        "minX": 405,
        "minY": 50,
        "maxX": 659,
        "maxY": 75
      },
      "attributes": {
        "cellLocation": {
          "rowIndex": 1,
          "colIndex": 2
        },
        "pageNumber": "1"
      }
    },
    {
      "probability": 0.9988783,
      "label": "Number of Stations",
      "boundingBox": {
        "minX": 773,
        "minY": 51,
        "maxX": 1048,
        "maxY": 75
      },
      "attributes": {
        "cellLocation": {
          "rowIndex": 1,
          "colIndex": 3
        },
        "pageNumber": "1"
      }
    },
    {
      "probability": 0.99629766,
      "label": "San Francisco",
      "boundingBox": {
        "minX": 91,
        "minY": 115,
        "maxX": 282,
        "maxY": 140
      },
      "attributes": {
        "cellLocation": {
          "rowIndex": 2,
          "colIndex": 1
        },
        "pageNumber": "1"
      }
    },
    {
      "probability": 0.9942451,
      "label": "100",
      "boundingBox": {
        "minX": 511,
        "minY": 116,
        "maxX": 557,
        "maxY": 140
      },
      "attributes": {
        "cellLocation": {
          "rowIndex": 2,
          "colIndex": 2
        },
        "pageNumber": "1"
      }
    },
    {
      "probability": 0.97811675,
      "label": "21",
      "boundingBox": {
        "minX": 894,
        "minY": 116,
        "maxX": 924,
        "maxY": 139
      },
      "attributes": {
        "cellLocation": {
          "rowIndex": 2,
          "colIndex": 3
        },
        "pageNumber": "1"
      }
    },
    {
      "probability": 0.9973557,
      "label": "San Diego",
      "boundingBox": {
        "minX": 117,
        "minY": 180,
        "maxX": 256,
        "maxY": 213
      },
      "attributes": {
        "cellLocation": {
          "rowIndex": 3,
          "colIndex": 1
        },
        "pageNumber": "1"
      }
    },
    {
      "probability": 0.99561936,
      "label": "123",
      "boundingBox": {
        "minX": 510,
        "minY": 182,
        "maxX": 558,
        "maxY": 206
      },
      "attributes": {
        "cellLocation": {
          "rowIndex": 3,
          "colIndex": 2
        },
        "pageNumber": "1"
      }
    },
    {
      "probability": 0.9816425,
      "label": "18",
      "boundingBox": {
        "minX": 896,
        "minY": 181,
        "maxX": 926,
        "maxY": 206
      },
      "attributes": {
        "cellLocation": {
          "rowIndex": 3,
          "colIndex": 3
        },
        "pageNumber": "1"
      }
    },
    {
      "probability": 0.9973557,
      "label": "San Jose",
      "boundingBox": {
        "minX": 125,
        "minY": 246,
        "maxX": 248,
        "maxY": 271
      },
      "attributes": {
        "cellLocation": {
          "rowIndex": 4,
          "colIndex": 1
        },
        "pageNumber": "1"
      }
    },
    {
      "probability": 0.9696964,
      "label": "53",
      "boundingBox": {
        "minX": 517,
        "minY": 247,
        "maxX": 549,
        "maxY": 270
      },
      "attributes": {
        "cellLocation": {
          "rowIndex": 4,
          "colIndex": 2
        },
        "pageNumber": "1"
      }
    },
    {
      "probability": 0.9926605,
      "label": "189",
      "boundingBox": {
        "minX": 888,
        "minY": 247,
        "maxX": 935,
        "maxY": 271
      },
      "attributes": {
        "cellLocation": {
          "rowIndex": 4,
          "colIndex": 3
        },
        "pageNumber": "1"
      }
    }
  ],
  "object": "predictresponse"
}

The above JSON describes Einstein's detection of the table elements, and is depicted below:

Table Image With OCR Data

Table Image With OCR Data

Multiple Tables on a Page

When an image contains more than one table, Einstein returns tabular data for each table in the image. The following image depicts how the tables and fields are denoted in the JSON. (The JSON is not provided). With this example, three tables are identified: One 3x2, one 2x5, and one 2x2. The values in the second row of the 2x2 table cells will be identified separately, resulting in a 2x6 JSON table definition.

Note: We currently support only the content confined within the individual tables. Free text in the image which lies outside of a table border is not processed.

Updated 7 days ago

Detect Text and Tables


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.