昇腾社区首页
中文
注册

Python样例

样例一

函数原型:

def SendDataWithUniqueId(streamName: bytes, inPluginId: int, dataInput: MxDataInput) -> int:

样例代码请参考{sdk_install_path}/samples/mxVision/python”目录下的“main.py”,详情参考Python运行步骤

样例二

函数原型:

def SendDataWithUniqueId(streamName: bytes, elementName: bytes, dataInput: MxDataInput) -> int:
ELEMENT_NAME = b'appsrc0'
unique_id = stream_manager_api.SendDataWithUniqueId(STREAM_NAME, ELEMENT_NAME, data_input)

infer_result_sample = stream_manager_api.GetResultWithUniqueId(STREAM_NAME, unique_id, 3000)
if infer_result_sample.errorCode != 0:
    print("GetResultWithUniqueId error. errorCode=%d, errorMsg=%s" % (
        infer_result_sample.errorCode, infer_result_sample.data.decode()))
    exit()
print("result: {}".format(infer_result_sample.data.decode()))