<output id="ighgh"><strong id="ighgh"><small id="ighgh"></small></strong></output>

  1. <table id="ighgh"></table>
  2. <tr id="ighgh"><label id="ighgh"></label></tr>
      <table id="ighgh"><option id="ighgh"></option></table>
      <big id="ighgh"><strike id="ighgh"></strike></big>

      <acronym id="ighgh"></acronym>
      返回列表
      神經網絡算法非傳統終端部署

      神經網絡算法非傳統終端部署

      隨著生產力的發展和以單片機為代表的微控制器的性能提高,越來越多的神經網絡模型可以部署在原來無法部署的平臺上,用來助力神經網絡算法在工業生產領域更好的發揮作用,尤其是在安防識別,故障檢測等領域卷積神經網絡一直都有著非常不錯的表現,下面我們就以Tensorflow這一種常見的神經網絡算法庫為例,簡單聊一下神經網絡算法如何部署到以單片機為代表的非傳統終端上。

      clip_image002.jpg

      TensorFlow Lite 簡介

      TensorFlow 可提供強大的功能,以便您在任何環境(包括服務器、邊緣設備、瀏覽器、移動設備、微控制器、CPU、GPU、FPGA)中部署模型。TensorFlow Serving 可以在先進的處理器(包括 Google 的自定義張量處理單元 [TPU])上以生產規模運行機器學習模型。
      如果您需要在靠近數據源的位置分析數據,以縮短延遲時間并更好地保護數據隱私,可以借助 TensorFlow Lite 框架在移動設備、邊緣計算設備甚至微控制器上運行模型,還可以借助 TensorFlow.js 框架僅使用網絡瀏覽器就能運行機器學習模型。

      TensorFlow Lite是google為深度學習在嵌入式物聯網應用而推出的輕量級框架。它提供了python、java和C++接口,同時可以將浮點運算轉換為整數運算,從而在特定的硬件平臺上加快推理速度。TensorFlow Lite使用的模型不是pb文件,而是更小的基于FlatBuffers的模型文件。

      TensorFlow Lite主要有兩個組件:推理組件和模型轉換組件。推理組件用于運行模型;模型轉換組件用于將需要的模型轉換為TensorFlow Lite模型文件。

      clip_image004.jpg

      TensorFlow Lite 部署模型

      1.   模型文件轉換:模型文件轉換以從session轉換為例,編程語言python。

      import tensorflow as tf

      img = tf.placeholder(name="img", dtype=tf.float32, shape=(1, 64, 64, 3))

      var = tf.get_variable("weights", dtype=tf.float32, shape=(1, 64, 64, 3))

      val = img + var

      out = tf.identity(val, name="out")

      with tf.Session() as sess:

      sess.run(tf.global_variables_initializer())

      converter = tf.lite.TFLiteConverter.from_session(sess, [img], [out])

      tflite_model = converter.convert()

      open("converted_model.tflite", "wb").write(tflite_model)

      2.   部署模型(加載模型文件)

      interpreter = tf.lite.Interpreter(model_path=tflite_file)

      interpreter.allocate_tensors()

      input_details = interpreter.get_input_details()

      output_details = interpreter.get_output_details()

      clip_image006.jpg

      TensorFlow Lite 實例(水果分類)

      部署運行后效果圖:

      clip_image008.jpg

      模型用途:在給定圖像或視頻流的情況下,目標檢測模型可以識別可能存在已知目標集合中的哪些目標,并提供關于它們在圖像中的位置的信息。

      部署步驟:

      1.   可以自行訓練模型或者到Tensorflow Lite Model Market中下載已經訓練好的模型。

      2.   將模型轉換成Model.tflite文件。

      3.   將文件傳輸到終端

      4.   加載模型文件Model.tflite 實現識別。

       

       

       

      參考文獻:https://tensorflow.google.cn/lite/examples/object_detection/overview?hl=zh-cn


      網站編輯:小優智能科技有限公司 發布時間:Oct 30,2023
      給我們留言
      驗證碼

      牛牛影视18禁网站在线播放_无码精品午夜在线视频观看_国产精品久久久久无码avapp_免费无码高潮喷水白浆直接观看
        <output id="ighgh"><strong id="ighgh"><small id="ighgh"></small></strong></output>

      1. <table id="ighgh"></table>
      2. <tr id="ighgh"><label id="ighgh"></label></tr>
          <table id="ighgh"><option id="ighgh"></option></table>
          <big id="ighgh"><strike id="ighgh"></strike></big>

          <acronym id="ighgh"></acronym>