Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with custom yolov5 models in Winforms after publishing #79

Open
TheRedAppl opened this issue Mar 31, 2023 · 0 comments
Open

Issue with custom yolov5 models in Winforms after publishing #79

TheRedAppl opened this issue Mar 31, 2023 · 0 comments

Comments

@TheRedAppl
Copy link

TheRedAppl commented Mar 31, 2023

Hi there, I was attempting to publish a solution on winforms with a custom yolov5 model but it seems that loading the model causes the published application to not work. Here is an example of a program in which the published application failed (The custom model only detects one object).
`using System.Windows.Forms;
using Yolov5Net.Scorer;
using Yolov5Net.Scorer.Models.Abstract;

namespace yolov5netproblems
{
public partial class Form1 : Form
{
public class CustomDetector : YoloModel
{
public override int Width { get; set; } = 320;
public override int Height { get; set; } = 320;
public override int Depth { get; set; } = 3;

        public override int Dimensions { get; set; } = 6;

        public override int[] Strides { get; set; } = new int[] { 8, 16, 32 };

        public override int[][][] Anchors { get; set; } = new int[][][]
        {
        new int[][] { new int[] { 010, 13 }, new int[] { 016, 030 }, new int[] { 033, 023 } },
        new int[][] { new int[] { 030, 61 }, new int[] { 062, 045 }, new int[] { 059, 119 } },
        new int[][] { new int[] { 116, 90 }, new int[] { 156, 198 }, new int[] { 373, 326 } }
        };

        public override int[] Shapes { get; set; } = new int[] { 80, 40, 20 };

        public override float Confidence { get; set; } = 0.4f; //0.8f 0.25f
        public override float MulConfidence { get; set; } = 0.25f;
        public override float Overlap { get; set; } = 0.45f;

        public override string[] Outputs { get; set; } = new[] { "output0" };

        public override List<YoloLabel> Labels { get; set; } = new List<YoloLabel>()
    {
        new YoloLabel { Id = 1, Name = "custom" }
    };

        public override bool UseDetect { get; set; } = true;

        public CustomDetector()
        {

        }
    }
    YoloScorer<CustomDetector> scorer = new YoloScorer<CustomDetector>(@"custom.onnx");
    public Form1()
    {
        InitializeComponent();
    }
}

}
``
Do note that the program does work when being run on visual studio but fails when published

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant