Skip to content

Vision API pixelFractions don't add up #2383

@aggubin

Description

@aggubin

I am evaluating Vision API for color detection and ran into this issue:

I've uploaded an image of a rainbow to https://cloud.google.com/vision/docs/drag-and-drop
rainbow

and got the following for image properties:

  "imagePropertiesAnnotation": {
      "dominantColors": {
        "colors": [
          {
            "color": {
              "red": 3,
              "green": 2,
              "blue": 253
            },
            "score": 0.23274913,
            "pixelFraction": 0.08280405
          },
          {
            "color": {
              "red": 6,
              "green": 129,
              "blue": 6
            },
            "score": 0.22612064,
            "pixelFraction": 0.10820983
          },
          {
            "color": {
              "red": 249,
              "green": 249,
              "blue": 10
            },
            "score": 0.12150193,
            "pixelFraction": 0.06665099
          },
          {
            "color": {
              "red": 74,
              "green": 3,
              "blue": 128
            },
            "score": 0.057100553,
            "pixelFraction": 0.10577903
          },
          {
            "color": {
              "red": 253,
              "green": 168,
              "blue": 3
            },
            "score": 0.044047087,
            "pixelFraction": 0.07417862
          },
          {
            "color": {
              "red": 41,
              "blue": 200
            },
            "score": 0.015849508,
            "pixelFraction": 0.009252725
          },
          {
            "color": {
              "red": 81,
              "green": 85,
              "blue": 253
            },
            "score": 0.008871765,
            "pixelFraction": 0.0034501685
          },
          {
            "color": {
              "red": 253,
              "green": 2,
              "blue": 3
            },
            "score": 0.006723068,
            "pixelFraction": 0.096996784
          },
          {
            "color": {
              "red": 165,
              "green": 159,
              "blue": 7
            },
            "score": 0.0064168423,
            "pixelFraction": 0.0047047753
          },
          {
            "color": {
              "red": 154,
              "green": 78,
              "blue": 189
            },
            "score": 0.0041353106,
            "pixelFraction": 0.011761938
          }
        ]
      }
    }

things I've noticed:
pixelFractions add up to 1.0, but rather to 0.5637 and scores to ~0.7235...
Why is that, where does the rest of the pixels go?

I also uploaded the following image:
red (single color red block)
and that gives expected 1 and 1 for pixelFraction and score

Sincerely,
Alexander

Metadata

Metadata

Assignees

Labels

api: visionIssues related to the Cloud Vision API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions