Telemetry介紹
上一篇文章我們介紹了Intel Developer Cloud Telemetry的概念和功能,通過該功能的數(shù)據(jù)分析,可以更好地優(yōu)化產(chǎn)品方案。有關Telemetry 的工作原理和集成方法,我將在這篇文章里細細解釋。耐心看下去,相信您肯定可以在自己應用中開啟這個功能。Telemetry收集流程
| 圖 1-2 Telemetry收集數(shù)據(jù)流程概括來說,對自定義AI模型上運行模型優(yōu)化,由Intel OpenVINO進行推理,完成對AI模型的推理后,您就可以獲得計算節(jié)點上可用的遙測指標。具體步驟如下:1. 導入所有自定義模型文件(tensorflow、kaldi、onnx 等)2. 使用模型優(yōu)化器以必要的精度創(chuàng)建模型中間表示 (IR) 文件3. 創(chuàng)建用于在計算節(jié)點上提交運行推理的作業(yè)文件 (.sh)4. 使用 Application Metrics Writer 啟用遙測5. 為不同的計算節(jié)點提交作業(yè)并監(jiān)控作業(yè)狀態(tài)直到完成(提交作業(yè)會調(diào)用bash和自定義python文件)6. 在遙測儀表板上顯示模型指標注意:流程里不止包含Telemetry。而是AI應用在DevCloud上運行的流程,以便您可以了解Telemetry功能在應用里的位置。參考:https://www.embedded.com/enabling-telemetry-for-custom-models-in-intel-devcloud-for-the-edge/Telemetry集成
這次依然選擇object-detection-python實例來介紹集成方法,應用程序的 python 代碼中調(diào)用了applicationMetricWriter模塊向Telemetry傳遞數(shù)據(jù)指標如,幀率、推理時間、模型名稱、推理硬件信息,下面通過具體代碼來展示詳細信息。-
Step1. 登錄JupyterLab
-
Step2. 程序源碼分析
| 圖 3-1在Jupyter notebook里查看函數(shù)可以看到它只有兩個函數(shù),使用起來非常的簡單,我們來逐一介紹一下這兩個函數(shù)。send_inference_time() 用來向Telemetry 數(shù)據(jù)發(fā)送每一幀推送所消耗的時間,唯一要注意的是每一幀哦。這就要求你能區(qū)分每一幀推理的時間。如果你選擇async模式,就需要考慮是不是適用了。send_application_metrics 主要傳遞的是模型的名字和推理設備的名字,以便于你能更好地標記這個任務。看到這你估計跟我剛開始一樣,怎么沒有看到上傳CPU, GPU, Thermal 等數(shù)據(jù)上傳呢。其實是因為這些數(shù)據(jù)都是通用的,這塊就沒有必要放在用戶側(cè)來每次都重復寫一遍,在后端直接默認做了。從這里我們可以看到,最重要的數(shù)據(jù)還是推理時間的上傳。現(xiàn)在這兩個函數(shù)在程序里的調(diào)用時機,這里我注釋了沒有必要的代碼,以方便觀察。#!/usr/bin/env python
import applicationMetricWriter
...
def main():
...
try:
infer_time_start = time.time()
with open(processed_vid, "rb") as data:
while frame_count < video_len:
byte = data.read(CHUNKSIZE)
if not byte == b"":
deserialized_bytes = np.frombuffer(byte, dtype=np.uint8)
in_frame = np.reshape(deserialized_bytes, newshape=(n, c, h, w))
inf_time = time.time()
exec_net.start_async(request_id=current_inference,inputs={input_blob: in_frame})
# Retrieve the output of an earlier inference request
if previous_inference >= 0:
status = infer_requests[previous_inference].wait()
if status is not 0:
raise Exception("Infer request not completed successfully")
det_time = time.time() - inf_time
applicationMetricWriter.send_inference_time(det_time*1000)
res = output_postprocessor(exec_net.requests[previous_inference].output_blobs)
processBoxes(frame_count, res, labels_map, args.prob_threshold, width, height, result_file)
frame_count += 1
…
applicationMetricWriter.send_application_metrics(model_xml, args.device)
-
Step3.Telemetry數(shù)據(jù)訪問
| 圖 3-2 Telemetry地址
當然您也可以自己手動生成這樣一個連接,注意上圖中2框處的ID號。使用Telemetry 服務器地址拼接該ID號,即可訪問該數(shù)據(jù)。https://devcloud.intel.com/edge/metrics/d/+ID
比如:https://devcloud.intel.com/edge/metrics/d/573403訪問該路徑即可獲取Telemetry 的數(shù)據(jù)了。
| 圖 3-3 Telemetry界面總 結(jié)
看到這相信您一定理解了Intel Developer Cloud Telemetry 的集成方法了,它并沒有我們想象的那么復雜。我這里總結(jié)出來,只是為了方便剛開始接觸這塊的您更快上手,不用花費太多精力就可以更快的把事情搞定。如果您在使用過程中有碰到問題,期待一起交流。這篇就到這吧。審核編輯 :李倩
-
AI
+關注
關注
89文章
38091瀏覽量
296594 -
應用程序
+關注
關注
38文章
3342瀏覽量
59926 -
數(shù)據(jù)分析
+關注
關注
2文章
1506瀏覽量
35942
原文標題:Intel Developer Cloud Telemetry數(shù)據(jù)分析(二)
文章出處:【微信號:SDNLAB,微信公眾號:SDNLAB】歡迎添加關注!文章轉(zhuǎn)載請注明出處。
發(fā)布評論請先 登錄
Intel PXA27x Processor Family Developer's Manual
數(shù)據(jù)分析需要的技能
怎么有效學習Python數(shù)據(jù)分析?
BI分享秀——高度開放的數(shù)據(jù)分析經(jīng)驗共享
BI數(shù)據(jù)分析軟件使用指南
電商數(shù)據(jù)分析攻略,讓你輕松搞定數(shù)據(jù)分析!
數(shù)據(jù)分析步驟
IBM Cloud Pak for Data平臺讓數(shù)據(jù)分析變得更簡單
Intel? Developer Cloud Telemetry數(shù)據(jù)分析
Intel Developer Cloud Telemetry數(shù)據(jù)分析(一)
Intel Developer Cloud之Telemetry數(shù)據(jù)分析

Intel Developer Cloud Telemetry數(shù)據(jù)分析(二)
評論