machinelearning-samples icon indicating copy to clipboard operation
machinelearning-samples copied to clipboard

Update example OnnxObjectDetectionWeb from ML.NET 1.4.0 to 2.0.0 getting error?

Open xuanvuong1702 opened this issue 3 years ago • 1 comments

I changed the packages from 1.4.0 to 2.0.0 and got this error, apparently version 2.0.0 no longer has the Drawing.Common package, so I had to install it myself. I got an error

Unhandled exception. System.ArgumentOutOfRangeException: Could not determine an IDataView type and registered custom types for member Image (Parameter 'rawType')
   at Microsoft.ML.Data.InternalSchemaDefinition.GetVectorAndItemType(String name, Type rawType, IEnumerable`1 attributes, Boolean& isVector, Type& itemType)
   at Microsoft.ML.Data.InternalSchemaDefinition.GetVectorAndItemType(MemberInfo memberInfo, Boolean& isVector, Type& itemType)
   at Microsoft.ML.Data.SchemaDefinition.Create(Type userType, Direction direction)
   at Microsoft.ML.Data.InternalSchemaDefinition.Create(Type userType, Direction direction)
   at Microsoft.ML.Data.DataViewConstructionUtils.CreateFromEnumerable[TRow](IHostEnvironment env, IEnumerable`1 data, SchemaDefinition schemaDefinition)
   at Microsoft.ML.DataOperationsCatalog.LoadFromEnumerable[TRow](IEnumerable`1 data, SchemaDefinition schemaDefinition)
   at OnnxObjectDetection.OnnxModelConfigurator.SetupMlNetModel(IOnnxModel onnxModel) in /Users/phungvuong/Documents/coding/ML.NEt/MirrorLocation/OnnxObjectDetection/ML/OnnxModelConfigurator.cs:line 23
   at OnnxObjectDetection.OnnxModelConfigurator..ctor(IOnnxModel onnxModel) in /Users/phungvuong/Documents/coding/ML.NEt/MirrorLocation/OnnxObjectDetection/ML/OnnxModelConfigurator.cs:line 18
   at OnnxObjectDetectionWeb.Startup..ctor(IConfiguration configuration) in /Users/phungvuong/Documents/coding/ML.NEt/MirrorLocation/OnnxObjectDetectionWeb/Startup.cs:line 27
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services, Object instance)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass13_0.<UseStartup>b__0(HostBuilderContext context, IServiceCollection services)
   at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
   at Microsoft.Extensions.Hosting.HostBuilder.Build()

xuanvuong1702 avatar Nov 21 '22 00:11 xuanvuong1702

Not sure but one common fix is to use MLImage instead of Bitmap.

MrBean2016 avatar Jul 02 '23 21:07 MrBean2016