Class: Gcloud::Vision::Annotation::Face::Likelihood
- Inherits:
-
Object
- Object
- Gcloud::Vision::Annotation::Face::Likelihood
- Defined in:
- lib/gcloud/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 =
%w(POSSIBLE LIKELY VERY_LIKELY)
Instance Attribute Summary collapse
Class Method Summary collapse
-
.from_gapi(gapi) ⇒ 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_hash ⇒ 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.
1581 1582 1583 |
# File 'lib/gcloud/vision/annotation/face.rb', line 1581 def initialize @gapi = {} end |
Instance Attribute Details
#gapi ⇒ Object
1577 1578 1579 |
# File 'lib/gcloud/vision/annotation/face.rb', line 1577 def gapi @gapi end |
Class Method Details
.from_gapi(gapi) ⇒ Object
object.
1743 1744 1745 |
# File 'lib/gcloud/vision/annotation/face.rb', line 1743 def self.from_gapi gapi new.tap { |f| f.instance_variable_set :@gapi, gapi } end |
Instance Method Details
#anger ⇒ Object
Joy likelihood rating. Possible values are ‘VERY_UNLIKELY`, `UNLIKELY`, `POSSIBLE`, `LIKELY`, and `VERY_LIKELY`.
1622 1623 1624 |
# File 'lib/gcloud/vision/annotation/face.rb', line 1622 def anger @gapi["angerLikelihood"] end |
#anger? ⇒ Boolean
Anger likelihood. Returns ‘true` if #anger is `POSSIBLE`, `LIKELY`, or `VERY_LIKELY`.
1632 1633 1634 |
# File 'lib/gcloud/vision/annotation/face.rb', line 1632 def anger? POSITIVE_RATINGS.include? anger end |
#blurred ⇒ Object
Blurred likelihood rating. Possible values are ‘VERY_UNLIKELY`, `UNLIKELY`, `POSSIBLE`, `LIKELY`, and `VERY_LIKELY`.
1674 1675 1676 |
# File 'lib/gcloud/vision/annotation/face.rb', line 1674 def @gapi["blurredLikelihood"] end |
#blurred? ⇒ Boolean
Blurred likelihood. Returns ‘true` if #blurred is `POSSIBLE`, `LIKELY`, or `VERY_LIKELY`.
1684 1685 1686 |
# File 'lib/gcloud/vision/annotation/face.rb', line 1684 def POSITIVE_RATINGS.include? end |
#headwear ⇒ Object
Headwear likelihood rating. Possible values are ‘VERY_UNLIKELY`, `UNLIKELY`, `POSSIBLE`, `LIKELY`, and `VERY_LIKELY`.
1691 1692 1693 |
# File 'lib/gcloud/vision/annotation/face.rb', line 1691 def headwear @gapi["headwearLikelihood"] end |
#headwear? ⇒ Boolean
Headwear likelihood. Returns ‘true` if #headwear is `POSSIBLE`, `LIKELY`, or `VERY_LIKELY`.
1701 1702 1703 |
# File 'lib/gcloud/vision/annotation/face.rb', line 1701 def headwear? POSITIVE_RATINGS.include? headwear end |
#inspect ⇒ Object
1736 1737 1738 |
# File 'lib/gcloud/vision/annotation/face.rb', line 1736 def inspect "#<Likelihood #{self}>" end |
#joy ⇒ Object
Joy likelihood rating. Possible values are ‘VERY_UNLIKELY`, `UNLIKELY`, `POSSIBLE`, `LIKELY`, and `VERY_LIKELY`.
1588 1589 1590 |
# File 'lib/gcloud/vision/annotation/face.rb', line 1588 def joy @gapi["joyLikelihood"] end |
#joy? ⇒ Boolean
Joy likelihood. Returns ‘true` if #joy is `POSSIBLE`, `LIKELY`, or `VERY_LIKELY`.
1598 1599 1600 |
# File 'lib/gcloud/vision/annotation/face.rb', line 1598 def joy? POSITIVE_RATINGS.include? joy end |
#sorrow ⇒ Object
Sorrow likelihood rating. Possible values are ‘VERY_UNLIKELY`, `UNLIKELY`, `POSSIBLE`, `LIKELY`, and `VERY_LIKELY`.
1605 1606 1607 |
# File 'lib/gcloud/vision/annotation/face.rb', line 1605 def sorrow @gapi["sorrowLikelihood"] end |
#sorrow? ⇒ Boolean
Sorrow likelihood. Returns ‘true` if #sorrow is `POSSIBLE`, `LIKELY`, or `VERY_LIKELY`.
1615 1616 1617 |
# File 'lib/gcloud/vision/annotation/face.rb', line 1615 def sorrow? POSITIVE_RATINGS.include? sorrow end |
#surprise ⇒ Object
Surprise likelihood rating. Possible values are ‘VERY_UNLIKELY`, `UNLIKELY`, `POSSIBLE`, `LIKELY`, and `VERY_LIKELY`.
1639 1640 1641 |
# File 'lib/gcloud/vision/annotation/face.rb', line 1639 def surprise @gapi["surpriseLikelihood"] end |
#surprise? ⇒ Boolean
Surprise likelihood. Returns ‘true` if #surprise is `POSSIBLE`, `LIKELY`, or `VERY_LIKELY`.
1649 1650 1651 |
# File 'lib/gcloud/vision/annotation/face.rb', line 1649 def surprise? POSITIVE_RATINGS.include? surprise end |
#to_h ⇒ Hash
Converts object to a hash. All keys will be symbolized.
1710 1711 1712 |
# File 'lib/gcloud/vision/annotation/face.rb', line 1710 def to_h to_hash end |
#to_hash ⇒ Hash
Converts object to a hash. All keys will be symbolized.
1719 1720 1721 1722 1723 |
# File 'lib/gcloud/vision/annotation/face.rb', line 1719 def to_hash { joy: joy?, sorrow: sorrow?, anger: anger?, surprise: surprise?, under_exposed: under_exposed?, blurred: , headwear: headwear? } end |
#to_s ⇒ Object
1726 1727 1728 1729 1730 1731 1732 1733 |
# File 'lib/gcloud/vision/annotation/face.rb', line 1726 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`.
1657 1658 1659 |
# File 'lib/gcloud/vision/annotation/face.rb', line 1657 def under_exposed @gapi["underExposedLikelihood"] end |
#under_exposed? ⇒ Boolean
Under Exposed likelihood. Returns ‘true` if #under_exposed is `POSSIBLE`, `LIKELY`, or `VERY_LIKELY`.
1667 1668 1669 |
# File 'lib/gcloud/vision/annotation/face.rb', line 1667 def under_exposed? POSITIVE_RATINGS.include? under_exposed end |