I'm trying to convert a tflite model to it's quantized version. (I try to convert the pose estimation module multi_person_mobilenet_v1_075_float.tflite hosted here) to it's quantized version.
I therefore installed the tflite_converter command line tool, recommended here. But the examples do not fit my case where I only have a *.tflite file and no corresponding frozen_graph.pb file.
Thus when I just call
tflite_convert --output_file multi_person_quant.tflite --saved_model_dir ./
from within the directory containing multi_person_mobilenet_v1_075_float.tflite, I get an error message:
IOError: SavedModel file does not exist at: .//{saved_model.pbtxt|saved_model.pb}
I guess I need a .pb file for whatever I want to do... Any idea how to generate it from the *.tflite file?
Any other advice would also be helpful.
Related
I am using nearest neighbour algorithm in the ML program. I am able to change program to .pb file but .pb file is not changing to tflite because of some error :-
RuntimeError: MetaGraphDef associated with tags {'serve'} could not be found in SavedModel, with available tags '[]'. To inspect available tag-sets in the SavedModel, please use the SavedModel CLI: saved_model_cli.
Please tell me how can I change .py to tflite.
I've been trying to compile my custom trained YoloV5 model using SageMaker Neo.
The compilation gives an error :
ClientError: InputConfiguration: No pth file found for PyTorch model.
Please make sure the framework you select is correct.
The weights are a .pt file.
Is there a way to convert the .pt file to .pth?
There is no difference between both file extensions. If SageMaker is only looking for a file with a .pth extension, then you can simply rename your file from filename.pt to filename.pth.
I am using Google Colabs to convert Yolov4 darknet weights to tflite version.
I used this blog to train my own yolo detector and I got to acceptable accuracy for my detections.
Then I tried every repository on github 1,2,3 to covert my custom yolov4 weights to tflite version and I failed in each time. I faced the problem (can not reshape array) here and I solved it by modifying file.names and adjusting the change in the config file. In the end when I executed this code:
!python convert_tflite.py --weights ./data/yolov4.weights --output ./data/yolov4.tflite
I faced this error:
ValueError: Input 0 of node model_1/batch_normalization/AssignNewValue was passed float from model_1/batch_normalization/FusedBatchNormV3/ReadVariableOp/resource:0 incompatible with expected resource.
This problem was discussed here but I couldn't find any solution
I am using google colab which make it easier with using the preinstalled libraries but maybe there could be some incomparability in libraries used in conversion ?
Any help would be appreciated..
I'm trying to use this model: https://github.com/zllrunning/face-makeup.PyTorch/blob/master/cp/79999_iter.pth with opencv dnn module but because opencv doesn't read .pth file, I need to convert it to another format.
First I tried to convert to .onnx, I found code to do it but when I call the function "torch.onnx.export", I got "RuntimeError: ONNX symbolic expected a constant value in the trace".
I tried with differrent version of torch but I always got almost the same error message.
I tried to convert to caffe model, there is some available github to do it but none of them worked for me.
I didn't find how to convert directly to tensorflow, they always convert to onnx and then to tensorflow.
If someone can share me a code that works for this model and the version of all packages used. Or if you could share me the model converted to another format, it would be greatly appreciated.
I am trying to get HDF5/H5 file from existing project in keras.
this attention_ocr is related to OCR written in python. I would like to generate HDF5/H5 file so I can convert that with tensorflowjs_converter[ref] and will use in browser.
Reference:
How to import a TensorFlow SavedModel into TensorFlow.js
Importing a Keras model into TensorFlow.js
I am looking for installing keras environment and generating HDF5/H5 file.
Once your model is trained in keras, saving it as an HDF5 is simply one line:
my_model.save('my_filename.h5')