Skip to content

Commit

Permalink
Merge pull request #26 from huihuilong/feature/ui-infer-api
Browse files Browse the repository at this point in the history
fix:指定onnxruntime SessionOptions的intra_op_num_threads,解决centos7上pthre…
  • Loading branch information
BrightHai authored Apr 1, 2022
2 parents 080081d + 27b4e86 commit b05108d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion service/image_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ def __init__(self, model_path):
self.cls_thresh = 0.5
self.nms_thresh = 0.2
self.model_path = model_path
self.model_session = onnxruntime.InferenceSession(self.model_path)
so = onnxruntime.SessionOptions()
# 配置intra_op_num_threads为CPU核数时最佳
so.intra_op_num_threads = 4
self.model_session = onnxruntime.InferenceSession(self.model_path, sess_options=so)

def ui_infer(self, image_path):
origin_img = cv2.imread(image_path)
Expand Down

0 comments on commit b05108d

Please sign in to comment.