提问者:小点点

如何在C#alturos.yolo中预训练数据集YOLOv3


我正在使用alturos.yolo,自动配置alturos.yolov2tinyvocdata。但我想用Yolov3更改为手动配置。

我尝试了在https://github.com/alturosdestinations/alturos.yolo中使用guide预训练的数据集,但它仍然不起作用。

我的代码:

    private void btnOpen_Click(object sender, EventArgs e)
    {
        using (OpenFileDialog ofd = new OpenFileDialog() { Filter = "PNG|*.png|JPEG|*.jpeg|JPG|*.jpg" })
        {
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                pic.Image = Image.FromFile(ofd.FileName);
            }
        }
    }

    private async void btnDetect_ClickAsync(object sender, EventArgs e)
    {
        try
        {
            //var configurationDetector = new ConfigurationDetector();
            //var config = configurationDetector.Detect();

            //I tried replacing the default config as below

            var repository = new YoloPreTrainedDatasetRepository();
            await repository.DownloadDatasetAsync("YOLOv3", ".");
            using (var yoloWrapper = new YoloWrapper("yolov3.cfg", "yolov3.weights", "coco.names"))
            {
                using (MemoryStream ms = new MemoryStream())
                {
                    pic.Image.Save(ms, ImageFormat.Png);
                    var items = yoloWrapper.Detect(ms.ToArray());
                    yoloItemBindingSource.DataSource = items;

                }
            }

        }
        catch (Exception ex)
        {
            ex.ToString();
        }
        
    }

共1个答案

匿名用户

我找到了解决这个问题的办法