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.

TableOriginal

The cURL call looks like this.

1curl -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.

1{
2    "task": "table",
3    "probabilities": [
4        {
5            "probability": 0.9952141,
6            "label": "City",
7            "boundingBox": {
8                "minX": 158,
9                "minY": 50,
10                "maxX": 214,
11                "maxY": 82
12            },
13            "attributes": {
14                "cellLocation": {
15                    "rowIndex": 1,
16                    "colIndex": 1
17                },
18                "pageNumber": "1"
19            }
20        },
21        {
22            "probability": 0.99889404,
23            "label": "Number of Events",
24            "boundingBox": {
25                "minX": 405,
26                "minY": 50,
27                "maxX": 659,
28                "maxY": 75
29            },
30            "attributes": {
31                "cellLocation": {
32                    "rowIndex": 1,
33                    "colIndex": 2
34                },
35                "pageNumber": "1"
36            }
37        },
38        {
39            "probability": 0.9988783,
40            "label": "Number of Stations",
41            "boundingBox": {
42                "minX": 773,
43                "minY": 51,
44                "maxX": 1048,
45                "maxY": 75
46            },
47            "attributes": {
48                "cellLocation": {
49                    "rowIndex": 1,
50                    "colIndex": 3
51                },
52                "pageNumber": "1"
53            }
54        },
55        {
56            "probability": 0.99629766,
57            "label": "San Francisco",
58            "boundingBox": {
59                "minX": 91,
60                "minY": 115,
61                "maxX": 282,
62                "maxY": 140
63            },
64            "attributes": {
65                "cellLocation": {
66                    "rowIndex": 2,
67                    "colIndex": 1
68                },
69                "pageNumber": "1"
70            }
71        },
72        {
73            "probability": 0.9942451,
74            "label": "100",
75            "boundingBox": {
76                "minX": 511,
77                "minY": 116,
78                "maxX": 557,
79                "maxY": 140
80            },
81            "attributes": {
82                "cellLocation": {
83                    "rowIndex": 2,
84                    "colIndex": 2
85                },
86                "pageNumber": "1"
87            }
88        },
89        {
90            "probability": 0.97811675,
91            "label": "21",
92            "boundingBox": {
93                "minX": 894,
94                "minY": 116,
95                "maxX": 924,
96                "maxY": 139
97            },
98            "attributes": {
99                "cellLocation": {
100                    "rowIndex": 2,
101                    "colIndex": 3
102                },
103                "pageNumber": "1"
104            }
105        },
106        {
107            "probability": 0.9973557,
108            "label": "San Diego",
109            "boundingBox": {
110                "minX": 117,
111                "minY": 180,
112                "maxX": 256,
113                "maxY": 213
114            },
115            "attributes": {
116                "cellLocation": {
117                    "rowIndex": 3,
118                    "colIndex": 1
119                },
120                "pageNumber": "1"
121            }
122        },
123        {
124            "probability": 0.99561936,
125            "label": "123",
126            "boundingBox": {
127                "minX": 510,
128                "minY": 182,
129                "maxX": 558,
130                "maxY": 206
131            },
132            "attributes": {
133                "cellLocation": {
134                    "rowIndex": 3,
135                    "colIndex": 2
136                },
137                "pageNumber": "1"
138            }
139        },
140        {
141            "probability": 0.9816425,
142            "label": "18",
143            "boundingBox": {
144                "minX": 896,
145                "minY": 181,
146                "maxX": 926,
147                "maxY": 206
148            },
149            "attributes": {
150                "cellLocation": {
151                    "rowIndex": 3,
152                    "colIndex": 3
153                },
154                "pageNumber": "1"
155            }
156        },
157        {
158            "probability": 0.9973557,
159            "label": "San Jose",
160            "boundingBox": {
161                "minX": 125,
162                "minY": 246,
163                "maxX": 248,
164                "maxY": 271
165            },
166            "attributes": {
167                "cellLocation": {
168                    "rowIndex": 4,
169                    "colIndex": 1
170                },
171                "pageNumber": "1"
172            }
173        },
174        {
175            "probability": 0.9696964,
176            "label": "53",
177            "boundingBox": {
178                "minX": 517,
179                "minY": 247,
180                "maxX": 549,
181                "maxY": 270
182            },
183            "attributes": {
184                "cellLocation": {
185                    "rowIndex": 4,
186                    "colIndex": 2
187                },
188                "pageNumber": "1"
189            }
190        },
191        {
192            "probability": 0.9926605,
193            "label": "189",
194            "boundingBox": {
195                "minX": 888,
196                "minY": 247,
197                "maxX": 935,
198                "maxY": 271
199            },
200            "attributes": {
201                "cellLocation": {
202                    "rowIndex": 4,
203                    "colIndex": 3
204                },
205                "pageNumber": "1"
206            }
207        }
208    ],
209    "object": "predictresponse"
210}

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

TableWithOCRCallouts

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.

MultiTableExample

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.

Note