Class: Google::Cloud::Vision::Annotation::Face::Likelihood
- Inherits:
-
Object
- Object
- Google::Cloud::Vision::Annotation::Face::Likelihood
- Defined in:
- lib/google/cloud/vision/annotation/face.rb
Overview
# Likelihood
A bucketized representation of likelihood of various separate facial characteristics, meant to give highly stable results across model upgrades.
Constant Summary collapse
- POSITIVE_RATINGS =
%i(POSSIBLE LIKELY VERY_LIKELY)
Instance Attribute Summary collapse
Class Method Summary collapse
-
.from_grpc(grpc) ⇒ Object
object.
Instance Method Summary collapse
-
#anger ⇒ Object
Joy likelihood rating.
-
#anger? ⇒ Boolean
Anger likelihood.
-
#blurred ⇒ Object
Blurred likelihood rating.
-
#blurred? ⇒ Boolean
Blurred likelihood.
-
#headwear ⇒ Object
Headwear likelihood rating.
-
#headwear? ⇒ Boolean
Headwear likelihood.
-
#initialize ⇒ Likelihood
constructor
A new instance of Likelihood.
- #inspect ⇒ Object
-
#joy ⇒ Object
Joy likelihood rating.
-
#joy? ⇒ Boolean
Joy likelihood.
-
#sorrow ⇒ Object
Sorrow likelihood rating.
-
#sorrow? ⇒ Boolean
Sorrow likelihood.
-
#surprise ⇒ Object
Surprise likelihood rating.
-
#surprise? ⇒ Boolean
Surprise likelihood.
-
#to_h ⇒ Hash
Converts object to a hash.
- #to_s ⇒ Object
-
#under_exposed ⇒ Object
Under Exposed likelihood rating.
-
#under_exposed? ⇒ Boolean
Under Exposed likelihood.
Constructor Details
#initialize ⇒ Likelihood
Returns a new instance of Likelihood.
1334 1335 1336 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 1334 def initialize @grpc = nil end |
Instance Attribute Details
#grpc ⇒ Object
1330 1331 1332 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 1330 def grpc @grpc end |
Class Method Details
.from_grpc(grpc) ⇒ Object
object.
1487 1488 1489 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 1487 def self.from_grpc grpc new.tap { |f| f.instance_variable_set :@grpc, grpc } end |
Instance Method Details
#anger ⇒ Object
Joy likelihood rating. Possible values are ‘VERY_UNLIKELY`, `UNLIKELY`, `POSSIBLE`, `LIKELY`, and `VERY_LIKELY`.
1375 1376 1377 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 1375 def anger @grpc.anger_likelihood end |
#anger? ⇒ Boolean
Anger likelihood. Returns ‘true` if #anger is `POSSIBLE`, `LIKELY`, or `VERY_LIKELY`.
1385 1386 1387 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 1385 def anger? POSITIVE_RATINGS.include? anger end |
#blurred ⇒ Object
Blurred likelihood rating. Possible values are ‘VERY_UNLIKELY`, `UNLIKELY`, `POSSIBLE`, `LIKELY`, and `VERY_LIKELY`.
1427 1428 1429 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 1427 def @grpc. end |
#blurred? ⇒ Boolean
Blurred likelihood. Returns ‘true` if #blurred is `POSSIBLE`, `LIKELY`, or `VERY_LIKELY`.
1437 1438 1439 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 1437 def POSITIVE_RATINGS.include? end |
#headwear ⇒ Object
Headwear likelihood rating. Possible values are ‘VERY_UNLIKELY`, `UNLIKELY`, `POSSIBLE`, `LIKELY`, and `VERY_LIKELY`.
1444 1445 1446 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 1444 def headwear @grpc.headwear_likelihood end |
#headwear? ⇒ Boolean
Headwear likelihood. Returns ‘true` if #headwear is `POSSIBLE`, `LIKELY`, or `VERY_LIKELY`.
1454 1455 1456 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 1454 def headwear? POSITIVE_RATINGS.include? headwear end |
#inspect ⇒ Object
1480 1481 1482 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 1480 def inspect "#<Likelihood #{self}>" end |
#joy ⇒ Object
Joy likelihood rating. Possible values are ‘VERY_UNLIKELY`, `UNLIKELY`, `POSSIBLE`, `LIKELY`, and `VERY_LIKELY`.
1341 1342 1343 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 1341 def joy @grpc.joy_likelihood end |
#joy? ⇒ Boolean
Joy likelihood. Returns ‘true` if #joy is `POSSIBLE`, `LIKELY`, or `VERY_LIKELY`.
1351 1352 1353 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 1351 def joy? POSITIVE_RATINGS.include? joy end |
#sorrow ⇒ Object
Sorrow likelihood rating. Possible values are ‘VERY_UNLIKELY`, `UNLIKELY`, `POSSIBLE`, `LIKELY`, and `VERY_LIKELY`.
1358 1359 1360 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 1358 def sorrow @grpc.sorrow_likelihood end |
#sorrow? ⇒ Boolean
Sorrow likelihood. Returns ‘true` if #sorrow is `POSSIBLE`, `LIKELY`, or `VERY_LIKELY`.
1368 1369 1370 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 1368 def sorrow? POSITIVE_RATINGS.include? sorrow end |
#surprise ⇒ Object
Surprise likelihood rating. Possible values are ‘VERY_UNLIKELY`, `UNLIKELY`, `POSSIBLE`, `LIKELY`, and `VERY_LIKELY`.
1392 1393 1394 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 1392 def surprise @grpc.surprise_likelihood end |
#surprise? ⇒ Boolean
Surprise likelihood. Returns ‘true` if #surprise is `POSSIBLE`, `LIKELY`, or `VERY_LIKELY`.
1402 1403 1404 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 1402 def surprise? POSITIVE_RATINGS.include? surprise end |
#to_h ⇒ Hash
Converts object to a hash. All keys will be symbolized.
1463 1464 1465 1466 1467 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 1463 def to_h { joy: joy?, sorrow: sorrow?, anger: anger?, surprise: surprise?, under_exposed: under_exposed?, blurred: , headwear: headwear? } end |
#to_s ⇒ Object
1470 1471 1472 1473 1474 1475 1476 1477 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 1470 def to_s tmplt = "(joy?: %s, sorrow?: %s, anger?: %s, " \ "surprise?: %s, under_exposed?: %s, blurred?: %s, " \ "headwear: %s)" format tmplt, joy?.inspect, sorrow?.inspect, anger?.inspect, surprise?.inspect, under_exposed?.inspect, .inspect, headwear?.inspect end |
#under_exposed ⇒ Object
Under Exposed likelihood rating. Possible values are ‘VERY_UNLIKELY`, `UNLIKELY`, `POSSIBLE`, `LIKELY`, and `VERY_LIKELY`.
1410 1411 1412 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 1410 def under_exposed @grpc.under_exposed_likelihood end |
#under_exposed? ⇒ Boolean
Under Exposed likelihood. Returns ‘true` if #under_exposed is `POSSIBLE`, `LIKELY`, or `VERY_LIKELY`.
1420 1421 1422 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 1420 def under_exposed? POSITIVE_RATINGS.include? under_exposed end |