小編這次要給大家分享的是如何實(shí)現(xiàn)keras .h5轉(zhuǎn)移動(dòng)端的.tflite文件,文章內(nèi)容豐富,感興趣的小伙伴可以來了解一下,希望大家閱讀完這篇文章之后能夠有所收獲。
以前tensorflow有bug 在winodws下無法轉(zhuǎn),但現(xiàn)在好像沒有問題了,代碼如下
將keras 下的mobilenet_v2轉(zhuǎn)成了tflite
from keras.backend import clear_session import numpy as np import tensorflow as tf clear_session() np.set_printoptions(suppress=True) input_graph_name = "../models/weights.best_mobilenet224.h6" output_graph_name = input_graph_name[:-3] + '.tflite' converter = tf.lite.TFLiteConverter.from_keras_model_file(model_file=input_graph_name) converter.post_training_quantize = True #在windows平臺這個(gè)函數(shù)有問題,無法正常使用 tflite_model = converter.convert() open(output_graph_name, "wb").write(tflite_model) print ("generate:",output_graph_name)
網(wǎng)頁題目:如何實(shí)現(xiàn)keras.h5轉(zhuǎn)移動(dòng)端的.tflite文件-創(chuàng)新互聯(lián)
文章分享:http://chinadenli.net/article30/dsjcpo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)網(wǎng)站建設(shè)、App設(shè)計(jì)、網(wǎng)站策劃、品牌網(wǎng)站建設(shè)、網(wǎng)站內(nèi)鏈、網(wǎng)站維護(hù)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容