"docs/source/git@developer.sourcefind.cn:OpenDAS/dgl.git" did not exist on "c7b9f06946a69c9e7c6738c296f03a4c54b7b5c0"
Commit 9adcf60d authored by liuhy's avatar liuhy
Browse files

修改代码

parent 7673d3b4
...@@ -49,11 +49,10 @@ def LPRNetInference(model_name, imgs): ...@@ -49,11 +49,10 @@ def LPRNetInference(model_name, imgs):
if model_name[-3:] == 'mxr': if model_name[-3:] == 'mxr':
model = migraphx.load(model_name) model = migraphx.load(model_name)
else: else:
print('convert onnx to mxr...')
model = migraphx.parse_onnx(model_name) model = migraphx.parse_onnx(model_name)
# migraphx.quantize_fp16(model)
model.compile(t=migraphx.get_target("gpu"),device_id=0) # device_id: 设置GPU设备,默认为0号设备(>=1.2版本中支持) model.compile(t=migraphx.get_target("gpu"),device_id=0) # device_id: 设置GPU设备,默认为0号设备(>=1.2版本中支持)
path = model_name.split('/') migraphx.save(model, 'model/LPRNet.mxr')
migraphx.save(model, '/'.join((path[:-1], path[-1][-4]+'mxr')))
inputName=model.get_parameter_names()[0] inputName=model.get_parameter_names()[0]
inputShape=model.get_parameter_shapes()[inputName].lens() inputShape=model.get_parameter_shapes()[inputName].lens()
...@@ -65,8 +64,8 @@ def LPRNetInference(model_name, imgs): ...@@ -65,8 +64,8 @@ def LPRNetInference(model_name, imgs):
return result return result
if __name__ == '__main__': if __name__ == '__main__':
model_name = 'LPRNet.onnx' # model_name = 'model/LPRNet.onnx'
# model_name = 'model/LPRNet.mxr' model_name = 'model/LPRNet.mxr'
image = 'imgs/川JK0707.jpg' image = 'imgs/川JK0707.jpg'
InferRes = LPRNetInference(model_name, image) InferRes = LPRNetInference(model_name, image)
print(image, 'Inference Result:', InferRes) print(image, 'Inference Result:', InferRes)
No preview for this file type
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment