Telemetry介紹
上一篇文章我們介紹了Intel Developer Cloud Telemetry的概念和功能,通過該功能的數(shù)據(jù)分析,可以更好地優(yōu)化產(chǎn)品方案。有關(guān)Telemetry 的工作原理和集成方法,我將在這篇文章里細(xì)細(xì)解釋。耐心看下去,相信您肯定可以在自己應(yīng)用中開啟這個(gè)功能。Telemetry收集流程
| 圖 1-2 Telemetry收集數(shù)據(jù)流程概括來說,對(duì)自定義AI模型上運(yùn)行模型優(yōu)化,由Intel OpenVINO進(jìn)行推理,完成對(duì)AI模型的推理后,您就可以獲得計(jì)算節(jié)點(diǎn)上可用的遙測指標(biāo)。具體步驟如下:1. 導(dǎo)入所有自定義模型文件(tensorflow、kaldi、onnx 等)2. 使用模型優(yōu)化器以必要的精度創(chuàng)建模型中間表示 (IR) 文件3. 創(chuàng)建用于在計(jì)算節(jié)點(diǎn)上提交運(yùn)行推理的作業(yè)文件 (.sh)4. 使用 Application Metrics Writer 啟用遙測5. 為不同的計(jì)算節(jié)點(diǎn)提交作業(yè)并監(jiān)控作業(yè)狀態(tài)直到完成(提交作業(yè)會(huì)調(diào)用bash和自定義python文件)6. 在遙測儀表板上顯示模型指標(biāo)注意:流程里不止包含Telemetry。而是AI應(yīng)用在DevCloud上運(yùn)行的流程,以便您可以了解Telemetry功能在應(yīng)用里的位置。參考:https://www.embedded.com/enabling-telemetry-for-custom-models-in-intel-devcloud-for-the-edge/Telemetry集成
這次依然選擇object-detection-python實(shí)例來介紹集成方法,應(yīng)用程序的 python 代碼中調(diào)用了applicationMetricWriter模塊向Telemetry傳遞數(shù)據(jù)指標(biāo)如,幀率、推理時(shí)間、模型名稱、推理硬件信息,下面通過具體代碼來展示詳細(xì)信息。-
Step1. 登錄JupyterLab
-
Step2. 程序源碼分析
| 圖 3-1在Jupyter notebook里查看函數(shù)可以看到它只有兩個(gè)函數(shù),使用起來非常的簡單,我們來逐一介紹一下這兩個(gè)函數(shù)。send_inference_time() 用來向Telemetry 數(shù)據(jù)發(fā)送每一幀推送所消耗的時(shí)間,唯一要注意的是每一幀哦。這就要求你能區(qū)分每一幀推理的時(shí)間。如果你選擇async模式,就需要考慮是不是適用了。send_application_metrics 主要傳遞的是模型的名字和推理設(shè)備的名字,以便于你能更好地標(biāo)記這個(gè)任務(wù)。看到這你估計(jì)跟我剛開始一樣,怎么沒有看到上傳CPU, GPU, Thermal 等數(shù)據(jù)上傳呢。其實(shí)是因?yàn)檫@些數(shù)據(jù)都是通用的,這塊就沒有必要放在用戶側(cè)來每次都重復(fù)寫一遍,在后端直接默認(rèn)做了。從這里我們可以看到,最重要的數(shù)據(jù)還是推理時(shí)間的上傳。現(xiàn)在這兩個(gè)函數(shù)在程序里的調(diào)用時(shí)機(jī),這里我注釋了沒有必要的代碼,以方便觀察。#!/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地址
當(dāng)然您也可以自己手動(dòng)生成這樣一個(gè)連接,注意上圖中2框處的ID號(hào)。使用Telemetry 服務(wù)器地址拼接該ID號(hào),即可訪問該數(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 的集成方法了,它并沒有我們想象的那么復(fù)雜。我這里總結(jié)出來,只是為了方便剛開始接觸這塊的您更快上手,不用花費(fèi)太多精力就可以更快的把事情搞定。如果您在使用過程中有碰到問題,期待一起交流。這篇就到這吧。審核編輯 :李倩
-
AI
+關(guān)注
關(guān)注
91文章
41101瀏覽量
302579 -
應(yīng)用程序
+關(guān)注
關(guān)注
38文章
3346瀏覽量
60419 -
數(shù)據(jù)分析
+關(guān)注
關(guān)注
2文章
1523瀏覽量
36360
原文標(biāo)題:Intel Developer Cloud Telemetry數(shù)據(jù)分析(二)
文章出處:【微信號(hào):SDNLAB,微信公眾號(hào):SDNLAB】歡迎添加關(guān)注!文章轉(zhuǎn)載請注明出處。
發(fā)布評(píng)論請先 登錄
Intel PXA27x Processor Family Developer's Manual
數(shù)據(jù)分析需要的技能
怎么有效學(xué)習(xí)Python數(shù)據(jù)分析?
BI分享秀——高度開放的數(shù)據(jù)分析經(jīng)驗(yàn)共享
BI數(shù)據(jù)分析軟件使用指南
成為Python數(shù)據(jù)分析師,需要掌握哪些技能
電商數(shù)據(jù)分析攻略,讓你輕松搞定數(shù)據(jù)分析!
數(shù)據(jù)分析步驟
IBM Cloud Pak for Data平臺(tái)讓數(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ù)分析(二)
評(píng)論