DaoAI World C# SDK INDUSTRIAL 2025.3.0
Loading...
Searching...
No Matches
prediction.h
Go to the documentation of this file.
1#pragma once
2#include "managed_object.h"
3#include "common.h"
4#include "../daoai_dl_sdk/include/export/dwsdk/model.h"
5#include "../daoai_dl_sdk/include/export/dwsdk/prediction.h"
6
7using namespace System::Collections::Generic;
8namespace DaoAI {
9 namespace DeepLearningCLI
10 {
11 namespace Vision
12 {
13 public ref class ObjectDetectionResult : public ManagedObject<DaoAI::DeepLearning::Vision::ObjectDetectionResult>
14 {
15 public:
16
17 ObjectDetectionResult(const DaoAI::DeepLearning::Vision::ObjectDetectionResult& result) : ManagedObject(new DaoAI::DeepLearning::Vision::ObjectDetectionResult(result)) {}
18
19 String^ toJSONString();
20
22
23 property int height
24 {
25 int get() {
26 return m_Instance->image_width;
27 }
28 }
29 property int width
30 {
31 int get() {
32 return m_Instance->image_height;
33 }
34 }
35
36 property int num_detections
37 {
38 int get() {
39 return m_Instance->num_detections;
40 }
41 }
42 property cli::array<Box^>^ boxes
43 {
44 cli::array<Box^>^ get() {
45 std::vector<DaoAI::DeepLearning::Box> native_boxes = m_Instance->boxes;
46 cli::array<Box^>^ boxes = gcnew cli::array<Box^>(native_boxes.size());
47 for (int i = 0; i < native_boxes.size(); i++) {
48 boxes[i] = gcnew Box(native_boxes[i]);
49 }
50 return boxes;
51 }
52 }
53 property cli::array<double>^ confidences
54 {
55 cli::array<double>^ get() {
56 cli::array<double>^ confidences = gcnew cli::array<double>(m_Instance->confidences.size());
57 for (int i = 0; i < m_Instance->confidences.size(); i++) {
58 confidences[i] = m_Instance->confidences[i];
59 }
60 return confidences;
61 }
62 }
63 property cli::array<int>^ class_ids
64 {
65 cli::array<int>^ get() {
66 cli::array<int>^ class_ids = gcnew cli::array<int>(m_Instance->class_ids.size());
67 for (int i = 0; i < m_Instance->class_ids.size(); i++) {
68 class_ids[i] = m_Instance->class_ids[i];
69 }
70 return class_ids;
71 }
72 }
73 property cli::array<String^>^ class_labels
74 {
75 cli::array<String^>^ get() {
76 std::vector<std::string> native_labels = m_Instance->class_labels;
77 cli::array<String^>^ labels = gcnew cli::array<String^>(native_labels.size());
78 for (int i = 0; i < native_labels.size(); i++) {
79 labels[i] = gcnew String(native_labels[i].c_str());
80 }
81 return labels;
82 }
83 }
84
85 property String^ decision
86 {
87 String^ get() {
88 return gcnew String(m_Instance->decision.c_str());
89 }
90 }
91 };
92
93 public ref class MultilabelDetectionResult : public ManagedObject<DaoAI::DeepLearning::Vision::MultilabelDetectionResult>
94 {
95 public:
96
97 MultilabelDetectionResult(const DaoAI::DeepLearning::Vision::MultilabelDetectionResult& result) : ManagedObject(new DaoAI::DeepLearning::Vision::MultilabelDetectionResult(result)) {}
98 String^ toJSONString();
99
101
102 property int height
103 {
104 int get() {
105 return m_Instance->image_width;
106 }
107 }
108 property int width
109 {
110 int get() {
111 return m_Instance->image_height;
112 }
113 }
114
115 property int num_detections
116 {
117 int get() {
118 return m_Instance->num_detections;
119 }
120 }
121 property cli::array<Box^>^ boxes
122 {
123
124 cli::array<Box^>^ get() {
125 std::vector<DaoAI::DeepLearning::Box> native_boxes = m_Instance->boxes;
126 cli::array<Box^>^ boxes = gcnew cli::array<Box^>(native_boxes.size());
127 for (int i = 0; i < native_boxes.size(); i++) {
128 boxes[i] = gcnew Box(native_boxes[i]);
129 }
130 return boxes;
131 }
132 }
133 property cli::array<double>^ confidences
134 {
135 cli::array<double>^ get() {
136 cli::array<double>^ confidences = gcnew cli::array<double>(m_Instance->confidences.size());
137 for (int i = 0; i < m_Instance->confidences.size(); i++) {
138 confidences[i] = m_Instance->confidences[i];
139 }
140 return confidences;
141 }
142 }
143 property cli::array<int>^ class_ids
144 {
145
146 cli::array<int>^ get() {
147 cli::array<int>^ class_ids = gcnew cli::array<int>(m_Instance->class_ids.size());
148 for (int i = 0; i < m_Instance->class_ids.size(); i++) {
149 class_ids[i] = m_Instance->class_ids[i];
150 }
151 return class_ids;
152 }
153 }
154 property cli::array<String^>^ class_labels
155 {
156 cli::array<String^>^ get() {
157 std::vector<std::string> native_labels = m_Instance->class_labels;
158 cli::array<String^>^ labels = gcnew cli::array<String^>(native_labels.size());
159 for (int i = 0; i < native_labels.size(); i++) {
160 labels[i] = gcnew String(native_labels[i].c_str());
161 }
162 return labels;
163 }
164 }
165
166 property cli::array<Dictionary<String^, double>^>^ attributes
167 {
168 cli::array<Dictionary<String^, double>^>^ get() {
169 std::vector<std::unordered_map<std::string, double>> native_attributes = m_Instance->attributes;
170 cli::array<Dictionary<String^, double>^>^ attributes = gcnew cli::array<Dictionary<String^, double>^>(native_attributes.size());
171 for (int i = 0; i < native_attributes.size(); i++) {
172 Dictionary<String^, double>^ attribute = gcnew Dictionary<String^, double>();
173 for (auto it = native_attributes[i].begin(); it != native_attributes[i].end(); it++) {
174 attribute->Add(gcnew String(it->first.c_str()), it->second);
175 }
176 attributes[i] = attribute;
177 }
178 return attributes;
179 }
180 }
181
182 };
183
184 public ref class RotatedObjectDetectionResult : public ManagedObject<DaoAI::DeepLearning::Vision::RotatedObjectDetectionResult>
185 {
186 public:
187
188 RotatedObjectDetectionResult(const DaoAI::DeepLearning::Vision::RotatedObjectDetectionResult& result) : ManagedObject(new DaoAI::DeepLearning::Vision::RotatedObjectDetectionResult(result)) {}
189
190 String^ toJSONString();
191
193
194 property int height
195 {
196 int get() {
197 return m_Instance->image_width;
198 }
199 }
200 property int width
201 {
202 int get() {
203 return m_Instance->image_height;
204 }
205 }
206
207 property int num_detections
208 {
209 int get() {
210 return m_Instance->num_detections;
211 }
212 }
213 property cli::array<Box^>^ boxes
214 {
215
216 cli::array<Box^>^ get() {
217 std::vector<DaoAI::DeepLearning::Box> native_boxes = m_Instance->boxes;
218 cli::array<Box^>^ boxes = gcnew cli::array<Box^>(native_boxes.size());
219 for (int i = 0; i < native_boxes.size(); i++) {
220 boxes[i] = gcnew Box(native_boxes[i]);
221 }
222 return boxes;
223 }
224 }
225 property cli::array<double>^ confidences
226 {
227 cli::array<double>^ get() {
228 cli::array<double>^ confidences = gcnew cli::array<double>(m_Instance->confidences.size());
229 for (int i = 0; i < m_Instance->confidences.size(); i++) {
230 confidences[i] = m_Instance->confidences[i];
231 }
232 return confidences;
233 }
234 }
235 property cli::array<int>^ class_ids
236 {
237
238 cli::array<int>^ get() {
239 cli::array<int>^ class_ids = gcnew cli::array<int>(m_Instance->class_ids.size());
240 for (int i = 0; i < m_Instance->class_ids.size(); i++) {
241 class_ids[i] = m_Instance->class_ids[i];
242 }
243 return class_ids;
244 }
245 }
246 property cli::array<String^>^ class_labels
247 {
248 cli::array<String^>^ get() {
249 std::vector<std::string> native_labels = m_Instance->class_labels;
250 cli::array<String^>^ labels = gcnew cli::array<String^>(native_labels.size());
251 for (int i = 0; i < native_labels.size(); i++) {
252 labels[i] = gcnew String(native_labels[i].c_str());
253 }
254 return labels;
255 }
256 }
257 };
258
259 public ref class InstanceSegmentationResult : public ManagedObject<DaoAI::DeepLearning::Vision::InstanceSegmentationResult>
260 {
261 public:
262 InstanceSegmentationResult(const DaoAI::DeepLearning::Vision::InstanceSegmentationResult& result) : ManagedObject(new DaoAI::DeepLearning::Vision::InstanceSegmentationResult(result)) {}
263
264 String^ toJSONString();
266
267 property int height
268 {
269 int get() {
270 return m_Instance->image_width;
271 }
272 }
273 property int width
274 {
275 int get() {
276 return m_Instance->image_height;
277 }
278 }
279
280 property int num_detections
281 {
282 int get() {
283 return m_Instance->num_detections;
284 }
285 }
286 property cli::array<Box^>^ boxes
287 {
288 cli::array<Box^>^ get() {
289 std::vector<DaoAI::DeepLearning::Box> native_boxes = m_Instance->boxes;
290 cli::array<Box^>^ boxes = gcnew cli::array<Box^>(native_boxes.size());
291 for (int i = 0; i < native_boxes.size(); i++) {
292 boxes[i] = gcnew Box(native_boxes[i]);
293 }
294 return boxes;
295 }
296 }
297 property cli::array<double>^ confidences
298 {
299 cli::array<double>^ get() {
300 cli::array<double>^ confidences = gcnew cli::array<double>(m_Instance->confidences.size());
301 for (int i = 0; i < m_Instance->confidences.size(); i++) {
302 confidences[i] = m_Instance->confidences[i];
303 }
304 return confidences;
305 }
306 }
307 property cli::array<int>^ class_ids
308 {
309 cli::array<int>^ get() {
310 cli::array<int>^ class_ids = gcnew cli::array<int>(m_Instance->class_ids.size());
311 for (int i = 0; i < m_Instance->class_ids.size(); i++) {
312 confidences[i] = m_Instance->class_ids[i];
313 }
314 return class_ids;
315 }
316 }
317 property cli::array<String^>^ class_labels
318 {
319 cli::array<String^>^ get() {
320 std::vector<std::string> native_labels = m_Instance->class_labels;
321 cli::array<String^>^ labels = gcnew cli::array<String^>(native_labels.size());
322 for (int i = 0; i < native_labels.size(); i++) {
323 labels[i] = gcnew String(native_labels[i].c_str());
324 }
325 return labels;
326 }
327 }
328
329 property cli::array<Mask^>^ masks
330 {
331 cli::array<Mask^>^ get() {
332 std::vector<DaoAI::DeepLearning::Mask> native_masks = m_Instance->masks;
333 cli::array<Mask^>^ masks = gcnew cli::array<Mask^>(native_masks.size());
334 for (int i = 0; i < native_masks.size(); i++) {
335 masks[i] = gcnew Mask(native_masks[i]);
336 }
337 return masks;
338 }
339 }
340 };
341
342 public ref class KeypointDetectionResult : public ManagedObject<DaoAI::DeepLearning::Vision::KeypointDetectionResult>
343 {
344 public:
345 KeypointDetectionResult::KeypointDetectionResult(const DaoAI::DeepLearning::Vision::KeypointDetectionResult& result) : ManagedObject(new DaoAI::DeepLearning::Vision::KeypointDetectionResult(result)) {}
346
347 String^ toJSONString();
349
350 property int height
351 {
352 int get() {
353 return m_Instance->image_width;
354 }
355 }
356 property int width
357 {
358 int get() {
359 return m_Instance->image_height;
360 }
361 }
362
363 property int num_detections
364 {
365 int get() {
366 return m_Instance->num_detections;
367 }
368 }
369 property cli::array<Box^>^ boxes
370 {
371 cli::array<Box^>^ get() {
372 std::vector<DaoAI::DeepLearning::Box> native_boxes = m_Instance->boxes;
373 cli::array<Box^>^ boxes = gcnew cli::array<Box^>(native_boxes.size());
374 for (int i = 0; i < native_boxes.size(); i++) {
375 boxes[i] = gcnew Box(native_boxes[i]);
376 }
377 return boxes;
378 }
379 }
380 property cli::array<double>^ confidences
381 {
382 cli::array<double>^ get() {
383 cli::array<double>^ confidences = gcnew cli::array<double>(m_Instance->confidences.size());
384 for (int i = 0; i < m_Instance->confidences.size(); i++) {
385 confidences[i] = m_Instance->confidences[i];
386 }
387 return confidences;
388 }
389 }
390 property cli::array<int>^ class_ids
391 {
392 cli::array<int>^ get() {
393 cli::array<int>^ class_ids = gcnew cli::array<int>(m_Instance->class_ids.size());
394 for (int i = 0; i < m_Instance->class_ids.size(); i++) {
395 class_ids[i] = m_Instance->class_ids[i];
396 }
397 return class_ids;
398 }
399 }
400 property cli::array<String^>^ class_labels
401 {
402 cli::array<String^>^ get() {
403 std::vector<std::string> native_labels = m_Instance->class_labels;
404 cli::array<String^>^ labels = gcnew cli::array<String^>(native_labels.size());
405 for (int i = 0; i < native_labels.size(); i++) {
406 labels[i] = gcnew String(native_labels[i].c_str());
407 }
408 return labels;
409 }
410 }
411
412 property cli::array<Mask^>^ masks
413 {
414 cli::array<Mask^>^ get() {
415 std::vector<DaoAI::DeepLearning::Mask> native_masks = m_Instance->masks;
416 cli::array<Mask^>^ masks = gcnew cli::array<Mask^>(native_masks.size());
417 for (int i = 0; i < native_masks.size(); i++) {
418 masks[i] = gcnew Mask(native_masks[i]);
419 }
420 return masks;
421 }
422 }
423
424 property cli::array<cli::array<Point^>^>^ keypoints
425 {
426 cli::array<cli::array<Point^>^>^ get() {
427 std::vector<std::vector<DaoAI::DeepLearning::Point>> native_keypoints = m_Instance->keypoints;
428 cli::array<cli::array<Point^>^>^ keypoints = gcnew cli::array<cli::array<Point^>^>(native_keypoints.size());
429 for (int i = 0; i < native_keypoints.size(); i++) {
430 keypoints[i] = gcnew cli::array<Point^>(native_keypoints[i].size());
431 for (int j = 0; j < native_keypoints[i].size(); j++) {
432 keypoints[i][j] = gcnew Point(native_keypoints[i][j]);
433 }
434 }
435 return keypoints;
436 }
437 }
438 };
439
440 public ref class OCRResult : public ManagedObject<DaoAI::DeepLearning::Vision::OCRResult>
441 {
442 public:
443 OCRResult::OCRResult(const DaoAI::DeepLearning::Vision::OCRResult& result) : ManagedObject(new DaoAI::DeepLearning::Vision::OCRResult(result)) {}
444
445 String^ toJSONString();
447
448 property int height
449 {
450 int get() {
451 return m_Instance->image_width;
452 }
453 }
454 property int width
455 {
456 int get() {
457 return m_Instance->image_height;
458 }
459 }
460
461 property int num_detections
462 {
463 int get() {
464 return m_Instance->num_detections;
465 }
466 }
467 property cli::array<String^>^ texts
468 {
469 cli::array<String^>^ get() {
470 std::vector<std::string> native_texts = m_Instance->texts;
471 cli::array<String^>^ texts = gcnew cli::array<String^>(native_texts.size());
472 for (int i = 0; i < native_texts.size(); i++) {
473 texts[i] = gcnew String(native_texts[i].c_str());
474 }
475 return texts;
476 }
477 }
478
479 property cli::array<Polygon^>^ boxes
480 {
481 cli::array<Polygon^>^ get() {
482 std::vector<DaoAI::DeepLearning::Polygon> native_boxes = m_Instance->boxes;
483 cli::array<Polygon^>^ boxes = gcnew cli::array<Polygon^>(native_boxes.size());
484 for (int i = 0; i < native_boxes.size(); i++) {
485 boxes[i] = gcnew Polygon(native_boxes[i]);
486 }
487 return boxes;
488 }
489 }
490
491 property cli::array<double>^ confidences
492 {
493 cli::array<double>^ get() {
494 cli::array<double>^ confidences = gcnew cli::array<double>(m_Instance->confidences.size());
495 for (int i = 0; i < m_Instance->confidences.size(); i++) {
496 confidences[i] = m_Instance->confidences[i];
497 }
498 return confidences;
499 }
500 }
501 };
502
503 public ref struct Flag : public ManagedObject<DaoAI::DeepLearning::Vision::ClassificationResult::Flag>
504 {
505 public:
506 Flag(DaoAI::DeepLearning::Vision::ClassificationResult::Flag flag) : ManagedObject(new DaoAI::DeepLearning::Vision::ClassificationResult::Flag(flag)) {}
507
508 property double confidence
509 {
510 double get() {
511 return m_Instance->confidence;
512 }
513 void set(double value) {
514 m_Instance->confidence = value;
515 }
516 }
517
518 property String^ label
519 {
520 String^ get() {
521 return gcnew String(m_Instance->label.c_str());
522 }
523
524 void set(String^ value) {
525 m_Instance->label = string_to_char_array(value);
526 }
527 }
528 };
529
530 public ref class ClassificationResult : public ManagedObject<DaoAI::DeepLearning::Vision::ClassificationResult>
531 {
532 public:
533 ClassificationResult::ClassificationResult(const DaoAI::DeepLearning::Vision::ClassificationResult& result) : ManagedObject(new DaoAI::DeepLearning::Vision::ClassificationResult(result)) {}
534
535 String^ toJSONString();
537
538 property int height
539 {
540 int get() {
541 return m_Instance->image_width;
542 }
543 }
544 property int width
545 {
546 int get() {
547 return m_Instance->image_height;
548 }
549 }
550
551 property cli::array<Flag^>^ flags
552 {
553 cli::array<Flag^>^ get() {
554 std::vector<DaoAI::DeepLearning::Vision::ClassificationResult::Flag> native_flags = m_Instance->flags;
555 cli::array<Flag^>^ flags = gcnew cli::array<Flag^>(native_flags.size());
556 for (int i = 0; i < native_flags.size(); i++) {
557 flags[i] = gcnew Flag(native_flags[i]);
558 }
559 return flags;
560 }
561 }
562
563 property bool multilabel
564 {
565 bool get() {
566 return m_Instance->multilabel;
567 }
568 }
569 };
570
571 public ref class SupervisedDefectSegmentationResult : public ManagedObject<DaoAI::DeepLearning::Vision::SupervisedDefectSegmentationResult>
572 {
573 public:
574 SupervisedDefectSegmentationResult::SupervisedDefectSegmentationResult(const DaoAI::DeepLearning::Vision::SupervisedDefectSegmentationResult& result) : ManagedObject(new DaoAI::DeepLearning::Vision::SupervisedDefectSegmentationResult(result)) {}
575
576 String^ toJSONString();
578
579 property int height
580 {
581 int get() {
582 return m_Instance->image_width;
583 }
584 }
585 property int width
586 {
587 int get() {
588 return m_Instance->image_height;
589 }
590 }
591
592 property Dictionary<String^, Mask^>^ masks
593 {
594 Dictionary<String^, Mask^>^ get() {
595 Dictionary<String^, Mask^>^ masks = gcnew Dictionary<String^, Mask^>();
596 for (auto& pair : m_Instance->masks) {
597 masks[gcnew String(pair.first.c_str())] = gcnew Mask(pair.second);
598 }
599 return masks;
600 }
601 }
602
603 property String^ decision
604 {
605 String^ get() {
606 return gcnew String(m_Instance->decision.c_str());
607 }
608 }
609 };
610
611 public ref class AutoSegmentationResult : public ManagedObject<DaoAI::DeepLearning::Vision::AutoSegmentationResult>
612 {
613 public:
614 AutoSegmentationResult::AutoSegmentationResult(const DaoAI::DeepLearning::Vision::AutoSegmentationResult& result) : ManagedObject(new DaoAI::DeepLearning::Vision::AutoSegmentationResult(result)) {}
615
616 String^ toJSONString();
618
619 property int height
620 {
621 int get() {
622 return m_Instance->image_width;
623 }
624 }
625 property int width
626 {
627 int get() {
628 return m_Instance->image_height;
629 }
630 }
631
632 property Mask^ mask
633 {
634 Mask^ get() {
635 return gcnew Mask(m_Instance->mask);
636 }
637 }
638
639 property double confidence
640 {
641 double get() {
642 return m_Instance->confidence;
643 }
644 }
645 };
646
647 public ref class ImageEmbedding : public ManagedObject<DaoAI::DeepLearning::Vision::ImageEmbedding>
648 {
649 public:
650 ImageEmbedding::ImageEmbedding(const DaoAI::DeepLearning::Vision::ImageEmbedding& embedding) : ManagedObject(new DaoAI::DeepLearning::Vision::ImageEmbedding(embedding)) {}
651
652 property int height
653 {
654 int get() {
655 return m_Instance->image_height;
656 }
657 }
658 property int width
659 {
660 int get() {
661 return m_Instance->image_width;
662 }
663 }
664
665 property cli::array<float>^ data
666 {
667 cli::array<float>^ get() {
668 std::vector<float> native_data = m_Instance->data;
669 cli::array<float>^ data = gcnew cli::array<float>(native_data.size());
670 for (int i = 0; i < native_data.size(); i++) {
671 data[i] = native_data[i];
672 }
673 return data;
674 }
675 }
676
677 property cli::array<size_t>^ shape
678 {
679 cli::array<size_t>^ get() {
680 std::vector<size_t> native_shape = m_Instance->shape;
681 cli::array<size_t>^ shape = gcnew cli::array<size_t>(native_shape.size());
682 for (int i = 0; i < native_shape.size(); i++) {
683 shape[i] = native_shape[i];
684 }
685 return shape;
686 }
687 }
688 };
689
690#ifdef INDUSTRIAL
691 public ref class PresenceCheckingResult : public ManagedObject<DaoAI::DeepLearning::Vision::PresenceCheckingResult>
692 {
693 public:
694 PresenceCheckingResult::PresenceCheckingResult(const DaoAI::DeepLearning::Vision::PresenceCheckingResult& result) : ManagedObject(new DaoAI::DeepLearning::Vision::PresenceCheckingResult(result)) {}
695
696 String^ toJSONString();
698
699 property int height
700 {
701 int get() {
702 return m_Instance->image_width;
703 }
704 }
705 property int width
706 {
707 int get() {
708 return m_Instance->image_height;
709 }
710 }
711
712 property int num_detections
713 {
714 int get() {
715 return m_Instance->num_detections;
716 }
717 }
718 property cli::array<Box^>^ boxes
719 {
720 cli::array<Box^>^ get() {
721 std::vector<DaoAI::DeepLearning::Box> native_boxes = m_Instance->boxes;
722 cli::array<Box^>^ boxes = gcnew cli::array<Box^>(native_boxes.size());
723 for (int i = 0; i < native_boxes.size(); i++) {
724 boxes[i] = gcnew Box(native_boxes[i]);
725 }
726 return boxes;
727 }
728 }
729 property cli::array<double>^ confidences
730 {
731 cli::array<double>^ get() {
732 cli::array<double>^ confidences = gcnew cli::array<double>(m_Instance->confidences.size());
733 for (int i = 0; i < m_Instance->confidences.size(); i++) {
734 confidences[i] = m_Instance->confidences[i];
735 }
736 return confidences;
737 }
738 }
739 property cli::array<int>^ class_ids
740 {
741 cli::array<int>^ get() {
742 cli::array<int>^ class_ids = gcnew cli::array<int>(m_Instance->class_ids.size());
743 for (int i = 0; i < m_Instance->class_ids.size(); i++) {
744 class_ids[i] = m_Instance->class_ids[i];
745 }
746 return class_ids;
747 }
748 }
749 property cli::array<String^>^ class_labels
750 {
751 cli::array<String^>^ get() {
752 std::vector<std::string> native_labels = m_Instance->class_labels;
753 cli::array<String^>^ labels = gcnew cli::array<String^>(native_labels.size());
754 for (int i = 0; i < native_labels.size(); i++) {
755 labels[i] = gcnew String(native_labels[i].c_str());
756 }
757 return labels;
758 }
759 }
760
761 property String^ decision
762 {
763 String^ get() {
764 return gcnew String(m_Instance->decision.c_str());
765 }
766 }
767 };
768
769 public ref class PositioningResult : public ManagedObject<DaoAI::DeepLearning::Vision::PositioningResult>
770 {
771 public:
772 PositioningResult::PositioningResult(const DaoAI::DeepLearning::Vision::PositioningResult& result) : ManagedObject(new DaoAI::DeepLearning::Vision::PositioningResult(result)) {}
773
774 String^ toJSONString();
776
777 property int height
778 {
779 int get() {
780 return m_Instance->image_width;
781 }
782 }
783 property int width
784 {
785 int get() {
786 return m_Instance->image_height;
787 }
788 }
789
790 property int num_detections
791 {
792 int get() {
793 return m_Instance->num_detections;
794 }
795 }
796 property cli::array<Box^>^ boxes
797 {
798 cli::array<Box^>^ get() {
799 std::vector<DaoAI::DeepLearning::Box> native_boxes = m_Instance->boxes;
800 cli::array<Box^>^ boxes = gcnew cli::array<Box^>(native_boxes.size());
801 for (int i = 0; i < native_boxes.size(); i++) {
802 boxes[i] = gcnew Box(native_boxes[i]);
803 }
804 return boxes;
805 }
806 }
807 property cli::array<double>^ confidences
808 {
809 cli::array<double>^ get() {
810 cli::array<double>^ confidences = gcnew cli::array<double>(m_Instance->confidences.size());
811 for (int i = 0; i < m_Instance->confidences.size(); i++) {
812 confidences[i] = m_Instance->confidences[i];
813 }
814 return confidences;
815 }
816 }
817 property cli::array<int>^ class_ids
818 {
819 cli::array<int>^ get() {
820 cli::array<int>^ class_ids = gcnew cli::array<int>(m_Instance->class_ids.size());
821 for (int i = 0; i < m_Instance->class_ids.size(); i++) {
822 class_ids[i] = m_Instance->class_ids[i];
823 }
824 return class_ids;
825 }
826 }
827 property cli::array<String^>^ class_labels
828 {
829 cli::array<String^>^ get() {
830 std::vector<std::string> native_labels = m_Instance->class_labels;
831 cli::array<String^>^ labels = gcnew cli::array<String^>(native_labels.size());
832 for (int i = 0; i < native_labels.size(); i++) {
833 labels[i] = gcnew String(native_labels[i].c_str());
834 }
835 return labels;
836 }
837 }
838
839 property cli::array<Mask^>^ masks
840 {
841 cli::array<Mask^>^ get() {
842 std::vector<DaoAI::DeepLearning::Mask> native_masks = m_Instance->masks;
843 cli::array<Mask^>^ masks = gcnew cli::array<Mask^>(native_masks.size());
844 for (int i = 0; i < native_masks.size(); i++) {
845 masks[i] = gcnew Mask(native_masks[i]);
846 }
847 return masks;
848 }
849 }
850
851 property cli::array<cli::array<Point^>^>^ keypoints
852 {
853 cli::array<cli::array<Point^>^>^ get() {
854 std::vector<std::vector<DaoAI::DeepLearning::Point>> native_keypoints = m_Instance->keypoints;
855 cli::array<cli::array<Point^>^>^ keypoints = gcnew cli::array<cli::array<Point^>^>(native_keypoints.size());
856 for (int i = 0; i < native_keypoints.size(); i++) {
857 keypoints[i] = gcnew cli::array<Point^>(native_keypoints[i].size());
858 for (int j = 0; j < native_keypoints[i].size(); j++) {
859 keypoints[i][j] = gcnew Point(native_keypoints[i][j]);
860 }
861 }
862 return keypoints;
863 }
864 }
865
866 property Point^ center
867 {
868 Point^ get() {
869 return gcnew Point(m_Instance->center);
870 }
871 }
872
873 property double angle
874 {
875 double get() {
876 return m_Instance->angle;
877 }
878 }
879
880 property String^ decision
881 {
882 String^ get() {
883 return gcnew String(m_Instance->decision.c_str());
884 }
885 }
886 };
887
888 public ref struct Region : public ManagedObject<DaoAI::DeepLearning::Vision::UnsupervisedDefectSegmentationResult::Region>
889 {
890 public:
891 Region(DaoAI::DeepLearning::Vision::UnsupervisedDefectSegmentationResult::Region region) : ManagedObject(new DaoAI::DeepLearning::Vision::UnsupervisedDefectSegmentationResult::Region(region)) {}
892
893 property double ai_deviation_score
894 {
895 double get() {
896 return m_Instance->ai_deviation_score;
897 }
898 }
899
900 property String^ label
901 {
902 String^ get() {
903 return gcnew String(m_Instance->label.c_str());
904 }
905 }
906
907 property bool defect
908 {
909 bool get() {
910 return m_Instance->defect;
911 }
912 }
913
914 property Box^ box
915 {
916 Box^ get() {
917 return gcnew Box(m_Instance->bbox[0], m_Instance->bbox[1], m_Instance->bbox[2], m_Instance->bbox[3], NAN, Box::Type::XYXY);
918 }
919 }
920 };
921
922 public ref class UnsupervisedDefectSegmentationResult : ManagedObject<DaoAI::DeepLearning::Vision::UnsupervisedDefectSegmentationResult>
923 {
924 public:
925 UnsupervisedDefectSegmentationResult::UnsupervisedDefectSegmentationResult(const DaoAI::DeepLearning::Vision::UnsupervisedDefectSegmentationResult& result) : ManagedObject(new DaoAI::DeepLearning::Vision::UnsupervisedDefectSegmentationResult(result)) {}
926
927 String^ toJSONString();
929
930 property int height
931 {
932 int get() {
933 return m_Instance->image_width;
934 }
935 }
936 property int width
937 {
938 int get() {
939 return m_Instance->image_height;
940 }
941 }
942
943 property Mask^ mask
944 {
945 Mask^ get() {
946 return gcnew Mask(m_Instance->mask);
947 }
948 }
949
950 property Mask^ anomaly_heatmap
951 {
952 Mask^ get() {
953 return gcnew Mask(m_Instance->anomaly_heatmap);
954 }
955 }
956
957 property double ai_deviation_score
958 {
959 double get() {
960 return m_Instance->ai_deviation_score;
961 }
962 }
963
964 property bool defect
965 {
966 bool get() {
967 return m_Instance->defect;
968 }
969 }
970
971 property cli::array<Region^>^ region_defects
972 {
973 cli::array<Region^>^ get() {
974 std::vector<DaoAI::DeepLearning::Vision::UnsupervisedDefectSegmentationResult::Region> native_regions = m_Instance->region_defects;
975 cli::array<Region^>^ regions = gcnew cli::array<Region^>(native_regions.size());
976 for (int i = 0; i < native_regions.size(); i++) {
977 regions[i] = gcnew Region(native_regions[i]);
978 }
979 return regions;
980 }
981 }
982 };
983#endif // INDUSTRIAL
984 }
985 }
986}
987
Definition managed_object.h:60
DaoAI::DeepLearning::Vision::ObjectDetectionResult * m_Instance
Definition managed_object.h:62
InstanceSegmentationResult(const DaoAI::DeepLearning::Vision::InstanceSegmentationResult &result)
Definition prediction.h:262
KeypointDetectionResult::KeypointDetectionResult(const DaoAI::DeepLearning::Vision::KeypointDetectionResult &result)
Definition prediction.h:345
MultilabelDetectionResult(const DaoAI::DeepLearning::Vision::MultilabelDetectionResult &result)
Definition prediction.h:97
ObjectDetectionResult(const DaoAI::DeepLearning::Vision::ObjectDetectionResult &result)
Definition prediction.h:17
RotatedObjectDetectionResult(const DaoAI::DeepLearning::Vision::RotatedObjectDetectionResult &result)
Definition prediction.h:188
Definition common.cpp:6
Definition prediction.h:504
Flag(DaoAI::DeepLearning::Vision::ClassificationResult::Flag flag)
Definition prediction.h:506
Definition prediction.h:889
Region(DaoAI::DeepLearning::Vision::UnsupervisedDefectSegmentationResult::Region region)
Definition prediction.h:891