faced icon indicating copy to clipboard operation
faced copied to clipboard

Model in Keras or ONNX format?

Open BenillaIce opened this issue 5 years ago • 2 comments

Hi! This looks really promising and interesting, good work! Would it be possible to get the actual trained model either in Keras format (.h5) or in ONNX? I'd like to use the model in MATLAB, but I can only import either Keras or ONNX formats.

BenillaIce avatar Nov 23 '18 09:11 BenillaIce

Good point. Right now, only tensorflow format is supported, as this was the framework that I used for training.

I'm planning to release the training scripts soon, so that anyone can replicate the architecture/training strategy with another framework!

iitzco avatar Nov 24 '18 15:11 iitzco

I was able to convert the face detector to ONNX. I made a fork with an example usage for the C# ONNX Runtime: https://github.com/brianpopow/faced

The conversion was done like this:

python -m tf2onnx.convert --verbose --input face_yolo.pb --opset 15 --inputs img:0 --use_default img --outputs prob:0,x_center:0,y_center:0,w:0,h:0 --output faced.onnx

Unfortunately converting the face corrector network to ONNX did not work as expected. The produced outputs does not seem to match the original network.

It still works reasonable good without the corrector in my opinion and is also fast. On my CPU it takes 40 to 45 ms to detect the faces and that includes loading the image and resize it to 288x288.

Here is an example: output

brianpopow avatar May 02 '22 17:05 brianpopow