MLNetExamples icon indicating copy to clipboard operation
MLNetExamples copied to clipboard

CustomVisionOnnx won't work properly after upgrading to ML. NET 2.0

Open BigHeadDev opened this issue 2 years ago • 1 comments

I can confirm that the problem is with the nuget package Microsoft.ML.ImageAnalytics Due to some changes in its dependency during the process from 1. x to 2.0, it no longer relies on System.Drawing.Common image image

The following code snippet shows the key errors:

public class WineInput {// C# Input Mapping
        [ImageType(ImageSettings.imageWidth, ImageSettings.imageHeight)]
        public Bitmap Image { get; set; }
    }
    public struct ImageSettings {
        public const int imageHeight = 416;
        public const int imageWidth = 416;
    }
MLContext context = new MLContext();
            var emptyData = new List<WineInput>();
            var data = context.Data.LoadFromEnumerable(emptyData);// Error!

How should I modify the code to use Microsoft.ML.ImageAnalytics 2.0

Thank you very much for the video posted on Youtube and learning a lot~I hope you can help me solve this problem 😁

BigHeadDev avatar Mar 17 '23 11:03 BigHeadDev

Sorry for the late reply. I think 2.0 removed some image packages in favor of some that are more cross platform. I do have a plan to make a video that updates the Custom Vision Object Detection scenario where you build an object detection model in Custom Vision and use it in ML.NET. Hope that will help!

jwood803 avatar May 20 '23 03:05 jwood803