Persistent Google Vision OCR Workflow Error

Hi everyone,

I’m facing a consistent issue with the Google Vision OCR workflow in Roboflow. I’m encountering two distinct error messages:

`Error 1:
{
“error”: “Error during execution of step: $steps.google_vision_ocr. Details: ‘y’”,
“inner_error”: “‘y’”
}

Error 2:
{
“error”: “Error during execution of step: $steps.google_vision_ocr. Details: ‘x’”,
“inner_error”: “‘x’”
}`

I’ve noticed a peculiar behavior with both Error 1 and 2. In some cases, the OCR fails to detect any text because the vehicle is angled and obviously, a license plate can’t be detected, yet it doesn’t throw that error. However, when I test multiple images in the same JPG format, I get this error even if there’s no license plate, which I find strange. With other images where the license plate is visible, it works fine, so I’m unsure what’s happening with certain images. I’m testing with the images provided to me, all in the same format but not necessarily the same resolution. Even within the same resolution, some work and others don’t

I’m wondering if anyone else has encountered similar behavior or has any insights into potential causes. Any suggestions or solutions would be greatly appreciated.

Hi @IA_Prosys ,

On the left-hand-side of workflow editor there is a panel you can open by clicking > - can you share JSON workflow definition from this panel?

Thanks!
Grzegorz

{
  "version": "1.0",
  "inputs": [
    {
      "type": "InferenceImage",
      "name": "image"
    }
  ],
  "steps": [
    {
      "type": "roboflow_core/roboflow_instance_segmentation_model@v1",
      "name": "model",
      "images": "$inputs.image",
      "model_id": "danos_v1/18",
      "confidence": 0.1,
      "iou_threshold": 0,
      "active_learning_target_dataset": "danos_v1"
    },
    {
      "type": "roboflow_core/detections_filter@v1",
      "name": "detections_filter",
      "predictions": "$steps.model.predictions",
      "operations": [
        {
          "type": "DetectionsFilter",
          "filter_operation": {
            "type": "StatementGroup",
            "operator": "and",
            "statements": [
              {
                "type": "BinaryStatement",
                "negate": false,
                "left_operand": {
                  "type": "DynamicOperand",
                  "operand_name": "_",
                  "operations": [
                    {
                      "type": "ExtractDetectionProperty",
                      "property_name": "class_name"
                    }
                  ]
                },
                "comparator": {
                  "type": "in (Sequence)"
                },
                "right_operand": {
                  "type": "StaticOperand",
                  "value": [
                    "Patente"
                  ]
                }
              },
              {
                "type": "BinaryStatement",
                "left_operand": {
                  "type": "DynamicOperand",
                  "operand_name": "_",
                  "operations": [
                    {
                      "type": "ExtractDetectionProperty",
                      "property_name": "confidence"
                    }
                  ]
                },
                "comparator": {
                  "type": "(Number) >="
                },
                "right_operand": {
                  "type": "StaticOperand",
                  "value": 0.5
                }
              }
            ]
          }
        }
      ],
      "operations_parameters": {},
      "uistate": {
        "selectedFilterType": "filter_by_class_and_confidence",
        "isClassFilteringActive": true,
        "isConfidenceFilteringActive": true,
        "classSetInclusionMode": "in",
        "classList": [
          "Patente"
        ],
        "confidenceThreshold": 0.5,
        "confidenceOperator": ">=",
        "referenceImage": "$inputs.image",
        "zoneOperator": "in",
        "isZoneStatic": true,
        "zonePoints": [],
        "detectionReferencePoint": "center",
        "dynamicZone": null,
        "detectionsOffset": [
          0,
          0
        ]
      }
    },
    {
      "type": "roboflow_core/polygon_visualization@v1",
      "name": "bounding_box_visualization",
      "predictions": "$steps.detections_filter.predictions",
      "image": "$inputs.image"
    },
    {
      "type": "roboflow_core/crop_visualization@v1",
      "name": "crop_visualization",
      "image": "$steps.bounding_box_visualization.image",
      "predictions": "$steps.detections_filter.predictions",
      "scale_factor": 0.3
    },
    {
      "type": "roboflow_core/dynamic_crop@v1",
      "name": "dynamic_crop",
      "images": "$steps.crop_visualization.image",
      "predictions": "$steps.detections_filter.predictions"
    },
    {
      "type": "roboflow_core/google_vision_ocr@v1",
      "name": "google_vision_ocr",
      "image": "$steps.dynamic_crop.crops",
      "ocr_type": "text_detection",
      "api_key": ""
    },
    {
      "type": "roboflow_core/roboflow_dataset_upload@v2",
      "name": "roboflow_dataset_upload",
      "predictions": "$steps.model.predictions",
      "images": "$inputs.image",
      "usage_quota_name": "upload_quota_atoyQ",
      "target_project": "danos_v1"
    },
    {
      "type": "roboflow_core/polygon_visualization@v1",
      "name": "polygon_visualization",
      "predictions": "$steps.model.predictions",
      "image": "$inputs.image",
      "copy_image": "$steps.roboflow_dataset_upload.error_status"
    },
    {
      "type": "roboflow_core/label_visualization@v1",
      "name": "label_visualization_1",
      "image": "$steps.polygon_visualization.image",
      "predictions": "$steps.model.predictions",
      "text_scale": 0.6,
      "text_padding": 2
    }
  ],
  "outputs": [
    {
      "type": "JsonField",
      "name": "google_vision_ocr",
      "coordinates_system": "own",
      "selector": "$steps.google_vision_ocr.*"
    },
    {
      "type": "JsonField",
      "name": "predictions",
      "coordinates_system": "own",
      "selector": "$steps.model.predictions"
    },
    {
      "type": "JsonField",
      "name": "detections_visualization",
      "coordinates_system": "own",
      "selector": "$steps.label_visualization_1.image"
    }
  ]
}

Hi @IA_Prosys,

Thanks for reporting this bug. We found the issue resulting in these errors. For some reason the Google vision API sometimes returns vertices with only a x or y coordinate, which doesn’t match their documentation. We tested aroudna bit and feel pretty sure that setting those to 0 seems to make sense.

There is a PR with a bugfix open here: Fix Google Vision Block bounding box parsing by brunopicinin · Pull Request #961 · roboflow/inference · GitHub

I expect it to make it into next week release, at which point our hosted api will also reflect the bugfix.