CV_parsing / src /inference /segment_inference.py
ABAO77's picture
test code
28b686e
raw
history blame contribute delete
486 Bytes
import onnxruntime as ort
from src.utils.utils_segment import preprocess, postprocess
import numpy as np
model_path = "./src/model/best.onnx"
model = ort.InferenceSession(
model_path,
)
def inference(image: np.array, threshold_confidence=0.5, threshold_iou=0.7):
input = preprocess(image)
outputs = postprocess(
model.run(None, {"images": input}),
threshold_confidence=threshold_confidence,
threshold_iou=threshold_iou,
)
return outputs