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