PINTO0309 / openvino2tensorflow

This script converts the ONNX/OpenVINO IR model to Tensorflow's saved_model, tflite, h5, tfjs, tftrt(TensorRT), CoreML, EdgeTPU, ONNX and pb. PyTorch (NCHW) -> ONNX (NCHW) -> OpenVINO (NCHW) -> openvino2tensorflow -> Tensorflow/Keras (NHWC/NCHW) -> TFLite (NHWC/NCHW). And the conversion from .pb to saved_model and from saved_model to .pb and from .pb to .tflite and saved_model to .tflite and saved_model to onnx. Support for building environments with Docker. It is possible to directly access the host PC GUI and the camera to verify the operation. NVIDIA GPU (dGPU) support. Intel iHD GPU (iGPU) support.
MIT License
334 stars 40 forks source link

Change the order of the results in the Result layer #83

Closed AlexisPapaioannou closed 2 years ago

AlexisPapaioannou commented 2 years ago

Is there any way to change the order in which the results appear in the result layers?

I have these outputs image

As a result this tflite model image

But I want first to appear the "Identity:0429" and then the others.

PINTO0309 commented 2 years ago

TensorFlow's optimizer changes the output order by itself, so my program cannot control it.

  1. .tflite to .json

    ../flatc -t --strict-json --defaults-json -o ../schema.fbs -- xxxx.tflite
  2. JSON rewrite. Open the JSON in the IDE, rewrite the order of the layers by hand, and save.

  3. .json to .tflite

    ../flatc -o . -b ../schema.fbs xxxx.json
PINTO0309 commented 2 years ago

If you have solved the problem, then you should write a solution for other engineers.