MLECO-2492 Add CPP OD example with TFLITE-ArmnnDelegate

Signed-off-by: Dvir Markovich <dvir.markovich@arm.com>
Change-Id: If412c15ba49abe8370a570260b0a8ed8de305b7c
diff --git a/samples/ObjectDetection/src/Main.cpp b/samples/ObjectDetection/src/Main.cpp
index e057981..8bc2f0d 100644
--- a/samples/ObjectDetection/src/Main.cpp
+++ b/samples/ObjectDetection/src/Main.cpp
@@ -20,6 +20,7 @@
 const std::string OUTPUT_VIDEO_FILE_PATH = "--output-video-file-path";
 const std::string LABEL_PATH = "--label-path";
 const std::string PREFERRED_BACKENDS = "--preferred-backends";
+const std::string PROFILING_ENABLED = "--profiling_enabled";
 const std::string HELP = "--help";
 
 /*
@@ -29,13 +30,16 @@
         {VIDEO_FILE_PATH, "[REQUIRED] Path to the video file to run object detection on"},
         {MODEL_FILE_PATH, "[REQUIRED] Path to the Object Detection model to use"},
         {LABEL_PATH, "[REQUIRED] Path to the label set for the provided model file. "
-                     "Label file is should just be an ordered list, seperated by new line."},
+                     "Label file  should be an ordered list, separated by a new line."},
         {MODEL_NAME, "[REQUIRED] The name of the model being used. Accepted options: YOLO_V3_TINY, SSD_MOBILE"},
         {OUTPUT_VIDEO_FILE_PATH, "[OPTIONAL] Path to the output video file with detections added in. "
                                  "If specified will save file to disk, else displays the output to screen"},
         {PREFERRED_BACKENDS, "[OPTIONAL] Takes the preferred backends in preference order, separated by comma."
                              " For example: CpuAcc,GpuAcc,CpuRef. Accepted options: [CpuAcc, CpuRef, GpuAcc]."
-                             " Defaults to CpuAcc,CpuRef"}
+                             " Defaults to CpuAcc,CpuRef"},
+        {PROFILING_ENABLED, "[OPTIONAL] Enabling this option will print important ML related milestones timing"
+                            "information in micro-seconds. By default, this option is disabled."
+                            "Accepted options are true/false."}
 };
 
 /*
@@ -137,6 +141,10 @@
     pipelineOptions.m_ModelFilePath = GetSpecifiedOption(options, MODEL_FILE_PATH);
     pipelineOptions.m_ModelName = GetSpecifiedOption(options, MODEL_NAME);
 
+    if (CheckOptionSpecified(options, PROFILING_ENABLED))
+    {
+        pipelineOptions.m_ProfilingEnabled = GetSpecifiedOption(options, PROFILING_ENABLED) == "true";
+    }
     if(CheckOptionSpecified(options, PREFERRED_BACKENDS))
     {
         pipelineOptions.m_backends = GetPreferredBackendList((GetSpecifiedOption(options, PREFERRED_BACKENDS)));
@@ -148,6 +156,8 @@
 
     auto labels = AssignColourToLabel(GetSpecifiedOption(options, LABEL_PATH));
 
+    common::Profiling profiling(pipelineOptions.m_ProfilingEnabled);
+    profiling.ProfilingStart();
     od::IPipelinePtr objectDetectionPipeline = od::CreatePipeline(pipelineOptions);
 
     auto inputAndOutput = GetFrameSourceAndSink(options);
@@ -180,5 +190,6 @@
         frame = reader->ReadFrame();
     }
     sink->Close();
+    profiling.ProfilingStopAndPrintUs("Overall compute time");
     return 0;
 }