Ejemplo n.º 1
0
        private async Task StartTrackingAsync()
        {
            buttonStartTracking.Enabled = false;

            var imageInfo = GetCurrentImage();

            var yoloTracking = new YoloTracking(imageInfo.Width, imageInfo.Height);
            var count        = dataGridViewFiles.RowCount;

            for (var i = 0; i < count; i++)
            {
                if (i > 0)
                {
                    dataGridViewFiles.Rows[i - 1].Selected = false;
                }

                dataGridViewFiles.Rows[i].Selected = true;
                dataGridViewFiles.CurrentCell      = dataGridViewFiles.Rows[i].Cells[0];

                var items = Detect();

                var trackingItems = yoloTracking.Analyse(items);
                DrawBoundingBoxes(trackingItems);

                await Task.Delay(100);
            }

            buttonStartTracking.Enabled = true;
        }
Ejemplo n.º 2
0
        static void TestTracking()
        {
            Directory.CreateDirectory("trackingImages");

            var configurationDetector = new ConfigurationDetector();
            var config = configurationDetector.Detect();

            using (var yoloWrapper = new YoloWrapper(config))
            {
                var yoloTracking = new YoloTracking(yoloWrapper, 200);

                yoloTracking.SetTrackingObject(new Point(216, 343));
                var files = Directory.GetFiles(@"test");

                //yoloTracking.SetTrackingObject(new Point(385, 480));
                //var files = Directory.GetFiles(@"test3");

                foreach (var file in files)
                {
                    var imageData    = File.ReadAllBytes(file);
                    var trackingItem = yoloTracking.Analyse(imageData);
                    if (trackingItem == null)
                    {
                        continue;
                    }

                    var fileInfo = new FileInfo(file);
                    File.WriteAllBytes($@"trackingImages\{trackingItem.Index}.bmp", trackingItem.TaggedImageData);
                }
            }

            Console.ReadLine();
        }
Ejemplo n.º 3
0
        //without validation i.e., output all yolo detections
        public FrameDNNDarknet(string modelConfig, DNNMode dnnMode)
        {
            var configurationDetector = new ConfigurationDetector(modelConfig);

            frameYolo         = new YoloWrapper(configurationDetector.Detect(), dnnMode);
            frameYoloTracking = new YoloTracking(frameYolo);
        }
Ejemplo n.º 4
0
        //distance-based validation
        public FrameDNNDarknet(string modelConfig, DNNMode dnnMode, double rFactor)
        {
            var configurationDetector = new ConfigurationDetector(modelConfig);

            frameYolo         = new YoloWrapper(configurationDetector.Detect(), dnnMode);
            frameYoloTracking = new YoloTracking(frameYolo, Convert.ToInt32(DNNConfig.ValidRange * rFactor));
        }
Ejemplo n.º 5
0
        //overlap ratio-based validation
        public FrameDNNDarknet(string modelConfig, DNNMode dnnMode, List <Tuple <string, int[]> > lines)
        {
            var configurationDetector = new ConfigurationDetector(modelConfig);

            frameYolo         = new YoloWrapper(configurationDetector.Detect(), dnnMode);
            frameYoloTracking = new YoloTracking(frameYolo);
            _lines            = lines;
        }