dotnet / dotnet/machinelearning-samples

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

Open
#972 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PowerShell
Stars
4.7k
Forks
2.7k
Avg merge
2d 22h
Merged PRs (30d)
1

Description

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.b__0(HostBuilderContext context, IServiceCollection services)
at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the upgrade in the OnnxObjectDetectionWeb sample and start at ML/OnnxModelConfigurator.cs:23, where LoadFromEnumerable triggers the IDataView type error; Startup.cs:27 shows the application entry path. Compare the sample's ML.NET 1.4.0 and 2.0.0 package setup, then verify the example starts without the reported exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
machine-learning, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.