[MediaVision][Non-ACR] Fix NullReference bug 49/215649/1
authorHaesu Gwon <haesu.gwon@samsung.com>
Mon, 14 Oct 2019 02:27:22 +0000 (11:27 +0900)
committerHaesu Gwon <haesu.gwon@samsung.com>
Mon, 14 Oct 2019 02:27:22 +0000 (11:27 +0900)
Change-Id: I2939795a465cf535286d00fcc8addd45f36539af

tct-suite-vs/Tizen.MediaVision.Tests/testcase/TSFaceDetector.cs
tct-suite-vs/Tizen.MediaVision.Tests/testcase/support/InferenceFaceTestBase.cs
tct-suite-vs/Tizen.MediaVision.Tests/testcase/support/InferenceImageTestBase.cs

index bfe626219540c6bafcf1a449305daa6111ac6de7..ae903079fd494292a4a34efc72c8484f9c4c3452 100644 (file)
@@ -38,33 +38,19 @@ namespace Tizen.Multimedia.Vision.Tests
             try
             {
                 _fdConfig = new InferenceModelConfiguration();
-            }
-            catch (NotSupportedException) when (FeatureChecker.IsSupported(Features.Inference) == false ||
-                FeatureChecker.IsSupported(Features.InferenceFaceDetection) == false)
-            {
-                _isInferenceSupported = false;
-            }
 
-            if (_fdConfig.SupportedBackend.Any())
-            {
-                _fdConfig.WeightFilePath = TestHelper.TFLitePath + "face_detector/fd_tflite_model1.tflite";
-                _fdConfig.MeanValue = 127.5;
-                _fdConfig.StdValue = 127.5;
-                _fdConfig.ConfidenceThreshold = 0.3;
-                _fdConfig.Backend = InferenceBackendType.TFLite;
-                _fdConfig.Target = InferenceTargetType.CPU;
-                _fdConfig.TensorSize = new Size(300, 300);
-                _fdConfig.TensorChannels = 3;
-                _fdConfig.InputNodeName = "normalized_input_image_tensor";
-                _fdConfig.OutputNodeName = new string[]
+                if (_fdConfig.SupportedBackend.Any() &&
+                    _fdConfig.SupportedBackend.Contains(InferenceBackendType.TFLite))
                 {
-                    "TFLite_Detection_PostProcess",
-                    "TFLite_Detection_PostProcess:1",
-                    "TFLite_Detection_PostProcess:2",
-                    "TFLite_Detection_PostProcess:3"
-                };
+                    Configure();
+                }
+                else
+                {
+                    _isInferenceSupported = false;
+                }
             }
-            else
+            catch (NotSupportedException) when (FeatureChecker.IsSupported(Features.Inference) == false ||
+                FeatureChecker.IsSupported(Features.InferenceFaceDetection) == false)
             {
                 _isInferenceSupported = false;
             }
@@ -80,6 +66,26 @@ namespace Tizen.Multimedia.Vision.Tests
             _fdConfig?.Dispose();
         }
 
+        private void Configure()
+        {
+            _fdConfig.WeightFilePath = TestHelper.TFLitePath + "face_detector/fd_tflite_model1.tflite";
+            _fdConfig.MeanValue = 127.5;
+            _fdConfig.StdValue = 127.5;
+            _fdConfig.ConfidenceThreshold = 0.3;
+            _fdConfig.Backend = InferenceBackendType.TFLite;
+            _fdConfig.Target = InferenceTargetType.CPU;
+            _fdConfig.TensorSize = new Size(300, 300);
+            _fdConfig.TensorChannels = 3;
+            _fdConfig.InputNodeName = "normalized_input_image_tensor";
+            _fdConfig.OutputNodeName = new string[]
+            {
+                    "TFLite_Detection_PostProcess",
+                    "TFLite_Detection_PostProcess:1",
+                    "TFLite_Detection_PostProcess:2",
+                    "TFLite_Detection_PostProcess:3"
+            };
+        }
+
         [Test]
         [Category("P1")]
         [Description("Tests face detection")]
index 268297551eeb31702372abd8b5a6834b8fbd32e5..cf064b318d7ae219e1a1f235e66a06057ea2ee82 100644 (file)
@@ -17,6 +17,16 @@ namespace Tizen.Multimedia.Vision.Tests
             {
                 _fdConfig = new InferenceModelConfiguration();
                 _fldConfig = new InferenceModelConfiguration();
+
+                if (_fdConfig.SupportedBackend.Any() &&
+                    _fdConfig.SupportedBackend.Contains(InferenceBackendType.TFLite))
+                {
+                    Configure();
+                }
+                else
+                {
+                    Assert.Pass("Backend engine is not supported.");
+                }
             }
             catch (NotSupportedException) when (FeatureChecker.IsSupported(Features.Inference) == false ||
                 FeatureChecker.IsSupported(Features.InferenceFaceDetection) == false)
@@ -28,16 +38,6 @@ namespace Tizen.Multimedia.Vision.Tests
             {
                 Log.Info("Tizen.MediaVision.Tests", $"Supported engine : {iter}");
             }
-
-            if (_fdConfig.SupportedBackend.Any() &&
-                _fdConfig.SupportedBackend.Contains(InferenceBackendType.TFLite))
-            {
-                Configure();
-            }
-            else
-            {
-                Assert.Pass("Backend engine is not supported.");
-            }
         }
 
         [TearDown]
index df7c86b109f42d765053567e31d30c992de8ad44..770fe6b295913e48c9d04c37ef17d1d9c2050a08 100644 (file)
@@ -17,22 +17,22 @@ namespace Tizen.Multimedia.Vision.Tests
             {
                 _odConfig = new InferenceModelConfiguration();
                 _icConfig = new InferenceModelConfiguration();
+
+                if (_odConfig.SupportedBackend.Any() &&
+                    _odConfig.SupportedBackend.Contains(InferenceBackendType.TFLite))
+                {
+                    Configure();
+                }
+                else
+                {
+                    Assert.Pass("Backend engine is not supported.");
+                }
             }
             catch (NotSupportedException) when (FeatureChecker.IsSupported(Features.Inference) == false ||
                 FeatureChecker.IsSupported(Features.ImageClassification) == false)
             {
                 Assert.Pass("object detection is not supported");
             }
-
-            if (_odConfig.SupportedBackend.Any() &&
-                _odConfig.SupportedBackend.Contains(InferenceBackendType.TFLite))
-            {
-                Configure();
-            }
-            else
-            {
-                Assert.Pass("Backend engine is not supported.");
-            }
         }
 
         [TearDown]