Skip to content

Commit 1b33616

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 56561d1 + b05108d commit 1b33616

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

service/image_infer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ def __init__(self, model_path):
1414
self.cls_thresh = 0.5
1515
self.nms_thresh = 0.2
1616
self.model_path = model_path
17-
self.model_session = onnxruntime.InferenceSession(self.model_path)
17+
so = onnxruntime.SessionOptions()
18+
# 配置intra_op_num_threads为CPU核数时最佳
19+
so.intra_op_num_threads = 4
20+
self.model_session = onnxruntime.InferenceSession(self.model_path, sess_options=so)
1821

1922
def ui_infer(self, image_path):
2023
origin_img = cv2.imread(image_path)

0 commit comments

Comments
 (0)