Telemetry介绍
上一篇文章我们介绍了Intel Developer Cloud Telemetry的概念和功能,通过该功能的数据分析,可以更好地优化产品方案。有关Telemetry 的工作原理和集成方法,我将在这篇文章里细细解释。耐心看下去,相信您肯定可以在自己应用中开启这个功能。Telemetry收集流程
Telemetry集成
这次依然选择object-detection-python实例来介绍集成方法,应用程序的 python 代码中调用了applicationMetricWriter模块向Telemetry传递数据指标如,帧率、推理时间、模型名称、推理硬件信息,下面通过具体代码来展示详细信息。Step1. 登录Jupyter Lab
Step2. 程序源码分析
#!/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数据访问
https://devcloud.intel.com/edge/metrics/d/ + ID
比如:https://devcloud.intel.com/edge/metrics/d/573403 访问该路径即可获取Telemetry 的数据了。总 结
看到这相信您一定理解了Intel Developer Cloud Telemetry 的集成方法了,它并没有我们想象的那么复杂。我这里总结出来,只是为了方便刚开始接触这块的您更快上手,不用花费太多精力就可以更快的把事情搞定。如果您在使用过程中有碰到问题,期待一起交流。这篇就到这吧。
全部0条评论
快来发表一下你的评论吧 !