File tree Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change 16
16
def run_model (self ):
17
17
18
18
19
- opts = ort .SessionOptions ()
20
- opts .intra_op_num_threads = 1
21
- opts .inter_op_num_threads = 1
22
- opts .graph_optimization_level = ort .GraphOptimizationLevel .ORT_ENABLE_EXTENDED
23
- if not self .use_gpu :
24
- sess = ort .InferenceSession (self .model , opts , providers = ['CPUExecutionProvider' ])
25
- else :
26
- sess = ort .InferenceSession (self .model , opts , providers = ['DmlExecutionProvider' ])
27
- input_name = sess .get_inputs ()[0 ].name
28
- output_name = sess .get_outputs ()[0 ].name
29
19
30
20
min_cutoff = 15.5004
31
21
beta = 0.62
@@ -48,7 +38,7 @@ def run_model(self):
48
38
# make it a numpy array
49
39
frame = frame .numpy ()
50
40
51
- out = sess .run ([output_name ], {input_name : frame })
41
+ out = self . sess .run ([self . output_name ], {self . input_name : frame })
52
42
#end = time.time()
53
43
output = out [0 ]
54
44
output = output [0 ]
Original file line number Diff line number Diff line change @@ -113,6 +113,17 @@ def __init__(
113
113
self .use_gpu = self .settings .gui_use_gpu
114
114
self .output = []
115
115
self .calibrate_config = np .empty ((1 , 45 ))
116
+
117
+ self .opts = ort .SessionOptions ()
118
+ self .opts .intra_op_num_threads = 1
119
+ self .opts .inter_op_num_threads = 1
120
+ self .opts .graph_optimization_level = ort .GraphOptimizationLevel .ORT_ENABLE_EXTENDED
121
+ if not self .use_gpu :
122
+ self .sess = ort .InferenceSession (self .model , self .opts , providers = ['CPUExecutionProvider' ])
123
+ else :
124
+ self .sess = ort .InferenceSession (self .model , self .opts , providers = ['DmlExecutionProvider' ])
125
+ self .input_name = self .sess .get_inputs ()[0 ].name
126
+ self .output_name = self .sess .get_outputs ()[0 ].name
116
127
117
128
118
129
try :
You can’t perform that action at this time.
0 commit comments