protected override ValueTask <IList <VideoFrame> > ExecuteTransform(IList <VideoFrame> input, CancellationToken cancellationToken)
        {
            if (input is null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            try
            {
                Logger.LogDebug("DoAnalysis: started");

                IList <DnnDetectedObject[]> result;

                if (input.Count > 0)
                {
                    _stopwatch.Restart();

                    result = _detector.ClassifyObjects(input, _detectionThreshold);

                    _stopwatch.Stop();
                    Logger.LogInformation("Classifiy-objects ms:{classifyDuration} for {imageCount} images", _stopwatch.ElapsedMilliseconds, input.Count);

                    _heartbeatReporter.ReportHeartbeat();

                    for (int i = 0; i < result.Count; i++)
                    {
                        //Attachs results to the right videoframe
                        input[i].Metadata.AnalysisResult = result[i];
                    }
                }
                else
                {
                    Logger.LogWarning("No images to run detector on");
                }

                Logger.LogDebug("DoAnalysis: done");
            }
            catch (Exception ae) when(True(() =>
                                           Logger.LogError("DoAnalysis: Exception from analysis task:{message}", ae.Message)))
#pragma warning disable S108 // Nested blocks of code should not be left empty
            {
            }
#pragma warning restore S108 // Nested blocks of code should not be left empty

            return(new ValueTask <IList <VideoFrame> >(input));
        }
        protected Task <AnalysisResult> DoAnalyzeFrames(IList <VideoFrame> frames, CancellationToken cancellationToken)
        {
            var output = new AnalysisResult(frames);

            try
            {
                Logger.LogDebug("DoAnalysis: started");

                var images = frames.Where(f => f.Image != null).Select(f => f.Image).ToList();

                DnnDetectedObject[][] result;

                if (images.Count > 0)
                {
                    var watch = new Stopwatch();
                    watch.Start();

                    result = _detector.ClassifyObjects(images);

                    watch.Stop();
                    Logger.LogInformation($"Classifiy-objects ms:{watch.ElapsedMilliseconds}");
                }
                else
                {
                    Logger.LogWarning("No images to run detector on");
                    result = Array.Empty <DnnDetectedObject[]>();
                }
                output.Analysis = result;

                Logger.LogDebug("DoAnalysis: done");
            }
#pragma warning disable CA1031 // Do not catch general exception types
            catch (Exception ae)
#pragma warning restore CA1031 // Do not catch general exception types
            {
                output.Exception = ae;
                Logger.LogDebug("DoAnalysis: Exception from analysis task:{message}", ae.Message);
            }

            return(Task.FromResult(output));
        }