/
InferenceModelConfiguration.cs
680 lines (621 loc) · 26.8 KB
/
InferenceModelConfiguration.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
/*
* Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using InteropInference = Interop.MediaVision.Inference;
namespace Tizen.Multimedia.Vision
{
/// <summary>
/// Represents a configuration of <see cref="FaceDetector"/>, <see cref="FacialLandmarkDetector"/>,
/// <see cref="ImageClassifier"/> and <see cref="ObjectDetector"/>.
/// </summary>
/// <remarks>
/// 'Inference model' means pre-learned data, which is represented by <see cref="ConfigurationFilePath"/> and
/// <see cref="WeightFilePath"/>, <see cref="CategoryFilePath"/>.<br/>
/// If user want to use tizen default inference model and its related value,
/// Please refer Tizen guide page(https://developer.tizen.org/development/guides/.net-application).
/// </remarks>
/// <feature>http://tizen.org/feature/vision.inference.face</feature>
/// <feature>http://tizen.org/feature/vision.inference.image</feature>
/// <since_tizen> 6 </since_tizen>
public class InferenceModelConfiguration : EngineConfiguration
{
private IntPtr _inferenceHandle = IntPtr.Zero;
private const string _keyModelConfigurationFilePath = "MV_INFERENCE_MODEL_CONFIGURATION_FILE_PATH";
private const string _keyModelWeightFilePath = "MV_INFERENCE_MODEL_WEIGHT_FILE_PATH";
private const string _keyModelUserFilePath = "MV_INFERENCE_MODEL_USER_FILE_PATH";
private const string _keyMetadataFilePath = "MV_INFERENCE_MODEL_META_FILE_PATH";
private const string _keyModelMeanValue = "MV_INFERENCE_MODEL_MEAN_VALUE"; // Deprecated
private const string _keyModelStdValue = "MV_INFERENCE_MODEL_STD_VALUE"; // Deprecated
private const string _keyBackendType = "MV_INFERENCE_BACKEND_TYPE";
private const string _keyTargetType = "MV_INFERENCE_TARGET_TYPE";
private const string _keyTargetDeviceType = "MV_INFERENCE_TARGET_DEVICE_TYPE";
private const string _keyInputTensorWidth = "MV_INFERENCE_INPUT_TENSOR_WIDTH"; // Deprecated
private const string _keyInputTensorHeight = "MV_INFERENCE_INPUT_TENSOR_HEIGHT"; // Deprecated
private const string _keyInputTensorChannels = "MV_INFERENCE_INPUT_TENSOR_CHANNELS"; // Deprecated
private const string _keyDataType = "MV_INFERENCE_INPUT_DATA_TYPE"; // Deprecated
private const string _keyInputNodeName = "MV_INFERENCE_INPUT_NODE_NAME"; // Deprecated
private const string _keyOutputNodeNames = "MV_INFERENCE_OUTPUT_NODE_NAMES"; // Deprecated
private const string _keyOutputMaxNumber = "MV_INFERENCE_OUTPUT_MAX_NUMBER"; // Deprecated
private const string _keyConfidenceThreshold = "MV_INFERENCE_CONFIDENCE_THRESHOLD"; // Deprecated
// The following strings are fixed in native and will not be changed.
private const string _backendTypeOpenCV = "opencv";
private const string _backendTypeTFLite = "tflite";
private const string _backendTypeArmNN = "armnn";
private const string _backendTypeMLApi = "mlapi";
private const string _backendTypeOne = "one";
/// <summary>
/// Initializes a new instance of the <see cref="InferenceModelConfiguration"/> class.
/// </summary>
/// <feature>http://tizen.org/feature/vision.inference.face</feature>
/// <feature>http://tizen.org/feature/vision.inference.image</feature>
/// <exception cref="NotSupportedException">The feature is not supported.</exception>
/// <since_tizen> 6 </since_tizen>
public InferenceModelConfiguration() : base("inference")
{
InteropInference.Create(out _inferenceHandle).Validate("Failed to create inference configuration");
}
/// <summary>
/// Loads inference model data and its related attributes.
/// </summary>
/// <remarks>
/// Before calling this method, user should set all properties which is required by each inference model.<br/>
/// The properties set after calling this method will not be affected in the result.
/// </remarks>
/// <privilege>http://tizen.org/privilege/mediastorage</privilege>
/// <privilege>http://tizen.org/privilege/externalstorage</privilege>
/// <feature>http://tizen.org/feature/vision.inference.face</feature>
/// <feature>http://tizen.org/feature/vision.inference.image</feature>
/// <exception cref="FileNotFoundException">
/// <see cref="ConfigurationFilePath"/>, <see cref="WeightFilePath"/> or <see cref="CategoryFilePath"/> have invalid path.
/// </exception>
/// <exception cref="FileFormatException">Invalid data type is used in inference model data.</exception>
/// <exception cref="InvalidDataException">
/// Inference model data contains unsupported operations in current backend version.
/// -or-<br/>
/// Invalid data type is used in inference model data.<br/>
/// </exception>
/// <exception cref="InvalidOperationException">Internal operation error.</exception>
/// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
/// <since_tizen> 6 </since_tizen>
public void LoadInferenceModel()
{
InteropInference.Configure(_inferenceHandle, GetHandle(this)).
Validate("Failed to configure inference model.");
var ret = InteropInference.Load(_inferenceHandle);
if (ret == MediaVisionError.InvalidData)
{
throw new InvalidDataException("Inference model data contains unsupported operations in current backend version.");
}
else if (ret == MediaVisionError.NotSupportedFormat)
{
throw new FileFormatException("Invalid data type is used in inference model data.");
}
ret.Validate("Failed to load inference model.");
}
internal IntPtr GetHandle()
{
return _inferenceHandle;
}
private IEnumerable<InferenceBackendType> _supportedBackend;
/// <summary>
/// Gets the list of inference backend engine which is supported in the current device.
/// </summary>
/// <returns>If there's no supported backend, empty collection will be returned.</returns>
/// <since_tizen> 6 </since_tizen>
public IEnumerable<InferenceBackendType> SupportedBackend
{
get
{
if (_supportedBackend == null)
{
GetSupportedBackend();
}
return _supportedBackend.Any() ? _supportedBackend : Enumerable.Empty<InferenceBackendType>();
}
}
private void GetSupportedBackend()
{
var supportedBackend = new List<InferenceBackendType>();
InteropInference.SupportedBackendCallback cb = (backend, isSupported, _) =>
{
if (isSupported && backend != null)
{
switch (backend)
{
case _backendTypeOpenCV:
supportedBackend.Add(InferenceBackendType.OpenCV);
break;
case _backendTypeTFLite:
supportedBackend.Add(InferenceBackendType.TFLite);
break;
case _backendTypeArmNN:
supportedBackend.Add(InferenceBackendType.ArmNN);
break;
case _backendTypeMLApi:
supportedBackend.Add(InferenceBackendType.MLApi);
break;
case _backendTypeOne:
supportedBackend.Add(InferenceBackendType.One);
break;
}
}
return true;
};
InteropInference.ForeachSupportedBackend(_inferenceHandle, cb, IntPtr.Zero).
Validate("Failed to get supported backend");
_supportedBackend = supportedBackend;
}
/// <summary>
/// Gets or sets the path of inference model's configuration data file.
/// </summary>
/// <exception cref="ArgumentNullException">Input file path is null.</exception>
/// <since_tizen> 6 </since_tizen>
public string ConfigurationFilePath
{
get
{
return GetString(_keyModelConfigurationFilePath);
}
set
{
if (value == null)
{
throw new ArgumentNullException(nameof(value), "File path is null.");
}
Set(_keyModelConfigurationFilePath, value);
}
}
/// <summary>
/// Gets or sets the path of inference model's weight file.
/// </summary>
/// <exception cref="ArgumentNullException">Input file path is null.</exception>
/// <since_tizen> 6 </since_tizen>
public string WeightFilePath
{
get
{
return GetString(_keyModelWeightFilePath);
}
set
{
if (value == null)
{
throw new ArgumentNullException(nameof(value), "File path is null.");
}
Set(_keyModelWeightFilePath, value);
}
}
/// <summary>
/// Gets or sets the path of inference model's category file.
/// </summary>
/// <remarks>
/// This value should be set to use <see cref="ImageClassifier"/> or <see cref="ObjectDetector"/>.
/// </remarks>
/// <exception cref="ArgumentNullException">Input file path is null.</exception>
/// <since_tizen> 6 </since_tizen>
public string CategoryFilePath
{
get
{
return GetString(_keyModelUserFilePath);
}
set
{
if (value == null)
{
throw new ArgumentNullException(nameof(value), "File path is null.");
}
Set(_keyModelUserFilePath, value);
}
}
/// <summary>
/// Gets or sets the path of inference model's metadata file.
/// </summary>
/// <remarks>
/// This value should be set to use <see cref="ImageClassifier"/> or <see cref="ObjectDetector"/>.
/// </remarks>
/// <exception cref="ArgumentNullException">Metadata file path is null.</exception>
/// <since_tizen> 9 </since_tizen>
public string MetadataFilePath
{
get
{
return GetString(_keyMetadataFilePath);
}
set
{
if (value == null)
{
throw new ArgumentNullException(nameof(value), "File path is null.");
}
Set(_keyMetadataFilePath, value);
}
}
/// <summary>
/// Gets or sets the inference model's mean value.
/// </summary>
/// <remarks>It should be greater than or equal to 0.</remarks>
/// <exception cref="ArgumentOutOfRangeException">The value is invalid.</exception>
/// <since_tizen> 6 </since_tizen>
[Obsolete("Deprecated since API9. Will be removed in API11. Please use MetadataFilePath instead.")]
public double MeanValue
{
get
{
return GetDouble(_keyModelMeanValue);
}
set
{
if (value < 0)
{
throw new ArgumentOutOfRangeException(nameof(value), value,
$"Value should be greater than or equal to 0");
}
Set(_keyModelMeanValue, value);
}
}
/// <summary>
/// Gets or sets the inference model's STD(Standard deviation) value.
/// </summary>
/// <remarks>It should be greater than or equal to 0.</remarks>
/// <exception cref="ArgumentOutOfRangeException">The value is invalid.</exception>
/// <since_tizen> 6 </since_tizen>
[Obsolete("Deprecated since API9. Will be removed in API11. Please use MetadataFilePath instead.")]
public double StdValue
{
get
{
return GetDouble(_keyModelStdValue);
}
set
{
if (value < 0)
{
throw new ArgumentOutOfRangeException(nameof(value), value,
$"Value should be greater than or equal to 0");
}
Set(_keyModelStdValue, value);
}
}
/// <summary>
/// Gets or sets the inference model's backend engine.
/// </summary>
/// <remarks>The default backend type is <see cref="InferenceBackendType.OpenCV"/></remarks>
/// <exception cref="ArgumentException"><paramref name="value"/> is not valid.</exception>
/// <exception cref="NotSupportedException">The engine type is not supported.</exception>
/// <seealso cref="SupportedBackend"/>
/// <since_tizen> 6 </since_tizen>
public InferenceBackendType Backend
{
get
{
return (InferenceBackendType)GetInt(_keyBackendType);
}
set
{
ValidationUtil.ValidateEnum(typeof(InferenceBackendType), value, nameof(Backend));
if (!SupportedBackend.Contains(value))
{
throw new NotSupportedException("Not supported engine type. " +
"Please check supported engine using 'SupportedBackendType'.");
}
Set(_keyBackendType, (int)value);
}
}
/// <summary>
/// Gets or sets the inference model's target.
/// </summary>
/// <remarks>
/// The default target is <see cref="InferenceTargetType.CPU"/>.<br/>
/// If target doesn't support <see cref="InferenceTargetType.GPU"/> and <see cref="InferenceTargetType.Custom"/>,
/// <see cref="InferenceTargetType.CPU"/> will be used internally, despite the user's choice.
/// </remarks>
/// <exception cref="ArgumentException"><paramref name="value"/> is not valid.</exception>
/// <since_tizen> 6 </since_tizen>
[Obsolete("Deprecated since API8. Will be removed in API10. Please use Device instead.")]
public InferenceTargetType Target
{
get
{
return (InferenceTargetType)GetInt(_keyTargetType);
}
set
{
ValidationUtil.ValidateEnum(typeof(InferenceTargetType), value, nameof(Target));
Set(_keyTargetType, (int)value);
}
}
/// <summary>
/// Gets or sets the processor type for inference models.
/// </summary>
/// <remarks>
/// The default device is <see cref="InferenceTargetDevice.CPU"/>.<br/>
/// If a device doesn't support <see cref="InferenceTargetDevice.GPU"/> and <see cref="InferenceTargetDevice.Custom"/>,
/// <see cref="InferenceTargetDevice.CPU"/> will be used internally, despite the user's choice.
/// </remarks>
/// <exception cref="ArgumentException"><paramref name="value"/> is not valid.</exception>
/// <since_tizen> 8 </since_tizen>
public InferenceTargetDevice Device
{
get
{
return (InferenceTargetDevice)GetInt(_keyTargetDeviceType);
}
set
{
ValidationUtil.ValidateEnum(typeof(InferenceTargetDevice), value, nameof(Device));
Set(_keyTargetDeviceType, (int)value);
}
}
/// <summary>
/// Gets or sets the size of inference model's tensor.
/// </summary>
/// <remarks>
/// Both width and height of tensor should be greater than 0.<br/>
/// 'Size(-1, -1) is allowed when the intention is to use original image source size as TensorSize.
/// </remarks>
/// <exception cref="ArgumentException">
/// Only one of <paramref name="value.Width"/> or <paramref name="value.Height"/> have -1.</exception>
/// <exception cref="ArgumentOutOfRangeException">The value is invalid.</exception>
/// <since_tizen> 6 </since_tizen>
[Obsolete("Deprecated since API9. Will be removed in API11. Please use MetadataFilePath instead.")]
public Size TensorSize
{
get
{
var width = GetInt(_keyInputTensorWidth);
var height = GetInt(_keyInputTensorHeight);
return new Size(width, height);
}
set
{
if ((value.Width == -1 && value.Height != -1) || (value.Height == -1 && value.Width != -1))
{
throw new ArgumentException("Both width and height must be set to -1, or greater than 0.");
}
if (value.Width == 0 || value.Width <= -2)
{
throw new ArgumentOutOfRangeException(nameof(value), value,
"Both width and height must be set to -1, or greater than 0.");
}
if (value.Height == 0 || value.Height <= -2)
{
throw new ArgumentOutOfRangeException(nameof(value), value,
"Both width and height must be set to -1, or greater than 0.");
}
Set(_keyInputTensorWidth, value.Width);
Set(_keyInputTensorHeight, value.Height);
}
}
/// <summary>
/// Gets or sets the number of inference model's tensor channel.
/// </summary>
/// <remarks>
/// For example, for RGB colorspace this value should be set to 3<br/>
/// It should be greater than 0.
/// </remarks>
/// <exception cref="ArgumentOutOfRangeException">The value is invalid.</exception>
/// <since_tizen> 6 </since_tizen>
[Obsolete("Deprecated since API9. Will be removed in API11. Please use MetadataFilePath instead.")]
public int TensorChannels
{
get
{
return GetInt(_keyInputTensorChannels);
}
set
{
if (value <= 0)
{
throw new ArgumentOutOfRangeException(nameof(value), value, "Tensor channel should be greater than 0.");
}
Set(_keyInputTensorChannels, value);
}
}
/// <summary>
/// Gets or sets the type of data used for inference model.
/// </summary>
/// <remarks>
/// For example, this value should be set to <see cref="InferenceDataType.Float32"/> for a model data supporting float32.<br/>
/// <see cref="InferenceDataType.Float32"/> will be used internally if a user doesn't set the value.
/// </remarks>
/// <exception cref="ArgumentException"><paramref name="value"/> is not valid.</exception>
/// <since_tizen> 8 </since_tizen>
[Obsolete("Deprecated since API9. Will be removed in API11. Please use MetadataFilePath instead.")]
public InferenceDataType DataType
{
get
{
return (InferenceDataType)GetInt(_keyDataType);
}
set
{
ValidationUtil.ValidateEnum(typeof(InferenceDataType), value, nameof(DataType));
Set(_keyDataType, (int)value);
}
}
/// <summary>
/// Gets or sets the name of an input node
/// </summary>
/// <exception cref="ArgumentNullException"><paramref name="value"/> is null.</exception>
/// <since_tizen> 6 </since_tizen>
[Obsolete("Deprecated since API9. Will be removed in API11. Please use MetadataFilePath instead.")]
public string InputNodeName
{
get
{
return GetString(_keyInputNodeName);
}
set
{
if (value == null)
{
throw new ArgumentNullException(nameof(value), "InputNodeName can't be null.");
}
Set(_keyInputNodeName, value);
}
}
/// <summary>
/// Gets or sets the name of an output node
/// </summary>
/// <exception cref="ArgumentNullException"><paramref name="value"/> is null.</exception>
/// <since_tizen> 6 </since_tizen>
[Obsolete("Deprecated since API9. Will be removed in API11. Please use MetadataFilePath instead.")]
public IList<string> OutputNodeName
{
get
{
return GetStringArray(_keyOutputNodeNames);
}
set
{
if (value == null)
{
throw new ArgumentNullException(nameof(value), "OutputNodeName can't be null.");
}
var name = new string[value.Count];
value.CopyTo(name, 0);
Set(_keyOutputNodeNames, name);
}
}
/// <summary>
/// Gets or sets the maximum output number of detection or classification.
/// </summary>
/// <remarks>
/// The input value over 10 will be set to 10 and the input value under 1 will be set to 1.<br/>
/// This value can be used to decide the size of <see cref="Roi"/>, it's length should be the same.
/// </remarks>
/// <since_tizen> 6 </since_tizen>
[Obsolete("Deprecated since API9. Will be removed in API11. Please use MetadataFilePath instead.")]
public int MaxOutputNumber
{
get
{
return GetInt(_keyOutputMaxNumber);
}
set
{
Set(_keyOutputMaxNumber, value > 10 ? 10 : value < 1 ? 1 : value);
}
}
/// <summary>
/// Gets or sets the threshold of confidence.
/// </summary>
/// <remarks>
/// The vaild range is greater than or equal to 0.0 and less than or equal to 1.0.<br/>
/// The value 1.0 means maximum accuracy.
/// </remarks>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="value"/>is out of range.</exception>
/// <since_tizen> 6 </since_tizen>
[Obsolete("Deprecated since API9. Will be removed in API11. Please use MetadataFilePath instead.")]
public double ConfidenceThreshold
{
get
{
return GetDouble(_keyConfidenceThreshold);
}
set
{
if (value < 0.0)
{
throw new ArgumentOutOfRangeException(nameof(value), value,
"Confidence threshold should be greater than or equal to 0.0.");
}
if (value > 1.0)
{
throw new ArgumentOutOfRangeException(nameof(value), value,
"Confidence threshold should be less than or equal to 1.0.");
}
Set(_keyConfidenceThreshold, value);
}
}
private Rectangle? _roi;
/// <summary>
/// Gets or sets the ROI(Region Of Interest) of <see cref="ImageClassifier"/> and <see cref="FacialLandmarkDetector"/>
/// </summary>
/// <remarks>
/// Default value is null. If Roi is null, the entire region of <see cref="MediaVisionSource"/> will be analyzed.
/// </remarks>
/// <exception cref="ArgumentOutOfRangeException">
/// The width of <paramref name="value"/> is less than or equal to zero.<br/>
/// -or-<br/>
/// The height of <paramref name="value"/> is less than or equal to zero.<br/>
/// -or-<br/>
/// The x position of <paramref name="value"/> is less than zero.<br/>
/// -or-<br/>
/// The y position of <paramref name="value"/> is less than zero.
/// </exception>
/// <seealso cref="MaxOutputNumber"/>
/// <since_tizen> 6 </since_tizen>
public Rectangle? Roi
{
get
{
return _roi;
}
set
{
if (value != null)
{
ValidateRoi(value.Value);
_roi = value;
}
}
}
private static void ValidateRoi(Rectangle roi)
{
if (roi.Width <= 0)
{
throw new ArgumentOutOfRangeException("Roi.Width", roi.Width,
"The width of roi can't be less than or equal to zero.");
}
if (roi.Height <= 0)
{
throw new ArgumentOutOfRangeException("Roi.Height", roi.Height,
"The height of roi can't be less than or equal to zero.");
}
if (roi.X < 0)
{
throw new ArgumentOutOfRangeException("Roi.X", roi.X,
"The x position of roi can't be less than zero.");
}
if (roi.Y < 0)
{
throw new ArgumentOutOfRangeException("Roi.Y", roi.Y,
"The y position of roi can't be less than zero.");
}
}
/// <summary>
/// Releases the resources used by the <see cref="InferenceModelConfiguration"/> object.
/// </summary>
/// <param name="disposing">
/// true to release both managed and unmanaged resources, otherwise false to release only unmanaged resources.
/// </param>
/// <since_tizen> 6 </since_tizen>
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (_inferenceHandle != IntPtr.Zero)
{
InteropInference.Destroy(_inferenceHandle).Validate("Failed to destroy inference configuration");
_inferenceHandle = IntPtr.Zero;
}
}
}
}