-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error scoring Tensorflow model mtcnn.pb. The second input must be a scalar, but it has shape [1,1] #5020
Comments
We're unfortunately not able to reproduce this error, as we can't load your model (apparently it was compiled on a CPU that doesn't support the AVX operator). Without being able to load your model myself, my guess is that your min_size and factor inputs are defined incorrectly. Your model appears to be expecting floats as inputs, but your InputData class defines them as float arrays. Try changing those two to floats, and see if that solves your problem. |
Thank you very much, Gopal, for your answer.
I had this previously, before changing to float array and decorating with VectorType(1), and the exception was: Maybe I'm missing some annotation? |
@dcostea sorry for late response, I tried your model file and code in latest ML.NET release version 1.5.2 and the model can be loaded correctly, could you please have a try and see if there is any more issue here, thanks. |
Hi Frank I'm able to load the model now but I have problems when trying to predict as it follows:
If I declare the parameter as float (single), I get this error:
If I declare the parameter as float[], I get this error:
If I declare the parameter as [VectorType(1)] float[], I get this error:
It looks like now the error is inside TensorFlow, but I'm stuck now. |
@dcostea The reason you got this error is your model is expecting float type for min_size column while in ML.NET we require all input columns be vector type(I don't know why ML.NET ask this yet, there is long history on this and I will need little more to investigate this see if we can remove this constraint from ML.NET). |
It makes perfect sense. Thank you!. |
@dcostea could you please share the image "anastasia3.jpg" used for test also share what is the predict result from python of this image? I'm working on a PR to support primitive type as input for Tensorflow model and I could use anastasia3.jpg to do some test, thanks. |
I will keep this issue open for now to track the work of enabling primitive type as input column for tensorflow transformer. @dcostea feel free to open new issue. |
I didn't train myself mtcnn model. That's why I said, "I will try" :) I need mtcnn model for another pet project to align a face in an image, before extracting the image features with arcface model (onnx format). I have the arcface part working well but it seems I'm not pre-processing correctly the image before feature extraction. I got the model from here: https://github.com/blaueck/tf-mtcnn/blob/master/mtcnn.pb I deployed the entire project here (image and model included): Thank you. |
Close this issue as fix has already been checked in, ML.NET will allow primitive types as input and output columns. |
Hi @frank-dong-ms |
System information
Issue
[[Node: _clooppnet/while/add/y/_2 = Switch[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](_clooppnet/while/add/y/_1, pnet/while/LoopCond/_135)]]
Source code / logs
Here is the mtcnn.pb model: mtcnn.zip
These are the inputs:
This is one of the outputs node (box):
The text was updated successfully, but these errors were encountered: