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