File size: 486 Bytes
0e0a0b2
 
 
 
28b686e
ebd9a0d
 
 
0e0a0b2
ebd9a0d
 
0e0a0b2
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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