Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python-package/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ For ``insightface<=0.1.5``, we use MXNet as inference backend.

Starting from insightface>=0.2, we use onnxruntime as inference backend.

You have to install ``onnxruntime-gpu`` manually to enable GPU inference, or install ``onnxruntime`` to use CPU only inference.
You have to install ``onnxruntime-gpu`` manually to enable GPU inference, install ``onnxruntime-cann`` manually to enable Ascend NPU inference, or install ``onnxruntime`` to use CPU only inference.

## Change Log

Expand Down
8 changes: 7 additions & 1 deletion python-package/insightface/model_zoo/model_zoo.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import os.path as osp
import glob
import onnxruntime
import importlib
from .arcface_onnx import *
from .retinaface import *
#from .scrfd import *
Expand Down Expand Up @@ -68,7 +69,12 @@ def find_onnx_file(dir_path):
return paths[-1]

def get_default_providers():
return ['CUDAExecutionProvider', 'CPUExecutionProvider']
# In Ascend NPU, acl is a base module, if the module `acl` exists, the codes runs in Ascend device.
if importlib.util.find_spec("acl") is not None:
providers = ["CANNExecutionProvider","CPUExecutionProvider"]
else:
providers = ['CUDAExecutionProvider', 'CPUExecutionProvider']
return providers

def get_default_provider_options():
return None
Expand Down