Skip to content

Vision api imageProperties dominant color score meaning #1324

Description

@mik115

Hi,
we are using vision api for image analysis.
In the image properties, the dominantColor field is an array containing objects like this:

field meaning
color rgb color representation
score Image-specific score for this color. Value in range [0, 1]
pixelFraction Stores the fraction of pixels the color occupies in the image. Value in range [0, 1]. !

I can't understand the score property meaning and how it is calculated.
In many cases the score value is not related to the pixelFraction value.

thanks in advance

Activity

  1. added
    type: questionRequest for information or clarification. Not an issue.
    api: visionIssues related to the Cloud Vision API.
    on May 17, 2016
  2. stephenplusplus commented on May 17, 2016

    @stephenplusplus
    Contributor
  3. mik115 commented on May 19, 2016

    @mik115
    Author

    hi, any news??

  4. jgeewax commented on May 19, 2016

    @jgeewax
    Contributor

    Hey @mik115 - going to dig on this for you and hopefully update our docs to be a bit more clear. Score is typically a "confidence level" (ie, "I'm 90% sure this picture is of a dog"), but I can see the confusion this might be causing. Hang tight -- going to figure it out :)

  5. mik115 commented on Jun 3, 2016

    @mik115
    Author

    hi, any news about my question?
    Thanks

  6. maxdelia commented on Jun 24, 2016

    @maxdelia

    Hello guys!
    Any answer here?
    In my honest opinion this is a key question and should be answered asap!

  7. stephenplusplus commented on Jun 24, 2016

    @stephenplusplus
    Contributor

    @jgeewax anyone from the Vision team who can help?

  8. stephenplusplus commented on Aug 26, 2016

    @stephenplusplus
    Contributor

    Going to close since this isn't an issue with our library. But feel free to stay tuned if @jgeewax or @omaray can find an answer.

  9. zubairshokh commented on Sep 27, 2016

    @zubairshokh

    What google vision API provides us is the color, score and pixel fraction. Can we have a formulla to get the percentage of the color.

  10. stephenplusplus commented on Sep 27, 2016

    @stephenplusplus
    Contributor

    @zubairshokh do you mean the percentage of pixels of a color across the entire image? I believe that is what we calculate as coverage:

    test image

    var img = 'https://camo.githubusercontent.com/e7653451a451dd7219ffbfddccab39daac4aead4/687474703a2f2f636f6f6c626c61636b7070742e636f6d2f77702d636f6e74656e742f75706c6f6164732f3235363078313434302d636f6e676f2d70696e6b2d636f6f6c2d626c61636b2d616e642d636f6f6c2d677265792d74687265652d636f6c6f722d6261636b67726f756e642d32303135303230353031303935362d353464326332653432613935362e6a7067'
    
    vision.detectProperties(img, { verbose: true }, function(err, props) {
      if (err) throw err
      props = [
        {
          score: 97.700495,
          hex: '002e62',
          red: undefined,
          green: 46,
          blue: 98,
          coverage: 32
        },
        {
          score: 0.76268637,
          hex: '8990ab',
          red: 137,
          green: 144,
          blue: 171,
          coverage: 33.333334
        },
        {
          score: 1.5368186000000001,
          hex: '0a3567',
          red: 10,
          green: 53,
          blue: 103,
          coverage: 1.3333334000000001
        },
        {
          score: 5.019082e-7,
          hex: 'f88379',
          red: 248,
          green: 131,
          blue: 121,
          coverage: 32.666665
        },
        {
          score: 2.0494233e-8,
          hex: 'e87e77',
          red: 232,
          green: 126,
          blue: 119,
          coverage: 0.6666666800000001
        }
      ]  
    })
  11. zubairshokh commented on Sep 28, 2016

    @zubairshokh

    @stephenplusplus But here is what I get .

    `Vision.Images.Annotate annotate =
                vision.images()
                        .annotate(new BatchAnnotateImagesRequest().setRequests(ImmutableList.of(request)));
    
       BatchAnnotateImagesResponse batchResponse = annotate.execute();`
    
    
    
    `{
    "dominantColors" : {
        "colors" : [ 
            {
                "color" : {
                    "blue" : 171.0,
                    "green" : 233.0,
                    "red" : 241.0
                },
                "pixelFraction" : 0.0413596630096436,
                "score" : 0.33846253156662
            }, 
            {
                "color" : {
                    "blue" : 96.0,
                    "green" : 50.0,
                    "red" : 48.0
                },
                "pixelFraction" : 0.208271935582161,
                "score" : 0.0438975356519222
            }, 
            {
                "color" : {
                    "blue" : 121.0,
                    "green" : 119.0,
                    "red" : 128.0
                },
                "pixelFraction" : 0.0259357504546642,
                "score" : 0.00990148447453976
            }, 
            {
                "color" : {
                    "blue" : 193.0,
                    "green" : 238.0,
                    "red" : 241.0
                },
                "pixelFraction" : 0.0325179286301136,
                "score" : 0.182118445634842
            }, 
            {
                "color" : {
                    "blue" : 162.0,
                    "green" : 235.0,
                    "red" : 239.0
                },
                "pixelFraction" : 0.015227428637445,
                "score" : 0.129081636667252
            }, 
            {
                "color" : {
                    "blue" : 141.0,
                    "green" : 204.0,
                    "red" : 218.0
                },
                "pixelFraction" : 0.020827192813158,
                "score" : 0.0650643929839134
            }, 
                   ]
    }
    

    }`

  12. stephenplusplus commented on Sep 28, 2016

    @stephenplusplus
    Contributor

    Oh, I see. Is that another client library from a different language?

    All we do is pixelFraction * 100: https://github.com/GoogleCloudPlatform/google-cloud-node/blob/6c1ebc0a43feb21279808304b515d139ef29ab41/packages/vision/src/index.js#L1525

  13. 9 remaining items

  14. zubairshokh commented on Oct 3, 2016

    @zubairshokh

    @jgeewax Thank you. Lot of confusions are clear by your explanation. 👍

  15. stephenplusplus commented on Oct 3, 2016

    @stephenplusplus
    Contributor

    Given that explanation, we probably shouldn't change our formula to consider the score of an annotation. I imagine most use cases will be technical, and the precise number of pixels is what's wanted. As always, the score and raw API response is available in the same callback as our decorated response for the other use cases.

  16. 00hello commented on Feb 3, 2018

    @00hello

    @jgeewax Thanks for this explanation. I'm trying to find more info on the type of RGB space used for the colors. Can you tell me what code you looked at that allowed you to figure out what "score" meant. It may be what I'm looking for

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

api: visionIssues related to the Cloud Vision API.type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions