def test_tflite_to_onnx_default_args(self): file_list = ["mobilenet.json", "mobilenet.onnx"] frontend = TFLiteFrontend() frontend.convert_tflite_to_onnx(tflite_path=self.tflite_input, export_path=self.output_path) self.assertTrue(tests.is_dir_contains(dirs=self.output_path, file_list=file_list))
def test_tflite_to_onnx(self): file_list = ["model.json", "model.onnx"] frontend = TFLiteFrontend(flatc_path=self.flat_c_path, schema_path=self.schema_path) frontend.convert_tflite_to_onnx(tflite_path=self.tflite_input, export_path=self.output_path) self.assertTrue( tests.is_dir_contains(dirs=self.output_path, file_list=file_list))
def test_tflite_to_onnx_no_schema_path(self): frontend = TFLiteFrontend(schema_path="") self.assertRaises( FileNotFoundError, lambda: frontend.convert_tflite_to_onnx( tflite_path=self.tflite_input, export_path=self.output_path))
def test_tflite_to_onnx_no_tflite_path(self): frontend = TFLiteFrontend() self.assertRaises( FileNotFoundError, lambda: frontend.convert_tflite_to_onnx( tflite_path=None, export_path=self.output_path))
from os import path from qumico.frontend import TFLiteFrontend if __name__ == "__main__": current_path = path.abspath(path.dirname(__file__)) tflite_path=path.join(current_path, "model", "mobilenet_v1_0.25_128_quant.tflite") output_path="onnx" frontend = TFLiteFrontend() frontend.convert_tflite_to_onnx(tflite_path=tflite_path, export_path=output_path)