Skip to content

Commit 4be2f37

Browse files
committed
fix bug
1 parent 985ee32 commit 4be2f37

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

preprocess/humanparsing/run_parsing.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from pathlib import Path
2+
import os
23
import sys
34
import onnxruntime as ort
45
PROJECT_ROOT = Path(__file__).absolute().parents[0].absolute()
@@ -9,14 +10,16 @@
910
class Parsing:
1011
def __init__(self, atr_path, lip_path):
1112
session_options = ort.SessionOptions()
13+
session_options.inter_op_num_threads = os.cpu_count() // 2
14+
session_options.intra_op_num_threads = os.cpu_count() // 2
1215
session_options.graph_optimization_level = ort.GraphOptimizationLevel.ORT_ENABLE_ALL
1316
session_options.execution_mode = ort.ExecutionMode.ORT_SEQUENTIAL
1417
self.session = ort.InferenceSession(atr_path,
1518
sess_options=session_options, providers=['CPUExecutionProvider'])
1619
self.lip_session = ort.InferenceSession(lip_path,
1720
sess_options=session_options, providers=['CPUExecutionProvider'])
18-
1921

2022
def __call__(self, input_image):
21-
parsed_image, face_mask = onnx_inference(self.session, self.lip_session, input_image)
23+
parsed_image, face_mask = onnx_inference(
24+
self.session, self.lip_session, input_image)
2225
return parsed_image, face_mask

0 commit comments

Comments
 (0)