Skip to content

Commit

Permalink
pubsub: include original likelihood score
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenplusplus committed Mar 6, 2017
1 parent 3a2b2d1 commit 7ff1284
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
11 changes: 9 additions & 2 deletions packages/vision/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -960,12 +960,19 @@ Vision.prototype.detectCrops = function(images, options, callback) {
* // },
* // confidence: 56.748849,
* // anger: false,
* // angerLikelihood: 1,
* // blurred: false,
* // blurredLikelihood: 1,
* // headwear: false,
* // headwearLikelihood: 1,
* // joy: false,
* // joyLikelihood: 1,
* // sorrow: false,
* // sorrowLikelihood: 1,
* // surprise: false,
* // underExposed: false
* // surpriseLikelihood: 1,
* // underExposed: false,
* // underExposedLikelihood: 1
* // }
* // ]
* });
Expand Down Expand Up @@ -1917,7 +1924,7 @@ Vision.formatFaceAnnotation_ = function(faceAnnotation) {
formattedFaceAnnotation[shortenedProp] =
Vision.gteLikelihood_(LIKELY, faceAnnotation[prop]);

formattedFaceAnnotation[prop] = faceAnnotation[prop];
formattedFaceAnnotation[prop] = Vision.likelihood[faceAnnotation[prop]];
}
}

Expand Down
10 changes: 9 additions & 1 deletion packages/vision/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1474,15 +1474,23 @@ describe('Vision', function() {
confidence: faceAnnotation.detectionConfidence * 100,

anger: true,
angerLikelihood: 3,
blurred: true,
blurredLikelihood: 3,
headwear: true,
headwearLikelihood: 3,
joy: true,
joyLikelihood: 3,
sorrow: true,
sorrowLikelihood: 3,
surprise: true,
surpriseLikelihood: 3,
underExposed: true,
underExposedLikelihood: 3,

// Checks that *any* property that ends in `Likelihood` is shortened.
nonExistent: true
nonExistent: true,
nonExistentLikelihood: 3
};

var formatted = Vision.formatFaceAnnotation_(faceAnnotation);
Expand Down

0 comments on commit 7ff1284

Please sign in to comment.