Handling Import and file not found Error for non-arm devices.

This commit is contained in:
yoni13 2025-01-11 15:19:53 +08:00
parent 66004e3b83
commit d10147f478

View File

@ -2,22 +2,24 @@
# Following Apache License 2.0
from queue import Queue
from rknnlite.api import RKNNLite
from concurrent.futures import ThreadPoolExecutor, as_completed
supported_socs = ["rk3566","rk3568","rk3588"]
with open('/proc/device-tree/compatible') as f:
# Keep in mind that this is not in container by default.
# and this way of checking can't check if the rknpu driver is running or not.
device_compatible_str = f.read()
for soc in supported_socs:
if soc in device_compatible_str:
is_available = True
break
else:
is_available = False
try:
from rknn.api import RKNNLite
with open('/proc/device-tree/compatible') as f:
# Keep in mind that this is not in container by default.
# and this way of checking can't check if the rknpu driver is running or not.
device_compatible_str = f.read()
for soc in supported_socs:
if soc in device_compatible_str:
is_available = True
break
else:
is_available = False
except (FileNotFoundError, ImportError):
is_available = False
def initRKNN(rknnModel="./rknnModel/yolov5s.rknn", id=0):