Reputation: 1151
The following line of code
SchemaDefinition def = SchemaDefinition.Create(typeof(ImageData), SchemaDefinition.Direction.Read);
throws
System.ArgumentOutOfRangeException: 'Could not determine an IDataView type and registered custom types for member Image (Parameter 'rawType')'
when using Microsoft.ML.ImageAnalytics version 2.0.
The same code works with no exceptions in Microsoft.ML.ImageAnalytics version 1.71
The ImageData class is defined as follows:
public class ImageData
{
[ColumnName("image")]
[ImageType(height:100, width:100)]
public Bitmap Image { get; set; }
}
Is there anything that can be done in order to avoid this exception?
Upvotes: 1
Views: 440
Reputation: 31
As pointed in the question I did for the same issue, there is a breaking change in ML.NET 2.0 where, due to that System.Drawings is only supported by Windows, they have changed the class for image handling to MLImage (https://github.com/dotnet/machinelearning/blob/main/docs/release-notes/2.0/release-2.0.0.md#breaking-changes). So, they are suggesting to change the Bitmap class to their MLImage class.
Upvotes: 3