![](/img/trans.png)
[英]How do I install opencv-python 4.1.1.26 on NVIDIA Jetson AGX Xavier?
[英]How to use OpenCV in Numba on Jetson Xavier?
我试图在我用一些 Numba 装饰器(例如nopython=True, parallel=True
)注释的某些函数中使用 OpenCV。 我在 Jetson Xavier 上运行它,它是用Nvidia SDK Manager刷新的。
代码是这样的:
@jit(nopython=True, cache=True, parallel=True)
def decompress(data):
result = list()
for d in data:
cv2_image = cv2.imdecode(d, cv2.IMREAD_COLOR)
image = np.array(cv2_image)
result.append(image)
return result
但我收到一个错误:
TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Unknown attribute 'resize' of type Module(<module 'cv2' from '/usr/lib/python2.7/dist-packages/cv2.so'>)
File "./my-script.py", line 297:
def decompress(data):
<source elided>
cv2_image = cv2.imdecode(d, cv2.IMREAD_COLOR)
^
[1] During: typing of get attribute at /ssd/catkin_workspace/src/semantics-ros-wrapper/src/semseg.py (297)
File "./my-script.py", line 297:
def decompress(data):
<source elided>
cv2_image = cv2.imdecode(d, cv2.IMREAD_COLOR)
^
This is not usually a problem with Numba itself but instead often caused by
the use of unsupported features or an issue in resolving types.
To see Python/NumPy features supported by the latest release of Numba visit:
http://numba.pydata.org/numba-doc/dev/reference/pysupported.html
and
http://numba.pydata.org/numba-doc/dev/reference/numpysupported.html
For more information about typing errors and how to debug them visit:
http://numba.pydata.org/numba-doc/latest/user/troubleshoot.html#my-code-doesn-t-compile
If you think your code should work with Numba, please report the error message
and traceback, along with a minimal reproducer at:
https://github.com/numba/numba/issues/new
甚至可以将 OpenCV 与 Numba 一起使用吗?
我正在使用:python2.7 和 numba-0.44.0。
Numba 尚不支持 OpenCV。 如果您仍然希望它在函数中的 numpy 数组上运行,则可以设置nopython=False
这意味着您也将无法设置parallel=True
这是来自Numba 用户手册:
Numba 有两种编译模式:nopython 模式和对象模式。 前者产生更快的代码,但有一些限制,可以迫使 Numba 回退到后者。 要防止 Numba 回退,而是引发错误,请传递 nopython=True。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.