DaoAI World C# SDK industrial 2.24.8.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/model.h"
5#include "../daoai_dl_sdk/include/export/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 InstanceSegmentationResult : public ManagedObject<DaoAI::DeepLearning::Vision::InstanceSegmentationResult>
94 {
95 public:
96 InstanceSegmentationResult(const DaoAI::DeepLearning::Vision::InstanceSegmentationResult& result) : ManagedObject(new DaoAI::DeepLearning::Vision::InstanceSegmentationResult(result)) {}
97
98 String^ toJSONString();
100
101 property int height
102 {
103 int get() {
104 return m_Instance->image_width;
105 }
106 }
107 property int width
108 {
109 int get() {
110 return m_Instance->image_height;
111 }
112 }
113
114 property int num_detections
115 {
116 int get() {
117 return m_Instance->num_detections;
118 }
119 }
120 property cli::array<Box^>^ boxes
121 {
122 cli::array<Box^>^ get() {
123 std::vector<DaoAI::DeepLearning::Box> native_boxes = m_Instance->boxes;
124 cli::array<Box^>^ boxes = gcnew cli::array<Box^>(native_boxes.size());
125 for (int i = 0; i < native_boxes.size(); i++) {
126 boxes[i] = gcnew Box(native_boxes[i]);
127 }
128 return boxes;
129 }
130 }
131 property cli::array<double>^ confidences
132 {
133 cli::array<double>^ get() {
134 cli::array<double>^ confidences = gcnew cli::array<double>(m_Instance->confidences.size());
135 for (int i = 0; i < m_Instance->confidences.size(); i++) {
136 confidences[i] = m_Instance->confidences[i];
137 }
138 return confidences;
139 }
140 }
141 property cli::array<int>^ class_ids
142 {
143 cli::array<int>^ get() {
144 cli::array<int>^ class_ids = gcnew cli::array<int>(m_Instance->class_ids.size());
145 for (int i = 0; i < m_Instance->class_ids.size(); i++) {
146 confidences[i] = m_Instance->class_ids[i];
147 }
148 return class_ids;
149 }
150 }
151 property cli::array<String^>^ class_labels
152 {
153 cli::array<String^>^ get() {
154 std::vector<std::string> native_labels = m_Instance->class_labels;
155 cli::array<String^>^ labels = gcnew cli::array<String^>(native_labels.size());
156 for (int i = 0; i < native_labels.size(); i++) {
157 labels[i] = gcnew String(native_labels[i].c_str());
158 }
159 return labels;
160 }
161 }
162
163 property cli::array<Mask^>^ masks
164 {
165 cli::array<Mask^>^ get() {
166 std::vector<DaoAI::DeepLearning::Mask> native_masks = m_Instance->masks;
167 cli::array<Mask^>^ masks = gcnew cli::array<Mask^>(native_masks.size());
168 for (int i = 0; i < native_masks.size(); i++) {
169 masks[i] = gcnew Mask(native_masks[i]);
170 }
171 return masks;
172 }
173 }
174 };
175
176 public ref class KeypointDetectionResult : public ManagedObject<DaoAI::DeepLearning::Vision::KeypointDetectionResult>
177 {
178 public:
179 KeypointDetectionResult::KeypointDetectionResult(const DaoAI::DeepLearning::Vision::KeypointDetectionResult& result) : ManagedObject(new DaoAI::DeepLearning::Vision::KeypointDetectionResult(result)) {}
180
181 String^ toJSONString();
183
184 property int height
185 {
186 int get() {
187 return m_Instance->image_width;
188 }
189 }
190 property int width
191 {
192 int get() {
193 return m_Instance->image_height;
194 }
195 }
196
197 property int num_detections
198 {
199 int get() {
200 return m_Instance->num_detections;
201 }
202 }
203 property cli::array<Box^>^ boxes
204 {
205 cli::array<Box^>^ get() {
206 std::vector<DaoAI::DeepLearning::Box> native_boxes = m_Instance->boxes;
207 cli::array<Box^>^ boxes = gcnew cli::array<Box^>(native_boxes.size());
208 for (int i = 0; i < native_boxes.size(); i++) {
209 boxes[i] = gcnew Box(native_boxes[i]);
210 }
211 return boxes;
212 }
213 }
214 property cli::array<double>^ confidences
215 {
216 cli::array<double>^ get() {
217 cli::array<double>^ confidences = gcnew cli::array<double>(m_Instance->confidences.size());
218 for (int i = 0; i < m_Instance->confidences.size(); i++) {
219 confidences[i] = m_Instance->confidences[i];
220 }
221 return confidences;
222 }
223 }
224 property cli::array<int>^ class_ids
225 {
226 cli::array<int>^ get() {
227 cli::array<int>^ class_ids = gcnew cli::array<int>(m_Instance->class_ids.size());
228 for (int i = 0; i < m_Instance->class_ids.size(); i++) {
229 class_ids[i] = m_Instance->class_ids[i];
230 }
231 return class_ids;
232 }
233 }
234 property cli::array<String^>^ class_labels
235 {
236 cli::array<String^>^ get() {
237 std::vector<std::string> native_labels = m_Instance->class_labels;
238 cli::array<String^>^ labels = gcnew cli::array<String^>(native_labels.size());
239 for (int i = 0; i < native_labels.size(); i++) {
240 labels[i] = gcnew String(native_labels[i].c_str());
241 }
242 return labels;
243 }
244 }
245
246 property cli::array<Mask^>^ masks
247 {
248 cli::array<Mask^>^ get() {
249 std::vector<DaoAI::DeepLearning::Mask> native_masks = m_Instance->masks;
250 cli::array<Mask^>^ masks = gcnew cli::array<Mask^>(native_masks.size());
251 for (int i = 0; i < native_masks.size(); i++) {
252 masks[i] = gcnew Mask(native_masks[i]);
253 }
254 return masks;
255 }
256 }
257
258 property cli::array<cli::array<Point^>^>^ keypoints
259 {
260 cli::array<cli::array<Point^>^>^ get() {
261 std::vector<std::vector<DaoAI::DeepLearning::Point>> native_keypoints = m_Instance->keypoints;
262 cli::array<cli::array<Point^>^>^ keypoints = gcnew cli::array<cli::array<Point^>^>(native_keypoints.size());
263 for (int i = 0; i < native_keypoints.size(); i++) {
264 keypoints[i] = gcnew cli::array<Point^>(native_keypoints[i].size());
265 for (int j = 0; j < native_keypoints[i].size(); j++) {
266 keypoints[i][j] = gcnew Point(native_keypoints[i][j]);
267 }
268 }
269 return keypoints;
270 }
271 }
272 };
273
274 public ref class OCRResult : public ManagedObject<DaoAI::DeepLearning::Vision::OCRResult>
275 {
276 public:
277 OCRResult::OCRResult(const DaoAI::DeepLearning::Vision::OCRResult& result) : ManagedObject(new DaoAI::DeepLearning::Vision::OCRResult(result)) {}
278
279 String^ toJSONString();
281
282 property int height
283 {
284 int get() {
285 return m_Instance->image_width;
286 }
287 }
288 property int width
289 {
290 int get() {
291 return m_Instance->image_height;
292 }
293 }
294
295 property int num_detections
296 {
297 int get() {
298 return m_Instance->num_detections;
299 }
300 }
301 property cli::array<String^>^ texts
302 {
303 cli::array<String^>^ get() {
304 std::vector<std::string> native_texts = m_Instance->texts;
305 cli::array<String^>^ texts = gcnew cli::array<String^>(native_texts.size());
306 for (int i = 0; i < native_texts.size(); i++) {
307 texts[i] = gcnew String(native_texts[i].c_str());
308 }
309 return texts;
310 }
311 }
312
313 property cli::array<Polygon^>^ boxes
314 {
315 cli::array<Polygon^>^ get() {
316 std::vector<DaoAI::DeepLearning::Polygon> native_boxes = m_Instance->boxes;
317 cli::array<Polygon^>^ boxes = gcnew cli::array<Polygon^>(native_boxes.size());
318 for (int i = 0; i < native_boxes.size(); i++) {
319 boxes[i] = gcnew Polygon(native_boxes[i]);
320 }
321 return boxes;
322 }
323 }
324
325 property cli::array<double>^ confidences
326 {
327 cli::array<double>^ get() {
328 cli::array<double>^ confidences = gcnew cli::array<double>(m_Instance->confidences.size());
329 for (int i = 0; i < m_Instance->confidences.size(); i++) {
330 confidences[i] = m_Instance->confidences[i];
331 }
332 return confidences;
333 }
334 }
335 };
336
337 public ref struct Flag : public ManagedObject<DaoAI::DeepLearning::Vision::ClassificationResult::Flag>
338 {
339 public:
340 Flag(DaoAI::DeepLearning::Vision::ClassificationResult::Flag flag) : ManagedObject(new DaoAI::DeepLearning::Vision::ClassificationResult::Flag(flag)) {}
341
342 property double confidence
343 {
344 double get() {
345 return m_Instance->confidence;
346 }
347 void set(double value) {
348 m_Instance->confidence = value;
349 }
350 }
351
352 property String^ label
353 {
354 String^ get() {
355 return gcnew String(m_Instance->label.c_str());
356 }
357
358 void set(String^ value) {
359 m_Instance->label = string_to_char_array(value);
360 }
361 }
362 };
363
364 public ref class ClassificationResult : public ManagedObject<DaoAI::DeepLearning::Vision::ClassificationResult>
365 {
366 public:
367 ClassificationResult::ClassificationResult(const DaoAI::DeepLearning::Vision::ClassificationResult& result) : ManagedObject(new DaoAI::DeepLearning::Vision::ClassificationResult(result)) {}
368
369 String^ toJSONString();
371
372 property int height
373 {
374 int get() {
375 return m_Instance->image_width;
376 }
377 }
378 property int width
379 {
380 int get() {
381 return m_Instance->image_height;
382 }
383 }
384
385 property cli::array<Flag^>^ flags
386 {
387 cli::array<Flag^>^ get() {
388 std::vector<DaoAI::DeepLearning::Vision::ClassificationResult::Flag> native_flags = m_Instance->flags;
389 cli::array<Flag^>^ flags = gcnew cli::array<Flag^>(native_flags.size());
390 for (int i = 0; i < native_flags.size(); i++) {
391 flags[i] = gcnew Flag(native_flags[i]);
392 }
393 return flags;
394 }
395 }
396
397 property bool multilabel
398 {
399 bool get() {
400 return m_Instance->multilabel;
401 }
402 }
403 };
404
405 public ref class SupervisedDefectSegmentationResult : public ManagedObject<DaoAI::DeepLearning::Vision::SupervisedDefectSegmentationResult>
406 {
407 public:
408 SupervisedDefectSegmentationResult::SupervisedDefectSegmentationResult(const DaoAI::DeepLearning::Vision::SupervisedDefectSegmentationResult& result) : ManagedObject(new DaoAI::DeepLearning::Vision::SupervisedDefectSegmentationResult(result)) {}
409
410 String^ toJSONString();
412
413 property int height
414 {
415 int get() {
416 return m_Instance->image_width;
417 }
418 }
419 property int width
420 {
421 int get() {
422 return m_Instance->image_height;
423 }
424 }
425
426 property Dictionary<String^, Mask^>^ masks
427 {
428 Dictionary<String^, Mask^>^ get() {
429 Dictionary<String^, Mask^>^ masks = gcnew Dictionary<String^, Mask^>();
430 for (auto& pair : m_Instance->masks) {
431 masks[gcnew String(pair.first.c_str())] = gcnew Mask(pair.second);
432 }
433 return masks;
434 }
435 }
436
437 property String^ decision
438 {
439 String^ get() {
440 return gcnew String(m_Instance->decision.c_str());
441 }
442 }
443 };
444
445#ifdef INDUSTRIAL
446 public ref class PresenceCheckingResult : public ManagedObject<DaoAI::DeepLearning::Vision::PresenceCheckingResult>
447 {
448 public:
449 PresenceCheckingResult::PresenceCheckingResult(const DaoAI::DeepLearning::Vision::PresenceCheckingResult& result) : ManagedObject(new DaoAI::DeepLearning::Vision::PresenceCheckingResult(result)) {}
450
451 String^ toJSONString();
453
454 property int height
455 {
456 int get() {
457 return m_Instance->image_width;
458 }
459 }
460 property int width
461 {
462 int get() {
463 return m_Instance->image_height;
464 }
465 }
466
467 property int num_detections
468 {
469 int get() {
470 return m_Instance->num_detections;
471 }
472 }
473 property cli::array<Box^>^ boxes
474 {
475 cli::array<Box^>^ get() {
476 std::vector<DaoAI::DeepLearning::Box> native_boxes = m_Instance->boxes;
477 cli::array<Box^>^ boxes = gcnew cli::array<Box^>(native_boxes.size());
478 for (int i = 0; i < native_boxes.size(); i++) {
479 boxes[i] = gcnew Box(native_boxes[i]);
480 }
481 return boxes;
482 }
483 }
484 property cli::array<double>^ confidences
485 {
486 cli::array<double>^ get() {
487 cli::array<double>^ confidences = gcnew cli::array<double>(m_Instance->confidences.size());
488 for (int i = 0; i < m_Instance->confidences.size(); i++) {
489 confidences[i] = m_Instance->confidences[i];
490 }
491 return confidences;
492 }
493 }
494 property cli::array<int>^ class_ids
495 {
496 cli::array<int>^ get() {
497 cli::array<int>^ class_ids = gcnew cli::array<int>(m_Instance->class_ids.size());
498 for (int i = 0; i < m_Instance->class_ids.size(); i++) {
499 class_ids[i] = m_Instance->class_ids[i];
500 }
501 return class_ids;
502 }
503 }
504 property cli::array<String^>^ class_labels
505 {
506 cli::array<String^>^ get() {
507 std::vector<std::string> native_labels = m_Instance->class_labels;
508 cli::array<String^>^ labels = gcnew cli::array<String^>(native_labels.size());
509 for (int i = 0; i < native_labels.size(); i++) {
510 labels[i] = gcnew String(native_labels[i].c_str());
511 }
512 return labels;
513 }
514 }
515
516 property String^ decision
517 {
518 String^ get() {
519 return gcnew String(m_Instance->decision.c_str());
520 }
521 }
522 };
523
524 public ref class PositioningResult : public ManagedObject<DaoAI::DeepLearning::Vision::PositioningResult>
525 {
526 public:
527 PositioningResult::PositioningResult(const DaoAI::DeepLearning::Vision::PositioningResult& result) : ManagedObject(new DaoAI::DeepLearning::Vision::PositioningResult(result)) {}
528
529 String^ toJSONString();
531
532 property int height
533 {
534 int get() {
535 return m_Instance->image_width;
536 }
537 }
538 property int width
539 {
540 int get() {
541 return m_Instance->image_height;
542 }
543 }
544
545 property int num_detections
546 {
547 int get() {
548 return m_Instance->num_detections;
549 }
550 }
551 property cli::array<Box^>^ boxes
552 {
553 cli::array<Box^>^ get() {
554 std::vector<DaoAI::DeepLearning::Box> native_boxes = m_Instance->boxes;
555 cli::array<Box^>^ boxes = gcnew cli::array<Box^>(native_boxes.size());
556 for (int i = 0; i < native_boxes.size(); i++) {
557 boxes[i] = gcnew Box(native_boxes[i]);
558 }
559 return boxes;
560 }
561 }
562 property cli::array<double>^ confidences
563 {
564 cli::array<double>^ get() {
565 cli::array<double>^ confidences = gcnew cli::array<double>(m_Instance->confidences.size());
566 for (int i = 0; i < m_Instance->confidences.size(); i++) {
567 confidences[i] = m_Instance->confidences[i];
568 }
569 return confidences;
570 }
571 }
572 property cli::array<int>^ class_ids
573 {
574 cli::array<int>^ get() {
575 cli::array<int>^ class_ids = gcnew cli::array<int>(m_Instance->class_ids.size());
576 for (int i = 0; i < m_Instance->class_ids.size(); i++) {
577 class_ids[i] = m_Instance->class_ids[i];
578 }
579 return class_ids;
580 }
581 }
582 property cli::array<String^>^ class_labels
583 {
584 cli::array<String^>^ get() {
585 std::vector<std::string> native_labels = m_Instance->class_labels;
586 cli::array<String^>^ labels = gcnew cli::array<String^>(native_labels.size());
587 for (int i = 0; i < native_labels.size(); i++) {
588 labels[i] = gcnew String(native_labels[i].c_str());
589 }
590 return labels;
591 }
592 }
593
594 property cli::array<Mask^>^ masks
595 {
596 cli::array<Mask^>^ get() {
597 std::vector<DaoAI::DeepLearning::Mask> native_masks = m_Instance->masks;
598 cli::array<Mask^>^ masks = gcnew cli::array<Mask^>(native_masks.size());
599 for (int i = 0; i < native_masks.size(); i++) {
600 masks[i] = gcnew Mask(native_masks[i]);
601 }
602 return masks;
603 }
604 }
605
606 property cli::array<cli::array<Point^>^>^ keypoints
607 {
608 cli::array<cli::array<Point^>^>^ get() {
609 std::vector<std::vector<DaoAI::DeepLearning::Point>> native_keypoints = m_Instance->keypoints;
610 cli::array<cli::array<Point^>^>^ keypoints = gcnew cli::array<cli::array<Point^>^>(native_keypoints.size());
611 for (int i = 0; i < native_keypoints.size(); i++) {
612 keypoints[i] = gcnew cli::array<Point^>(native_keypoints[i].size());
613 for (int j = 0; j < native_keypoints[i].size(); j++) {
614 keypoints[i][j] = gcnew Point(native_keypoints[i][j]);
615 }
616 }
617 return keypoints;
618 }
619 }
620
621 property Point^ center
622 {
623 Point^ get() {
624 return gcnew Point(m_Instance->center);
625 }
626 }
627
628 property double angle
629 {
630 double get() {
631 return m_Instance->angle;
632 }
633 }
634
635 property String^ decision
636 {
637 String^ get() {
638 return gcnew String(m_Instance->decision.c_str());
639 }
640 }
641 };
642#endif // INDUSTRIAL
643 }
644 }
645}
646
Definition managed_object.h:18
DaoAI::DeepLearning::Vision::ObjectDetectionResult * m_Instance
Definition managed_object.h:20
InstanceSegmentationResult(const DaoAI::DeepLearning::Vision::InstanceSegmentationResult &result)
Definition prediction.h:96
KeypointDetectionResult::KeypointDetectionResult(const DaoAI::DeepLearning::Vision::KeypointDetectionResult &result)
Definition prediction.h:179
ObjectDetectionResult(const DaoAI::DeepLearning::Vision::ObjectDetectionResult &result)
Definition prediction.h:17
Definition common.cpp:6
Definition prediction.h:338
Flag(DaoAI::DeepLearning::Vision::ClassificationResult::Flag flag)
Definition prediction.h:340