-
Notifications
You must be signed in to change notification settings - Fork 821
/
models.go
551 lines (493 loc) · 20.8 KB
/
models.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
package computervision
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"encoding/json"
"github.com/Azure/go-autorest/autorest"
"io"
)
// AzureRegions enumerates the values for azure regions.
type AzureRegions string
const (
// Australiaeast ...
Australiaeast AzureRegions = "australiaeast"
// Brazilsouth ...
Brazilsouth AzureRegions = "brazilsouth"
// Eastasia ...
Eastasia AzureRegions = "eastasia"
// Eastus ...
Eastus AzureRegions = "eastus"
// Eastus2 ...
Eastus2 AzureRegions = "eastus2"
// Northeurope ...
Northeurope AzureRegions = "northeurope"
// Southcentralus ...
Southcentralus AzureRegions = "southcentralus"
// Southeastasia ...
Southeastasia AzureRegions = "southeastasia"
// Westcentralus ...
Westcentralus AzureRegions = "westcentralus"
// Westeurope ...
Westeurope AzureRegions = "westeurope"
// Westus ...
Westus AzureRegions = "westus"
// Westus2 ...
Westus2 AzureRegions = "westus2"
)
// PossibleAzureRegionsValues returns an array of possible values for the AzureRegions const type.
func PossibleAzureRegionsValues() []AzureRegions {
return []AzureRegions{Australiaeast, Brazilsouth, Eastasia, Eastus, Eastus2, Northeurope, Southcentralus, Southeastasia, Westcentralus, Westeurope, Westus, Westus2}
}
// Details enumerates the values for details.
type Details string
const (
// Celebrities ...
Celebrities Details = "Celebrities"
// Landmarks ...
Landmarks Details = "Landmarks"
)
// PossibleDetailsValues returns an array of possible values for the Details const type.
func PossibleDetailsValues() []Details {
return []Details{Celebrities, Landmarks}
}
// ErrorCodes enumerates the values for error codes.
type ErrorCodes string
const (
// BadArgument ...
BadArgument ErrorCodes = "BadArgument"
// FailedToProcess ...
FailedToProcess ErrorCodes = "FailedToProcess"
// InternalServerError ...
InternalServerError ErrorCodes = "InternalServerError"
// InvalidDetails ...
InvalidDetails ErrorCodes = "InvalidDetails"
// InvalidImageFormat ...
InvalidImageFormat ErrorCodes = "InvalidImageFormat"
// InvalidImageSize ...
InvalidImageSize ErrorCodes = "InvalidImageSize"
// InvalidImageURL ...
InvalidImageURL ErrorCodes = "InvalidImageUrl"
// NotSupportedImage ...
NotSupportedImage ErrorCodes = "NotSupportedImage"
// NotSupportedLanguage ...
NotSupportedLanguage ErrorCodes = "NotSupportedLanguage"
// NotSupportedVisualFeature ...
NotSupportedVisualFeature ErrorCodes = "NotSupportedVisualFeature"
// StorageException ...
StorageException ErrorCodes = "StorageException"
// Timeout ...
Timeout ErrorCodes = "Timeout"
// Unspecified ...
Unspecified ErrorCodes = "Unspecified"
)
// PossibleErrorCodesValues returns an array of possible values for the ErrorCodes const type.
func PossibleErrorCodesValues() []ErrorCodes {
return []ErrorCodes{BadArgument, FailedToProcess, InternalServerError, InvalidDetails, InvalidImageFormat, InvalidImageSize, InvalidImageURL, NotSupportedImage, NotSupportedLanguage, NotSupportedVisualFeature, StorageException, Timeout, Unspecified}
}
// Gender enumerates the values for gender.
type Gender string
const (
// Female ...
Female Gender = "Female"
// Male ...
Male Gender = "Male"
)
// PossibleGenderValues returns an array of possible values for the Gender const type.
func PossibleGenderValues() []Gender {
return []Gender{Female, Male}
}
// OcrLanguages enumerates the values for ocr languages.
type OcrLanguages string
const (
// Ar ...
Ar OcrLanguages = "ar"
// Cs ...
Cs OcrLanguages = "cs"
// Da ...
Da OcrLanguages = "da"
// De ...
De OcrLanguages = "de"
// El ...
El OcrLanguages = "el"
// En ...
En OcrLanguages = "en"
// Es ...
Es OcrLanguages = "es"
// Fi ...
Fi OcrLanguages = "fi"
// Fr ...
Fr OcrLanguages = "fr"
// Hu ...
Hu OcrLanguages = "hu"
// It ...
It OcrLanguages = "it"
// Ja ...
Ja OcrLanguages = "ja"
// Ko ...
Ko OcrLanguages = "ko"
// Nb ...
Nb OcrLanguages = "nb"
// Nl ...
Nl OcrLanguages = "nl"
// Pl ...
Pl OcrLanguages = "pl"
// Pt ...
Pt OcrLanguages = "pt"
// Ro ...
Ro OcrLanguages = "ro"
// Ru ...
Ru OcrLanguages = "ru"
// Sk ...
Sk OcrLanguages = "sk"
// SrCyrl ...
SrCyrl OcrLanguages = "sr-Cyrl"
// SrLatn ...
SrLatn OcrLanguages = "sr-Latn"
// Sv ...
Sv OcrLanguages = "sv"
// Tr ...
Tr OcrLanguages = "tr"
// Unk ...
Unk OcrLanguages = "unk"
// ZhHans ...
ZhHans OcrLanguages = "zh-Hans"
// ZhHant ...
ZhHant OcrLanguages = "zh-Hant"
)
// PossibleOcrLanguagesValues returns an array of possible values for the OcrLanguages const type.
func PossibleOcrLanguagesValues() []OcrLanguages {
return []OcrLanguages{Ar, Cs, Da, De, El, En, Es, Fi, Fr, Hu, It, Ja, Ko, Nb, Nl, Pl, Pt, Ro, Ru, Sk, SrCyrl, SrLatn, Sv, Tr, Unk, ZhHans, ZhHant}
}
// TextOperationStatusCodes enumerates the values for text operation status codes.
type TextOperationStatusCodes string
const (
// Failed ...
Failed TextOperationStatusCodes = "Failed"
// NotStarted ...
NotStarted TextOperationStatusCodes = "Not Started"
// Running ...
Running TextOperationStatusCodes = "Running"
// Succeeded ...
Succeeded TextOperationStatusCodes = "Succeeded"
)
// PossibleTextOperationStatusCodesValues returns an array of possible values for the TextOperationStatusCodes const type.
func PossibleTextOperationStatusCodesValues() []TextOperationStatusCodes {
return []TextOperationStatusCodes{Failed, NotStarted, Running, Succeeded}
}
// VisualFeatureTypes enumerates the values for visual feature types.
type VisualFeatureTypes string
const (
// VisualFeatureTypesAdult ...
VisualFeatureTypesAdult VisualFeatureTypes = "Adult"
// VisualFeatureTypesCategories ...
VisualFeatureTypesCategories VisualFeatureTypes = "Categories"
// VisualFeatureTypesColor ...
VisualFeatureTypesColor VisualFeatureTypes = "Color"
// VisualFeatureTypesDescription ...
VisualFeatureTypesDescription VisualFeatureTypes = "Description"
// VisualFeatureTypesFaces ...
VisualFeatureTypesFaces VisualFeatureTypes = "Faces"
// VisualFeatureTypesImageType ...
VisualFeatureTypesImageType VisualFeatureTypes = "ImageType"
// VisualFeatureTypesTags ...
VisualFeatureTypesTags VisualFeatureTypes = "Tags"
)
// PossibleVisualFeatureTypesValues returns an array of possible values for the VisualFeatureTypes const type.
func PossibleVisualFeatureTypesValues() []VisualFeatureTypes {
return []VisualFeatureTypes{VisualFeatureTypesAdult, VisualFeatureTypesCategories, VisualFeatureTypesColor, VisualFeatureTypesDescription, VisualFeatureTypesFaces, VisualFeatureTypesImageType, VisualFeatureTypesTags}
}
// AdultInfo an object describing whether the image contains adult-oriented content and/or is racy.
type AdultInfo struct {
// IsAdultContent - A value indicating if the image contains adult-oriented content.
IsAdultContent *bool `json:"isAdultContent,omitempty"`
// IsRacyContent - A value indicating if the image is race.
IsRacyContent *bool `json:"isRacyContent,omitempty"`
// AdultScore - Score from 0 to 1 that indicates how much of adult content is within the image.
AdultScore *float64 `json:"adultScore,omitempty"`
// RacyScore - Score from 0 to 1 that indicates how suggestive is the image.
RacyScore *float64 `json:"racyScore,omitempty"`
}
// Category an object describing identified category.
type Category struct {
// Name - Name of the category.
Name *string `json:"name,omitempty"`
// Score - Scoring of the category.
Score *float64 `json:"score,omitempty"`
Detail *CategoryDetail `json:"detail,omitempty"`
}
// CategoryDetail an object describing additional category details.
type CategoryDetail struct {
// Celebrities - An array of celebrities if any identified.
Celebrities *[]CelebritiesModel `json:"celebrities,omitempty"`
}
// CelebritiesModel an object describing possible celebrity identification.
type CelebritiesModel struct {
// Name - Name of the celebrity.
Name *string `json:"name,omitempty"`
// Confidence - Level of confidence ranging from 0 to 1.
Confidence *float64 `json:"confidence,omitempty"`
FaceRectangle *FaceRectangle `json:"faceRectangle,omitempty"`
}
// CelebrityResults list of celebrities recognized in the image.
type CelebrityResults struct {
Celebrities *[]CelebritiesModel `json:"celebrities,omitempty"`
// RequestID - Id of the REST API request.
RequestID *string `json:"requestId,omitempty"`
Metadata *ImageMetadata `json:"metadata,omitempty"`
}
// ColorInfo an object providing additional metadata describing color attributes.
type ColorInfo struct {
// DominantColorForeground - Possible dominant foreground color.
DominantColorForeground *string `json:"dominantColorForeground,omitempty"`
// DominantColorBackground - Possible dominant background color.
DominantColorBackground *string `json:"dominantColorBackground,omitempty"`
// DominantColors - An array of possible dominant colors.
DominantColors *[]string `json:"dominantColors,omitempty"`
// AccentColor - Possible accent color.
AccentColor *string `json:"accentColor,omitempty"`
// IsBWImg - A value indicating if the image is black and white.
IsBWImg *bool `json:"isBWImg,omitempty"`
}
// DomainModelResults result of image analysis using a specific domain model including additional metadata.
type DomainModelResults struct {
autorest.Response `json:"-"`
// Result - Model-specific response
Result interface{} `json:"result,omitempty"`
// RequestID - Id of the REST API request.
RequestID *string `json:"requestId,omitempty"`
Metadata *ImageMetadata `json:"metadata,omitempty"`
}
// Error ...
type Error struct {
// Code - The error code. Possible values include: 'InvalidImageURL', 'InvalidImageFormat', 'InvalidImageSize', 'NotSupportedVisualFeature', 'NotSupportedImage', 'InvalidDetails', 'NotSupportedLanguage', 'BadArgument', 'FailedToProcess', 'Timeout', 'InternalServerError', 'Unspecified', 'StorageException'
Code ErrorCodes `json:"code,omitempty"`
// Message - A message explaining the error reported by the service.
Message *string `json:"message,omitempty"`
// RequestID - A unique request identifier.
RequestID *string `json:"requestId,omitempty"`
}
// FaceDescription an object describing a face identified in the image.
type FaceDescription struct {
// Age - Possible age of the face.
Age *int32 `json:"age,omitempty"`
// Gender - Possible gender of the face. Possible values include: 'Male', 'Female'
Gender Gender `json:"gender,omitempty"`
FaceRectangle *FaceRectangle `json:"faceRectangle,omitempty"`
}
// FaceRectangle an object describing face rectangle.
type FaceRectangle struct {
// Left - X-coordinate of the top left point of the face.
Left *int32 `json:"left,omitempty"`
// Top - Y-coordinate of the top left point of the face.
Top *int32 `json:"top,omitempty"`
// Width - Width measured from the top-left point of the face.
Width *int32 `json:"width,omitempty"`
// Height - Height measured from the top-left point of the face.
Height *int32 `json:"height,omitempty"`
}
// ImageAnalysis result of AnalyzeImage operation.
type ImageAnalysis struct {
autorest.Response `json:"-"`
// Categories - An array indicating identified categories.
Categories *[]Category `json:"categories,omitempty"`
Adult *AdultInfo `json:"adult,omitempty"`
Color *ColorInfo `json:"color,omitempty"`
ImageType *ImageType `json:"imageType,omitempty"`
// Tags - A list of tags with confidence level.
Tags *[]ImageTag `json:"tags,omitempty"`
Description *ImageDescriptionDetails `json:"description,omitempty"`
// Faces - An array of possible faces within the image.
Faces *[]FaceDescription `json:"faces,omitempty"`
// RequestID - Id of the request for tracking purposes.
RequestID *string `json:"requestId,omitempty"`
Metadata *ImageMetadata `json:"metadata,omitempty"`
}
// ImageCaption an image caption, i.e. a brief description of what the image depicts.
type ImageCaption struct {
// Text - The text of the caption
Text *string `json:"text,omitempty"`
// Confidence - The level of confidence the service has in the caption
Confidence *float64 `json:"confidence,omitempty"`
}
// ImageDescription a collection of content tags, along with a list of captions sorted by confidence level, and
// image metadata.
type ImageDescription struct {
autorest.Response `json:"-"`
*ImageDescriptionDetails `json:"description,omitempty"`
}
// MarshalJSON is the custom marshaler for ImageDescription.
func (ID ImageDescription) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if ID.ImageDescriptionDetails != nil {
objectMap["description"] = ID.ImageDescriptionDetails
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for ImageDescription struct.
func (ID *ImageDescription) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
for k, v := range m {
switch k {
case "description":
if v != nil {
var imageDescriptionDetails ImageDescriptionDetails
err = json.Unmarshal(*v, &imageDescriptionDetails)
if err != nil {
return err
}
ID.ImageDescriptionDetails = &imageDescriptionDetails
}
}
}
return nil
}
// ImageDescriptionDetails a collection of content tags, along with a list of captions sorted by confidence level,
// and image metadata.
type ImageDescriptionDetails struct {
// Tags - A collection of image tags.
Tags *[]string `json:"tags,omitempty"`
// Captions - A list of captions, sorted by confidence level.
Captions *[]ImageCaption `json:"captions,omitempty"`
// RequestID - Id of the REST API request.
RequestID *string `json:"requestId,omitempty"`
Metadata *ImageMetadata `json:"metadata,omitempty"`
}
// ImageMetadata image metadata
type ImageMetadata struct {
// Width - Image width
Width *int32 `json:"width,omitempty"`
// Height - Image height
Height *int32 `json:"height,omitempty"`
// Format - Image format
Format *string `json:"format,omitempty"`
}
// ImageTag an image caption, i.e. a brief description of what the image depicts.
type ImageTag struct {
// Name - The tag value
Name *string `json:"name,omitempty"`
// Confidence - The level of confidence the service has in the caption
Confidence *float64 `json:"confidence,omitempty"`
}
// ImageType an object providing possible image types and matching confidence levels.
type ImageType struct {
// ClipArtType - Confidence level that the image is a clip art.
ClipArtType *float64 `json:"clipArtType,omitempty"`
// LineDrawingType - Confidence level that the image is a line drawing.
LineDrawingType *float64 `json:"lineDrawingType,omitempty"`
}
// ImageURL ...
type ImageURL struct {
// URL - Publicly reachable URL of an image
URL *string `json:"url,omitempty"`
}
// LandmarkResults list of landmarks recognized in the image.
type LandmarkResults struct {
Landmarks *[]LandmarkResultsLandmarksItem `json:"landmarks,omitempty"`
// RequestID - Id of the REST API request.
RequestID *string `json:"requestId,omitempty"`
Metadata *ImageMetadata `json:"metadata,omitempty"`
}
// LandmarkResultsLandmarksItem a landmark recognized in the image
type LandmarkResultsLandmarksItem struct {
// Name - Name of the landmark.
Name *string `json:"name,omitempty"`
// Confidence - Confidence level for the landmark recognition.
Confidence *float64 `json:"confidence,omitempty"`
}
// Line ...
type Line struct {
BoundingBox *[]int32 `json:"boundingBox,omitempty"`
Text *string `json:"text,omitempty"`
Words *[]Word `json:"words,omitempty"`
}
// ListModelsResult result of the List Domain Models operation.
type ListModelsResult struct {
autorest.Response `json:"-"`
// ModelsProperty - An array of supported models.
ModelsProperty *[]ModelDescription `json:"models,omitempty"`
}
// ModelDescription an object describing supported model by name and categories.
type ModelDescription struct {
Name *string `json:"name,omitempty"`
Categories *[]string `json:"categories,omitempty"`
}
// OcrLine an object describing a single recognized line of text.
type OcrLine struct {
// BoundingBox - Bounding box of a recognized line. The four integers represent the x-coordinate of the left edge, the y-coordinate of the top edge, width, and height of the bounding box, in the coordinate system of the input image, after it has been rotated around its center according to the detected text angle (see textAngle property), with the origin at the top-left corner, and the y-axis pointing down.
BoundingBox *string `json:"boundingBox,omitempty"`
// Words - An array of objects, where each object represents a recognized word.
Words *[]OcrWord `json:"words,omitempty"`
}
// OcrRegion a region consists of multiple lines (e.g. a column of text in a multi-column document).
type OcrRegion struct {
// BoundingBox - Bounding box of a recognized region. The four integers represent the x-coordinate of the left edge, the y-coordinate of the top edge, width, and height of the bounding box, in the coordinate system of the input image, after it has been rotated around its center according to the detected text angle (see textAngle property), with the origin at the top-left corner, and the y-axis pointing down.
BoundingBox *string `json:"boundingBox,omitempty"`
Lines *[]OcrLine `json:"lines,omitempty"`
}
// OcrResult ...
type OcrResult struct {
autorest.Response `json:"-"`
// Language - The BCP-47 language code of the text in the image.
Language *string `json:"language,omitempty"`
// TextAngle - The angle, in degrees, of the detected text with respect to the closest horizontal or vertical direction. After rotating the input image clockwise by this angle, the recognized text lines become horizontal or vertical. In combination with the orientation property it can be used to overlay recognition results correctly on the original image, by rotating either the original image or recognition results by a suitable angle around the center of the original image. If the angle cannot be confidently detected, this property is not present. If the image contains text at different angles, only part of the text will be recognized correctly.
TextAngle *float64 `json:"textAngle,omitempty"`
// Orientation - Orientation of the text recognized in the image. The value (up,down,left, or right) refers to the direction that the top of the recognized text is facing, after the image has been rotated around its center according to the detected text angle (see textAngle property).
Orientation *string `json:"orientation,omitempty"`
// Regions - An array of objects, where each object represents a region of recognized text.
Regions *[]OcrRegion `json:"regions,omitempty"`
}
// OcrWord information on a recognized word.
type OcrWord struct {
// BoundingBox - Bounding box of a recognized word. The four integers represent the x-coordinate of the left edge, the y-coordinate of the top edge, width, and height of the bounding box, in the coordinate system of the input image, after it has been rotated around its center according to the detected text angle (see textAngle property), with the origin at the top-left corner, and the y-axis pointing down.
BoundingBox *string `json:"boundingBox,omitempty"`
// Text - String value of a recognized word.
Text *string `json:"text,omitempty"`
}
// ReadCloser ...
type ReadCloser struct {
autorest.Response `json:"-"`
Value *io.ReadCloser `json:"value,omitempty"`
}
// RecognitionResult ...
type RecognitionResult struct {
Lines *[]Line `json:"lines,omitempty"`
}
// TagResult the results of a image tag operation, including any tags and image metadata.
type TagResult struct {
autorest.Response `json:"-"`
// Tags - A list of tags with confidence level.
Tags *[]ImageTag `json:"tags,omitempty"`
// RequestID - Id of the REST API request.
RequestID *string `json:"requestId,omitempty"`
Metadata *ImageMetadata `json:"metadata,omitempty"`
}
// TextOperationResult ...
type TextOperationResult struct {
autorest.Response `json:"-"`
// Status - Status of the text operation. Possible values include: 'NotStarted', 'Running', 'Failed', 'Succeeded'
Status TextOperationStatusCodes `json:"status,omitempty"`
RecognitionResult *RecognitionResult `json:"recognitionResult,omitempty"`
}
// Word ...
type Word struct {
BoundingBox *[]int32 `json:"boundingBox,omitempty"`
Text *string `json:"text,omitempty"`
}