Class: OCI::AiVision::Models::AnalyzeImageResult

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/ai_vision/models/analyze_image_result.rb

Overview

The image analysis results.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ AnalyzeImageResult

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/oci/ai_vision/models/analyze_image_result.rb', line 102

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.image_objects = attributes[:'imageObjects'] if attributes[:'imageObjects']

  raise 'You cannot provide both :imageObjects and :image_objects' if attributes.key?(:'imageObjects') && attributes.key?(:'image_objects')

  self.image_objects = attributes[:'image_objects'] if attributes[:'image_objects']

  self.labels = attributes[:'labels'] if attributes[:'labels']

  self.ontology_classes = attributes[:'ontologyClasses'] if attributes[:'ontologyClasses']

  raise 'You cannot provide both :ontologyClasses and :ontology_classes' if attributes.key?(:'ontologyClasses') && attributes.key?(:'ontology_classes')

  self.ontology_classes = attributes[:'ontology_classes'] if attributes[:'ontology_classes']

  self.image_text = attributes[:'imageText'] if attributes[:'imageText']

  raise 'You cannot provide both :imageText and :image_text' if attributes.key?(:'imageText') && attributes.key?(:'image_text')

  self.image_text = attributes[:'image_text'] if attributes[:'image_text']

  self.detected_faces = attributes[:'detectedFaces'] if attributes[:'detectedFaces']

  raise 'You cannot provide both :detectedFaces and :detected_faces' if attributes.key?(:'detectedFaces') && attributes.key?(:'detected_faces')

  self.detected_faces = attributes[:'detected_faces'] if attributes[:'detected_faces']

  self.image_classification_model_version = attributes[:'imageClassificationModelVersion'] if attributes[:'imageClassificationModelVersion']

  raise 'You cannot provide both :imageClassificationModelVersion and :image_classification_model_version' if attributes.key?(:'imageClassificationModelVersion') && attributes.key?(:'image_classification_model_version')

  self.image_classification_model_version = attributes[:'image_classification_model_version'] if attributes[:'image_classification_model_version']

  self.object_detection_model_version = attributes[:'objectDetectionModelVersion'] if attributes[:'objectDetectionModelVersion']

  raise 'You cannot provide both :objectDetectionModelVersion and :object_detection_model_version' if attributes.key?(:'objectDetectionModelVersion') && attributes.key?(:'object_detection_model_version')

  self.object_detection_model_version = attributes[:'object_detection_model_version'] if attributes[:'object_detection_model_version']

  self.text_detection_model_version = attributes[:'textDetectionModelVersion'] if attributes[:'textDetectionModelVersion']

  raise 'You cannot provide both :textDetectionModelVersion and :text_detection_model_version' if attributes.key?(:'textDetectionModelVersion') && attributes.key?(:'text_detection_model_version')

  self.text_detection_model_version = attributes[:'text_detection_model_version'] if attributes[:'text_detection_model_version']

  self.face_detection_model_version = attributes[:'faceDetectionModelVersion'] if attributes[:'faceDetectionModelVersion']

  raise 'You cannot provide both :faceDetectionModelVersion and :face_detection_model_version' if attributes.key?(:'faceDetectionModelVersion') && attributes.key?(:'face_detection_model_version')

  self.face_detection_model_version = attributes[:'face_detection_model_version'] if attributes[:'face_detection_model_version']

  self.errors = attributes[:'errors'] if attributes[:'errors']
end

Instance Attribute Details

#detected_facesArray<OCI::AiVision::Models::Face>

The detected faces.

Returns:



28
29
30
# File 'lib/oci/ai_vision/models/analyze_image_result.rb', line 28

def detected_faces
  @detected_faces
end

#errorsArray<OCI::AiVision::Models::ProcessingError>

The errors encountered during image analysis.



48
49
50
# File 'lib/oci/ai_vision/models/analyze_image_result.rb', line 48

def errors
  @errors
end

#face_detection_model_versionString

The face detection model version.

Returns:

  • (String)


44
45
46
# File 'lib/oci/ai_vision/models/analyze_image_result.rb', line 44

def face_detection_model_version
  @face_detection_model_version
end

#image_classification_model_versionString

The image classification model version.

Returns:

  • (String)


32
33
34
# File 'lib/oci/ai_vision/models/analyze_image_result.rb', line 32

def image_classification_model_version
  @image_classification_model_version
end

#image_objectsArray<OCI::AiVision::Models::ImageObject>

The detected objects.



13
14
15
# File 'lib/oci/ai_vision/models/analyze_image_result.rb', line 13

def image_objects
  @image_objects
end

#image_textOCI::AiVision::Models::ImageText



24
25
26
# File 'lib/oci/ai_vision/models/analyze_image_result.rb', line 24

def image_text
  @image_text
end

#labelsArray<OCI::AiVision::Models::Label>

The image classification labels.

Returns:



17
18
19
# File 'lib/oci/ai_vision/models/analyze_image_result.rb', line 17

def labels
  @labels
end

#object_detection_model_versionString

The object detection model version.

Returns:

  • (String)


36
37
38
# File 'lib/oci/ai_vision/models/analyze_image_result.rb', line 36

def object_detection_model_version
  @object_detection_model_version
end

#ontology_classesArray<OCI::AiVision::Models::OntologyClass>

The ontologyClasses of image labels.



21
22
23
# File 'lib/oci/ai_vision/models/analyze_image_result.rb', line 21

def ontology_classes
  @ontology_classes
end

#text_detection_model_versionString

The text detection model version.

Returns:

  • (String)


40
41
42
# File 'lib/oci/ai_vision/models/analyze_image_result.rb', line 40

def text_detection_model_version
  @text_detection_model_version
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/oci/ai_vision/models/analyze_image_result.rb', line 51

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'image_objects': :'imageObjects',
    'labels': :'labels',
    'ontology_classes': :'ontologyClasses',
    'image_text': :'imageText',
    'detected_faces': :'detectedFaces',
    'image_classification_model_version': :'imageClassificationModelVersion',
    'object_detection_model_version': :'objectDetectionModelVersion',
    'text_detection_model_version': :'textDetectionModelVersion',
    'face_detection_model_version': :'faceDetectionModelVersion',
    'errors': :'errors'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/oci/ai_vision/models/analyze_image_result.rb', line 69

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'image_objects': :'Array<OCI::AiVision::Models::ImageObject>',
    'labels': :'Array<OCI::AiVision::Models::Label>',
    'ontology_classes': :'Array<OCI::AiVision::Models::OntologyClass>',
    'image_text': :'OCI::AiVision::Models::ImageText',
    'detected_faces': :'Array<OCI::AiVision::Models::Face>',
    'image_classification_model_version': :'String',
    'object_detection_model_version': :'String',
    'text_detection_model_version': :'String',
    'face_detection_model_version': :'String',
    'errors': :'Array<OCI::AiVision::Models::ProcessingError>'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/oci/ai_vision/models/analyze_image_result.rb', line 168

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    image_objects == other.image_objects &&
    labels == other.labels &&
    ontology_classes == other.ontology_classes &&
    image_text == other.image_text &&
    detected_faces == other.detected_faces &&
    image_classification_model_version == other.image_classification_model_version &&
    object_detection_model_version == other.object_detection_model_version &&
    text_detection_model_version == other.text_detection_model_version &&
    face_detection_model_version == other.face_detection_model_version &&
    errors == other.errors
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# File 'lib/oci/ai_vision/models/analyze_image_result.rb', line 207

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


187
188
189
# File 'lib/oci/ai_vision/models/analyze_image_result.rb', line 187

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



196
197
198
# File 'lib/oci/ai_vision/models/analyze_image_result.rb', line 196

def hash
  [image_objects, labels, ontology_classes, image_text, detected_faces, image_classification_model_version, object_detection_model_version, text_detection_model_version, face_detection_model_version, errors].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



240
241
242
243
244
245
246
247
248
249
# File 'lib/oci/ai_vision/models/analyze_image_result.rb', line 240

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



234
235
236
# File 'lib/oci/ai_vision/models/analyze_image_result.rb', line 234

def to_s
  to_hash.to_s
end