Ultra-Light-Fast-Generic-Face-Detector-1MB icon indicating copy to clipboard operation
Ultra-Light-Fast-Generic-Face-Detector-1MB copied to clipboard

trying to fix onnx conv

Open pauloamed opened this issue 4 years ago • 1 comments

Hi! First of all, awesome work you have here.

This is my first PR so I'm sorry if it gets a bit confusing.

So, I was trying to use the MNN python tester with input_size of 128 and that didn't work.

ValueError: operands could not be broadcast together with shapes (1,4420,2) (1,708,2)

By digging a bit, I found out that the priors (I assumed that this means priors probabilities of boxes (num of boxes)) value is related to the input_size and that will also be the output size of the model ([1,prior,4]). So at the error 4420 was the prior value for 320 input_size (the model size) and 128 the value for 128 as input_size.

Since this value hast to do with the model's architecture, I don't think that it would be legal to select a subset of these 4420 values or expand somehow the expected value of prior for images of input_size of 128.

So this was a problem of the way the models were being saved: the input_size is a decisive factor on the architecture and must be taken into account when saving it using torch.onnx. This is one of the fixes. However, pytorch updates have somehow released also a bug when using the export method. So one must use a previous version of pytorch in order to use this function. I suggest

torch==1.2.0 and torchvision==0.4.0

The other fix is on using the script for testing the camera while using a onnx model. I have also added some already converted models.

I really hope it helped.

Best regards, Paulo

pauloamed avatar Apr 04 '20 22:04 pauloamed

I read the paper and got what priors mean.

pauloamed avatar Apr 08 '20 05:04 pauloamed