从Google对象检测ML建议的边界框中查找文本

时间:2019-08-03 20:38:17

标签: machine-learning google-cloud-platform computer-vision object-detection object-detection-api

我将Google Object Detection API用于我们的自定义模型。

数据集包含名片,因此所有文本。我们已经部署了模型,并且当我们使用可视界面测试名片时,模型运行得很好。

但是,要在后端Nodejs服务器上使用它,我们正在使用REST API。 API请求如下所示:


curl -X POST -H "Content-Type: application/json"   -H "Authorization: Bearer $(gcloud auth application-default print-access-token)"   https://automl.googleapis.com/v1beta1/projects/1023422831715/locations/us-central1/models/IOD9200669320764456960:predict   -d @request.json

REST响应返回的数据如下:

{
  "payload": [
    {
      "annotationSpecId": "5824016335306227712",
      "imageObjectDetection": {
        "boundingBox": {
          "normalizedVertices": [
            {
              "x": 0.050029,
              "y": 0.139873
            },
            {
              "x": 0.230016,
              "y": 0.251469
            }
          ]
        },
        "score": 0.998103
      },
      "displayName": "first_name"
    },
    {
      "annotationSpecId": "2224232858153648128",
      "imageObjectDetection": {
        "boundingBox": {
          "normalizedVertices": [
            {
              "x": 0.0465549,
              "y": 0.236178
            },
            {
              "x": 0.462747,
              "y": 0.30602
            }
          ]
        },
        "score": 0.98034
      },
      "displayName": "job_title"
    },
    {
      "annotationSpecId": "8910530192426926080",
      "imageObjectDetection": {
        "boundingBox": {
          "normalizedVertices": [
            {
              "x": 0.053251,
              "y": 0.410447
            },
            {
              "x": 0.452525,
              "y": 0.559461
            }
          ]
        },
        "score": 0.904657
      },
      "displayName": "address"
    }
  ]
}

问题在于,在REST情况下,这仅给出了带有分数和标签的边界框。但是,它没有给出。边框下的文字。

那么,我们如何在上述建议的边框下获得文本?

0 个答案:

没有答案