1 package training
2
3
4
5
6
7
8
9 import (
10 "encoding/json"
11 "github.com/Azure/go-autorest/autorest"
12 "github.com/Azure/go-autorest/autorest/date"
13 "github.com/gofrs/uuid"
14 )
15
16
17 const fqdn = "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v2.1/customvision/training"
18
19
20 type BoundingBox struct {
21 Left *float64 `json:"left,omitempty"`
22 Top *float64 `json:"top,omitempty"`
23 Width *float64 `json:"width,omitempty"`
24 Height *float64 `json:"height,omitempty"`
25 }
26
27
28 type Domain struct {
29 autorest.Response `json:"-"`
30
31 ID *uuid.UUID `json:"id,omitempty"`
32
33 Name *string `json:"name,omitempty"`
34
35 Type DomainType `json:"type,omitempty"`
36
37 Exportable *bool `json:"exportable,omitempty"`
38
39 Enabled *bool `json:"enabled,omitempty"`
40 }
41
42
43 func (d Domain) MarshalJSON() ([]byte, error) {
44 objectMap := make(map[string]interface{})
45 return json.Marshal(objectMap)
46 }
47
48
49 type Export struct {
50 autorest.Response `json:"-"`
51
52 Platform ExportPlatform `json:"platform,omitempty"`
53
54 Status ExportStatusModel `json:"status,omitempty"`
55
56 DownloadURI *string `json:"downloadUri,omitempty"`
57
58 Flavor ExportFlavor `json:"flavor,omitempty"`
59
60 NewerVersionAvailable *bool `json:"newerVersionAvailable,omitempty"`
61 }
62
63
64 func (e Export) MarshalJSON() ([]byte, error) {
65 objectMap := make(map[string]interface{})
66 return json.Marshal(objectMap)
67 }
68
69
70 type Image struct {
71
72 ID *uuid.UUID `json:"id,omitempty"`
73
74 Created *date.Time `json:"created,omitempty"`
75
76 Width *int32 `json:"width,omitempty"`
77
78 Height *int32 `json:"height,omitempty"`
79
80 ImageURI *string `json:"imageUri,omitempty"`
81
82 ThumbnailURI *string `json:"thumbnailUri,omitempty"`
83
84 Tags *[]ImageTag `json:"tags,omitempty"`
85
86 Regions *[]ImageRegion `json:"regions,omitempty"`
87 }
88
89
90 func (i Image) MarshalJSON() ([]byte, error) {
91 objectMap := make(map[string]interface{})
92 return json.Marshal(objectMap)
93 }
94
95
96 type ImageCreateResult struct {
97
98 SourceURL *string `json:"sourceUrl,omitempty"`
99
100 Status ImageUploadStatus `json:"status,omitempty"`
101
102 Image *Image `json:"image,omitempty"`
103 }
104
105
106 func (icr ImageCreateResult) MarshalJSON() ([]byte, error) {
107 objectMap := make(map[string]interface{})
108 return json.Marshal(objectMap)
109 }
110
111
112 type ImageCreateSummary struct {
113 autorest.Response `json:"-"`
114
115 IsBatchSuccessful *bool `json:"isBatchSuccessful,omitempty"`
116
117 Images *[]ImageCreateResult `json:"images,omitempty"`
118 }
119
120
121 func (ics ImageCreateSummary) MarshalJSON() ([]byte, error) {
122 objectMap := make(map[string]interface{})
123 return json.Marshal(objectMap)
124 }
125
126
127 type ImageFileCreateBatch struct {
128 Images *[]ImageFileCreateEntry `json:"images,omitempty"`
129 TagIds *[]uuid.UUID `json:"tagIds,omitempty"`
130 }
131
132
133 type ImageFileCreateEntry struct {
134 Name *string `json:"name,omitempty"`
135 Contents *[]byte `json:"contents,omitempty"`
136 TagIds *[]uuid.UUID `json:"tagIds,omitempty"`
137 Regions *[]Region `json:"regions,omitempty"`
138 }
139
140
141 type ImageIDCreateBatch struct {
142 Images *[]ImageIDCreateEntry `json:"images,omitempty"`
143 TagIds *[]uuid.UUID `json:"tagIds,omitempty"`
144 }
145
146
147 type ImageIDCreateEntry struct {
148 ID *uuid.UUID `json:"id,omitempty"`
149 TagIds *[]uuid.UUID `json:"tagIds,omitempty"`
150 Regions *[]Region `json:"regions,omitempty"`
151 }
152
153
154 type ImagePerformance struct {
155
156 Predictions *[]Prediction `json:"predictions,omitempty"`
157
158 ID *uuid.UUID `json:"id,omitempty"`
159
160 Created *date.Time `json:"created,omitempty"`
161
162 Width *int32 `json:"width,omitempty"`
163
164 Height *int32 `json:"height,omitempty"`
165
166 ImageURI *string `json:"imageUri,omitempty"`
167
168 ThumbnailURI *string `json:"thumbnailUri,omitempty"`
169
170 Tags *[]ImageTag `json:"tags,omitempty"`
171
172 Regions *[]ImageRegion `json:"regions,omitempty"`
173 }
174
175
176 func (IP ImagePerformance) MarshalJSON() ([]byte, error) {
177 objectMap := make(map[string]interface{})
178 return json.Marshal(objectMap)
179 }
180
181
182 type ImagePrediction struct {
183 autorest.Response `json:"-"`
184
185 ID *uuid.UUID `json:"id,omitempty"`
186
187 Project *uuid.UUID `json:"project,omitempty"`
188
189 Iteration *uuid.UUID `json:"iteration,omitempty"`
190
191 Created *date.Time `json:"created,omitempty"`
192
193 Predictions *[]Prediction `json:"predictions,omitempty"`
194 }
195
196
197 func (IP ImagePrediction) MarshalJSON() ([]byte, error) {
198 objectMap := make(map[string]interface{})
199 return json.Marshal(objectMap)
200 }
201
202
203 type ImageRegion struct {
204
205 RegionID *uuid.UUID `json:"regionId,omitempty"`
206
207 TagName *string `json:"tagName,omitempty"`
208
209 Created *date.Time `json:"created,omitempty"`
210 TagID *uuid.UUID `json:"tagId,omitempty"`
211 Left *float64 `json:"left,omitempty"`
212 Top *float64 `json:"top,omitempty"`
213 Width *float64 `json:"width,omitempty"`
214 Height *float64 `json:"height,omitempty"`
215 }
216
217
218 func (ir ImageRegion) MarshalJSON() ([]byte, error) {
219 objectMap := make(map[string]interface{})
220 if ir.TagID != nil {
221 objectMap["tagId"] = ir.TagID
222 }
223 if ir.Left != nil {
224 objectMap["left"] = ir.Left
225 }
226 if ir.Top != nil {
227 objectMap["top"] = ir.Top
228 }
229 if ir.Width != nil {
230 objectMap["width"] = ir.Width
231 }
232 if ir.Height != nil {
233 objectMap["height"] = ir.Height
234 }
235 return json.Marshal(objectMap)
236 }
237
238
239 type ImageRegionCreateBatch struct {
240 Regions *[]ImageRegionCreateEntry `json:"regions,omitempty"`
241 }
242
243
244 type ImageRegionCreateEntry struct {
245 ImageID *uuid.UUID `json:"imageId,omitempty"`
246 TagID *uuid.UUID `json:"tagId,omitempty"`
247 Left *float64 `json:"left,omitempty"`
248 Top *float64 `json:"top,omitempty"`
249 Width *float64 `json:"width,omitempty"`
250 Height *float64 `json:"height,omitempty"`
251 }
252
253
254 type ImageRegionCreateResult struct {
255
256 ImageID *uuid.UUID `json:"imageId,omitempty"`
257
258 RegionID *uuid.UUID `json:"regionId,omitempty"`
259
260 TagName *string `json:"tagName,omitempty"`
261
262 Created *date.Time `json:"created,omitempty"`
263 TagID *uuid.UUID `json:"tagId,omitempty"`
264 Left *float64 `json:"left,omitempty"`
265 Top *float64 `json:"top,omitempty"`
266 Width *float64 `json:"width,omitempty"`
267 Height *float64 `json:"height,omitempty"`
268 }
269
270
271 func (ircr ImageRegionCreateResult) MarshalJSON() ([]byte, error) {
272 objectMap := make(map[string]interface{})
273 if ircr.TagID != nil {
274 objectMap["tagId"] = ircr.TagID
275 }
276 if ircr.Left != nil {
277 objectMap["left"] = ircr.Left
278 }
279 if ircr.Top != nil {
280 objectMap["top"] = ircr.Top
281 }
282 if ircr.Width != nil {
283 objectMap["width"] = ircr.Width
284 }
285 if ircr.Height != nil {
286 objectMap["height"] = ircr.Height
287 }
288 return json.Marshal(objectMap)
289 }
290
291
292 type ImageRegionCreateSummary struct {
293 autorest.Response `json:"-"`
294 Created *[]ImageRegionCreateResult `json:"created,omitempty"`
295 Duplicated *[]ImageRegionCreateEntry `json:"duplicated,omitempty"`
296 Exceeded *[]ImageRegionCreateEntry `json:"exceeded,omitempty"`
297 }
298
299
300 type ImageRegionProposal struct {
301 autorest.Response `json:"-"`
302
303 ProjectID *uuid.UUID `json:"projectId,omitempty"`
304
305 ImageID *uuid.UUID `json:"imageId,omitempty"`
306
307 Proposals *[]RegionProposal `json:"proposals,omitempty"`
308 }
309
310
311 func (irp ImageRegionProposal) MarshalJSON() ([]byte, error) {
312 objectMap := make(map[string]interface{})
313 return json.Marshal(objectMap)
314 }
315
316
317 type ImageTag struct {
318
319 TagID *uuid.UUID `json:"tagId,omitempty"`
320
321 TagName *string `json:"tagName,omitempty"`
322
323 Created *date.Time `json:"created,omitempty"`
324 }
325
326
327 func (it ImageTag) MarshalJSON() ([]byte, error) {
328 objectMap := make(map[string]interface{})
329 return json.Marshal(objectMap)
330 }
331
332
333 type ImageTagCreateBatch struct {
334 Tags *[]ImageTagCreateEntry `json:"tags,omitempty"`
335 }
336
337
338 type ImageTagCreateEntry struct {
339 ImageID *uuid.UUID `json:"imageId,omitempty"`
340 TagID *uuid.UUID `json:"tagId,omitempty"`
341 }
342
343
344 type ImageTagCreateSummary struct {
345 autorest.Response `json:"-"`
346 Created *[]ImageTagCreateEntry `json:"created,omitempty"`
347 Duplicated *[]ImageTagCreateEntry `json:"duplicated,omitempty"`
348 Exceeded *[]ImageTagCreateEntry `json:"exceeded,omitempty"`
349 }
350
351
352 type ImageURL struct {
353 URL *string `json:"url,omitempty"`
354 }
355
356
357 type ImageURLCreateBatch struct {
358 Images *[]ImageURLCreateEntry `json:"images,omitempty"`
359 TagIds *[]uuid.UUID `json:"tagIds,omitempty"`
360 }
361
362
363 type ImageURLCreateEntry struct {
364 URL *string `json:"url,omitempty"`
365 TagIds *[]uuid.UUID `json:"tagIds,omitempty"`
366 Regions *[]Region `json:"regions,omitempty"`
367 }
368
369
370 type Int32 struct {
371 autorest.Response `json:"-"`
372 Value *int32 `json:"value,omitempty"`
373 }
374
375
376 type Iteration struct {
377 autorest.Response `json:"-"`
378
379 ID *uuid.UUID `json:"id,omitempty"`
380
381 Name *string `json:"name,omitempty"`
382
383 IsDefault *bool `json:"isDefault,omitempty"`
384
385 Status *string `json:"status,omitempty"`
386
387 Created *date.Time `json:"created,omitempty"`
388
389 LastModified *date.Time `json:"lastModified,omitempty"`
390
391 TrainedAt *date.Time `json:"trainedAt,omitempty"`
392
393 ProjectID *uuid.UUID `json:"projectId,omitempty"`
394
395 Exportable *bool `json:"exportable,omitempty"`
396
397 DomainID *uuid.UUID `json:"domainId,omitempty"`
398
399 ClassificationType Classifier `json:"classificationType,omitempty"`
400 }
401
402
403 func (i Iteration) MarshalJSON() ([]byte, error) {
404 objectMap := make(map[string]interface{})
405 if i.Name != nil {
406 objectMap["name"] = i.Name
407 }
408 if i.IsDefault != nil {
409 objectMap["isDefault"] = i.IsDefault
410 }
411 return json.Marshal(objectMap)
412 }
413
414
415 type IterationPerformance struct {
416 autorest.Response `json:"-"`
417
418 PerTagPerformance *[]TagPerformance `json:"perTagPerformance,omitempty"`
419
420 Precision *float64 `json:"precision,omitempty"`
421
422 PrecisionStdDeviation *float64 `json:"precisionStdDeviation,omitempty"`
423
424 Recall *float64 `json:"recall,omitempty"`
425
426 RecallStdDeviation *float64 `json:"recallStdDeviation,omitempty"`
427
428 AveragePrecision *float64 `json:"averagePrecision,omitempty"`
429 }
430
431
432 func (IP IterationPerformance) MarshalJSON() ([]byte, error) {
433 objectMap := make(map[string]interface{})
434 return json.Marshal(objectMap)
435 }
436
437
438 type ListDomain struct {
439 autorest.Response `json:"-"`
440 Value *[]Domain `json:"value,omitempty"`
441 }
442
443
444 type ListExport struct {
445 autorest.Response `json:"-"`
446 Value *[]Export `json:"value,omitempty"`
447 }
448
449
450 type ListImage struct {
451 autorest.Response `json:"-"`
452 Value *[]Image `json:"value,omitempty"`
453 }
454
455
456 type ListImagePerformance struct {
457 autorest.Response `json:"-"`
458 Value *[]ImagePerformance `json:"value,omitempty"`
459 }
460
461
462 type ListIteration struct {
463 autorest.Response `json:"-"`
464 Value *[]Iteration `json:"value,omitempty"`
465 }
466
467
468 type ListProject struct {
469 autorest.Response `json:"-"`
470 Value *[]Project `json:"value,omitempty"`
471 }
472
473
474 type ListTag struct {
475 autorest.Response `json:"-"`
476 Value *[]Tag `json:"value,omitempty"`
477 }
478
479
480 type Prediction struct {
481
482 Probability *float64 `json:"probability,omitempty"`
483
484 TagID *uuid.UUID `json:"tagId,omitempty"`
485
486 TagName *string `json:"tagName,omitempty"`
487
488 BoundingBox *BoundingBox `json:"boundingBox,omitempty"`
489 }
490
491
492 func (p Prediction) MarshalJSON() ([]byte, error) {
493 objectMap := make(map[string]interface{})
494 return json.Marshal(objectMap)
495 }
496
497
498 type PredictionQueryResult struct {
499 autorest.Response `json:"-"`
500
501 Token *PredictionQueryToken `json:"token,omitempty"`
502
503 Results *[]StoredImagePrediction `json:"results,omitempty"`
504 }
505
506
507 func (pqr PredictionQueryResult) MarshalJSON() ([]byte, error) {
508 objectMap := make(map[string]interface{})
509 return json.Marshal(objectMap)
510 }
511
512
513 type PredictionQueryTag struct {
514
515 ID *uuid.UUID `json:"id,omitempty"`
516
517 MinThreshold *float64 `json:"minThreshold,omitempty"`
518
519 MaxThreshold *float64 `json:"maxThreshold,omitempty"`
520 }
521
522
523 func (pqt PredictionQueryTag) MarshalJSON() ([]byte, error) {
524 objectMap := make(map[string]interface{})
525 return json.Marshal(objectMap)
526 }
527
528
529 type PredictionQueryToken struct {
530 Session *string `json:"session,omitempty"`
531 Continuation *string `json:"continuation,omitempty"`
532 MaxCount *int32 `json:"maxCount,omitempty"`
533
534 OrderBy OrderBy `json:"orderBy,omitempty"`
535 Tags *[]PredictionQueryTag `json:"tags,omitempty"`
536 IterationID *uuid.UUID `json:"iterationId,omitempty"`
537 StartTime *date.Time `json:"startTime,omitempty"`
538 EndTime *date.Time `json:"endTime,omitempty"`
539 Application *string `json:"application,omitempty"`
540 }
541
542
543 type Project struct {
544 autorest.Response `json:"-"`
545
546 ID *uuid.UUID `json:"id,omitempty"`
547
548 Name *string `json:"name,omitempty"`
549
550 Description *string `json:"description,omitempty"`
551
552 Settings *ProjectSettings `json:"settings,omitempty"`
553
554 Created *date.Time `json:"created,omitempty"`
555
556 LastModified *date.Time `json:"lastModified,omitempty"`
557
558 ThumbnailURI *string `json:"thumbnailUri,omitempty"`
559 }
560
561
562 func (p Project) MarshalJSON() ([]byte, error) {
563 objectMap := make(map[string]interface{})
564 if p.Name != nil {
565 objectMap["name"] = p.Name
566 }
567 if p.Description != nil {
568 objectMap["description"] = p.Description
569 }
570 if p.Settings != nil {
571 objectMap["settings"] = p.Settings
572 }
573 return json.Marshal(objectMap)
574 }
575
576
577 type ProjectSettings struct {
578
579 DomainID *uuid.UUID `json:"domainId,omitempty"`
580
581 ClassificationType Classifier `json:"classificationType,omitempty"`
582 }
583
584
585 type Region struct {
586 TagID *uuid.UUID `json:"tagId,omitempty"`
587 Left *float64 `json:"left,omitempty"`
588 Top *float64 `json:"top,omitempty"`
589 Width *float64 `json:"width,omitempty"`
590 Height *float64 `json:"height,omitempty"`
591 }
592
593
594 type RegionProposal struct {
595
596 Confidence *float64 `json:"confidence,omitempty"`
597
598 BoundingBox *BoundingBox `json:"boundingBox,omitempty"`
599 }
600
601
602 func (rp RegionProposal) MarshalJSON() ([]byte, error) {
603 objectMap := make(map[string]interface{})
604 return json.Marshal(objectMap)
605 }
606
607
608 type StoredImagePrediction struct {
609
610 ImageURI *string `json:"imageUri,omitempty"`
611
612 ThumbnailURI *string `json:"thumbnailUri,omitempty"`
613
614 Domain *uuid.UUID `json:"domain,omitempty"`
615
616 ID *uuid.UUID `json:"id,omitempty"`
617
618 Project *uuid.UUID `json:"project,omitempty"`
619
620 Iteration *uuid.UUID `json:"iteration,omitempty"`
621
622 Created *date.Time `json:"created,omitempty"`
623
624 Predictions *[]Prediction `json:"predictions,omitempty"`
625 }
626
627
628 func (sip StoredImagePrediction) MarshalJSON() ([]byte, error) {
629 objectMap := make(map[string]interface{})
630 return json.Marshal(objectMap)
631 }
632
633
634 type Tag struct {
635 autorest.Response `json:"-"`
636
637 ID *uuid.UUID `json:"id,omitempty"`
638
639 Name *string `json:"name,omitempty"`
640
641 Description *string `json:"description,omitempty"`
642
643 ImageCount *int32 `json:"imageCount,omitempty"`
644 }
645
646
647 func (t Tag) MarshalJSON() ([]byte, error) {
648 objectMap := make(map[string]interface{})
649 if t.Name != nil {
650 objectMap["name"] = t.Name
651 }
652 if t.Description != nil {
653 objectMap["description"] = t.Description
654 }
655 return json.Marshal(objectMap)
656 }
657
658
659 type TagPerformance struct {
660
661 ID *uuid.UUID `json:"id,omitempty"`
662
663 Name *string `json:"name,omitempty"`
664
665 Precision *float64 `json:"precision,omitempty"`
666
667 PrecisionStdDeviation *float64 `json:"precisionStdDeviation,omitempty"`
668
669 Recall *float64 `json:"recall,omitempty"`
670
671 RecallStdDeviation *float64 `json:"recallStdDeviation,omitempty"`
672
673 AveragePrecision *float64 `json:"averagePrecision,omitempty"`
674 }
675
676
677 func (tp TagPerformance) MarshalJSON() ([]byte, error) {
678 objectMap := make(map[string]interface{})
679 return json.Marshal(objectMap)
680 }
681
View as plain text