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):



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
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
# File 'lib/oci/ai_vision/models/analyze_image_result.rb', line 87

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.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.errors = attributes[:'errors'] if attributes[:'errors']
end

Instance Attribute Details

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

The errors encountered during image analysis.



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

def errors
  @errors
end

#image_classification_model_versionString

The image classification model version.

Returns:

  • (String)


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

def image_classification_model_version
  @image_classification_model_version
end

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

The detected objects.



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

def image_objects
  @image_objects
end

#image_textOCI::AiVision::Models::ImageText



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

def image_text
  @image_text
end

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

The image classification labels.

Returns:



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

def labels
  @labels
end

#object_detection_model_versionString

The object detection model version.

Returns:

  • (String)


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

def object_detection_model_version
  @object_detection_model_version
end

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

The ontologyClasses of image labels.



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

def ontology_classes
  @ontology_classes
end

#text_detection_model_versionString

The text detection model version.

Returns:

  • (String)


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

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.



42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/oci/ai_vision/models/analyze_image_result.rb', line 42

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

.swagger_typesObject

Attribute type mapping.



58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/oci/ai_vision/models/analyze_image_result.rb', line 58

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',
    'image_classification_model_version': :'String',
    'object_detection_model_version': :'String',
    'text_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



141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/oci/ai_vision/models/analyze_image_result.rb', line 141

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 &&
    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 &&
    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



178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/oci/ai_vision/models/analyze_image_result.rb', line 178

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


158
159
160
# File 'lib/oci/ai_vision/models/analyze_image_result.rb', line 158

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



167
168
169
# File 'lib/oci/ai_vision/models/analyze_image_result.rb', line 167

def hash
  [image_objects, labels, ontology_classes, image_text, image_classification_model_version, object_detection_model_version, text_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



211
212
213
214
215
216
217
218
219
220
# File 'lib/oci/ai_vision/models/analyze_image_result.rb', line 211

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



205
206
207
# File 'lib/oci/ai_vision/models/analyze_image_result.rb', line 205

def to_s
  to_hash.to_s
end