Open YanYas opened 5 years ago
To add, I'm using CNTK 2.6 with C#. The model I downloaded can be found in the Onnx official model zoo.
Further testing with the creation of the Value hasn't changed the error, so the "1 x 1 x 1000 x *" is perhaps a problem from the Onnx model loader? I can't use MLNET for evaluation at the moment, so is there a chance this problem has a fix in the CNTK 2.7 betas?
Was anyone able to replicate this error or is this only something I'm seeing on my side?
@YanYas I have the same problem. I've loaded YoloV2 onnx where input layer has shape [416, 416, 3, -3] (-3 is batch axis), but I need shape ([w, h, 3], [*, #]). Well, with some tricks I've achieved my goal and got this shape, but now I have same error.
Hi @elevir, I think I finally figured this one out.
Assuming that you have the shape right, and it certainly looks like you do the problem was fixed by reconciling the dynamic axes of the imported model and input that you want to use for it.
A bit of pseudocode for you to get the gist:
input = inputvariable();
model = loadModel("model.onnx");
model = reconcileDynamicAxis(model, input);
output = model.evaluate(input);
Let me know if it helps
hi @YanYas, I tried to read the onnx model into cntk, so I saw the same error. I am trying to solve it with reconciledynamicaxis, but I am not sure, so I ask.
In the case of imagenet classification, since the above input corresponds to an image, it has a dimension of 224,224,3, and the corresponding onnx model is read from cntk, so the argument is 224,224,3,1.
Even if after reconcileDynamicAxis, 224,224,3,1 does not change and an error occurs as it is.
I need more detail, please.
Hi @lordofmaster, sorry I didn't see this sooner and I haven't used CNTK is a while. If you see the model asString what sorts of symbols does it show? do you see 224,224,3,# ? The reconciled model should have that
Loading ONNX models (version 1.2) I come across an error when I try to evaluate them.
My current test SqueezeNet model:
Input('data_0', [224 x 224 x 3 x 1], []) Output('Block4416_Output_0', [1 x 1 x 1000 x *], [])
I try replacing the input:Input('My image', [224 x 224 x 3 x 1], [*, #])
The resulting string of the Function:Composite(Softmax_onnx): Input('My image', [224 x 224 x 3 x 1], [*, #]) -> Output('Block5319_Output_0', [1 x 1 x 1000 x *], [])
I'm not actually using a minibatch, but I am using a Batch operation to create the Value so I have greater flexibility. However, the whole value, including the number of images is set in the shape of the Batch. Does the Value need to be created in a different manner?