9 lines
497 B
Python
9 lines
497 B
Python
import onnxruntime as ort
|
||
import numpy as np
|
||
sess = ort.InferenceSession("/home/admin-root/haotian/康达瑞贝斯机器狗/yolov8_20250820.onnx")
|
||
input_name = sess.get_inputs()[0].name
|
||
output_name = sess.get_outputs()[0].name
|
||
# 模拟输入(BCHW 格式)
|
||
input_data = np.random.randint(0, 255, (1, 3, 640, 640), dtype=np.uint8)
|
||
outputs = sess.run([output_name], {input_name: input_data.astype(np.float32)})
|
||
print("输出形状:", outputs[0].shape) # 应为 [1, 84, 8400](84=80类+4坐标) |