Closed ibebbs closed 4 years ago
@ibebbs take a look at this sample. I think it might help you do what you want.
Notice to train it uses ImageData
but to score it uses InMemoryImageData
. Difference being, ImageData
uses a path and InMemoryImageData
uses byte[].
Hi @ibebbs , so I read on Gitter that the sample that @luisquintanilla provided was enough for you to solve your problem. I will close this issue now. Feel free to reopen this if you still have problems with this. 😄
Hi,
Just started playing with Microsoft.ML and am pretty impressed. I followed this tutorial to build an image classifier model that works reasonably well (limited training data). I now want to put this model to use but have hit an issue:
The images I want to classify will be in-memory (as a Bitmap) but the trained model seems to need the images on disk. Obviously I could save the image to a temporary file but this seems wasteful when the model will need to read it back in again. From what I can see in the source code, the "LoadRawImageBytes" transform from the [Model Builder generated] pipeline shown below doesn't have any kind of overload for loading in-memory data:
After a lot of searching I found this issue in which @huy-lv asks how to do pretty much exactly what I want to do. @Lynx1820 replied pointing to this sample which I have endeavoured to follow.
I now have the following pipeline:
But when I try to train the model (with
trainingPipeline.Fit(trainingData)
) I receive the error:Schema mismatch for feature column 'Features': expected VarVector<Byte>, got Vector<Byte> '
Could you provide an example of how to use
Transforms.ExtractPixels
withMulticlassClassification.Trainers.ImageClassification
or suggestions on how to train/predict from an in-memoryBitmap
source?Thanks!