yolov4-deepsort
yolov4-deepsort copied to clipboard
ImportError: /usr/lib/aarch64-linux-gnu/libgomp.so.1: cannot allocate memory in static TLS block
Running the save_model.py
code on Nvidia Jetson TX2 with Jetpack 4.4.1 installed, python3.6, Cuda 10.2.
Stack trace:
~/yolov4-deepsort$ python3 save_model.py --model yolov4-tiny
2021-01-07 15:46:30.404746: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.10.2
OpenCV loader: os.name="posix" platform.system()="Linux"
OpenCV loader: loading config: /usr/lib/python3.6/dist-packages/cv2/config.py
OpenCV loader: loading config: /usr/lib/python3.6/dist-packages/cv2/config-3.6.py
OpenCV loader: PYTHON_EXTENSIONS_PATHS=['/usr/lib/python3.6/dist-packages/cv2/python-3.6']
OpenCV loader: BINARIES_PATHS=['/usr/lib/python3.6/dist-packages/cv2/../../../../lib/aarch64-linux-gnu']
OpenCV loader: replacing cv2 module
Traceback (most recent call last):
File "save_model.py", line 4, in <module>
from core.yolov4 import YOLO, decode, filter_boxes
File "/home/cafepop/yolov4-deepsort/core/yolov4.py", line 6, in <module>
import core.utils as utils
File "/home/cafepop/yolov4-deepsort/core/utils.py", line 1, in <module>
import cv2
File "/usr/lib/python3.6/dist-packages/cv2/__init__.py", line 89, in <module>
bootstrap()
File "/usr/lib/python3.6/dist-packages/cv2/__init__.py", line 79, in bootstrap
import cv2
ImportError: /usr/lib/aarch64-linux-gnu/libgomp.so.1: cannot allocate memory in static TLS block
This seems to be an issue specific to Jetson boards that occurs when tensorflow is imported before opencv. Adding the line:
import cv2
import tensorflow as tf
to the beginning of the file resolved this issue for me. Just documenting it here in case anyone else has this issue. Seems to be related to https://github.com/opencv/opencv/issues/14884
export LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libgomp.so.1 Add this line and u are good to go
Worked for me, thanks. @xanthan011