Don't fail if openvino fails to import (#5532)

* Don't fail if openvino fails to import

* Ensure all modules are imported safely

* Undo

* Fix list append
This commit is contained in:
Nicolas Mowen 2023-02-19 06:41:14 -07:00 committed by GitHub
parent 0592c8b0e2
commit 2797a60d4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,12 +13,19 @@ from .detector_config import BaseDetectorConfig
logger = logging.getLogger(__name__)
plugin_modules = [
importlib.import_module(name)
for finder, name, ispkg in pkgutil.iter_modules(
plugins.__path__, plugins.__name__ + "."
)
]
_included_modules = pkgutil.iter_modules(plugins.__path__, plugins.__name__ + ".")
plugin_modules = []
for _, name, _ in _included_modules:
try:
# currently openvino may fail when importing
# on an arm device with 64 KiB page size.
plugin_modules.append(importlib.import_module(name))
except ImportError as e:
logger.error(f"Error importing detector runtime: {e}")
api_types = {det.type_key: det for det in DetectionApi.__subclasses__()}