PINTO0309 / tflite2tensorflow

Generate saved_model, tfjs, tf-trt, EdgeTPU, CoreML, quantized tflite, ONNX, OpenVINO, Myriad Inference Engine blob and .pb from .tflite. 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. Supports inverse quantization of INT8 quantization model.
https://qiita.com/PINTO
MIT License
258 stars 38 forks source link

I was trying to convert hair_segmentation.tflite in google colab. and getting following error. #2

Closed soham24 closed 3 years ago

soham24 commented 3 years ago

output json command = /content/flatbuffers/build/flatc -t --strict-json --defaults-json -o . /content/flatbuffers/build/schema.fbs -- /content/hair_segmentation.tflite Traceback (most recent call last): File "/usr/local/bin/tflite2tensorflow", line 2882, in main() File "/usr/local/bin/tflite2tensorflow", line 2556, in main ops, op_types = parse_json(jsonfile_path) File "/usr/local/bin/tflite2tensorflow", line 247, in parse_json j = json.load(open(jsonfile_path)) FileNotFoundError: [Errno 2] No such file or directory: './/content/hair_segmentation.json'

PINTO0309 commented 3 years ago

Colabo does not have enough permissions to access flatc. Please execute the following command. However, it does not seem to work properly on Google Colabo at the moment.

$ chmod +x flatc
soham24 commented 3 years ago

yeah you are right @PINTO0309 , I had tried with chmod but it was giving same error. I will try to build it on local machine Thank you so much for this this is great work friend

PINTO0309 commented 3 years ago

@soham24 The version has been upgraded to v1.3.0, adding support for building environments with Docker and support for Google Colab. Please see the README. The Docker procedure requires 10GB of free space on the host machine.

luannd commented 3 years ago

@PINTO0309 The output shape of the hair_segmentation tflite model is [1,512,512,2] but when I use your script to generate and invoke tfjs version, the model gives a tensor of [1,128,128,4] as output. Do you have any solutions?

soham24 commented 3 years ago

https://github.com/PINTO0309/tflite2tensorflow/issues/3#issuecomment-779851739

@PINTO0309 its same in the graph posted by on this issue 1,128,128,4 Is this some conversion issue?

PINTO0309 commented 3 years ago

Fixed bugs and upgraded to v1.3.5. hair_segmentation.tflite conversion is now supported. 97389f771960adaf94c23d662c757a1e519258b1

PINTO0309 commented 3 years ago

I've attached the converted .pb, saved_model and .tflite. saved_model.zip model_float32 tflite (2)

soham24 commented 3 years ago

it is fixed . thank you @PINTO0309