diff --git a/deface/centerface.py b/deface/centerface.py index 29f30e3..a5cfb95 100644 --- a/deface/centerface.py +++ b/deface/centerface.py @@ -34,7 +34,6 @@ def __init__(self, onnx_path=None, in_shape=None, backend='auto'): self.net = cv2.dnn.readNetFromONNX(onnx_path) elif self.backend == 'onnxrt': import onnx - import onnx.utils import onnxruntime # Silence warnings about unnecessary bn initializers @@ -42,9 +41,8 @@ def __init__(self, onnx_path=None, in_shape=None, backend='auto'): static_model = onnx.load(onnx_path) dyn_model = self.dynamicize_shapes(static_model) - dyn_model = onnx.utils.polish_model(dyn_model) self.sess = onnxruntime.InferenceSession(dyn_model.SerializeToString()) - + preferred_provider = self.sess.get_providers()[0] preferred_device = 'GPU' if preferred_provider.startswith('CUDA') else 'CPU' # print(f'Running on {preferred_device}.')