nwesem / mtcnn_facenet_cpp_tensorRT

Face Recognition on NVIDIA Jetson (Nano) using TensorRT
GNU General Public License v3.0
207 stars 73 forks source link

Failed to convert facenet.pb model to facenet.onnx model #12

Open do-van-long opened 4 years ago

do-van-long commented 4 years ago

Hi @nwesem, Since converting a tensorflow model to UFF model will be deprecated in the future and transforming deep learning models to ONNX is becoming popular, I have tried to convert facenet.pb to facenet.onnx using tf2onnx but I have not succeeded. The problem is that there are some layers in facenet.pb that are not supported in tf2onnx. Have you ever tried to do that? or Could anyone give me some suggestions on how to DEBUG? One of the BUGs is File "/home/vanlong/.virtualenvs/facerecog/lib/python3.6/site-packages/tensorflow/python/framework/importer.py", line 430, in import_graph_def raise ValueError(str(e)) ValueError: Shape must be rank 4 but is rank 0 for 'InceptionResnetV1/Conv2d_1a_3x3/BatchNorm/batchnorm/mul' (op: 'Conv2D') with input shapes: [], [3,3,3,32].

nwesem commented 4 years ago

Have you found a solution to this issue yet @do-van-long ?

AnasMK commented 4 years ago

I have successfully converted Facenet to ONNX model. But, the facenet.pb file provided by this repo didn't work. I used facenet_keras.h5 provided in this tutorial and convert it to ONNX and then to TRT using this tutorial provided by Nvidia

AnasMK commented 4 years ago

Check this repo riotu-lab/tf2trt_with_onnx to covert Facenet model to TensorRT engine and use it with Python