Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import error : undefined symbol: load_image_cv #47

Open
aic25 opened this issue Nov 1, 2018 · 1 comment
Open

Import error : undefined symbol: load_image_cv #47

aic25 opened this issue Nov 1, 2018 · 1 comment

Comments

@aic25
Copy link

aic25 commented Nov 1, 2018

I try to install with GPU + OpenCV + CUDNN + OpenMP (Darknet is built with GPU + OpenCV + CUDNN + OpenMP as well)
install script (it is running in a docker container as root so no need for sudo):

#!/bin/bash
rm -rf build
rm /usr/local/lib/python3.5/dist-packages/pyyolo*
make
python3 setup_gpu.py build
python3 setup_gpu.py install
python3 -c "import pyyolo;"

I get the following after running it:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: /usr/local/lib/python3.5/dist-packages/pyyolo.cpython-35m-x86_64-linux-gnu.so: undefined symbol: load_image_cv

This is the MakeFile:

GPU=1
CUDNN=1
DEBUG=0
OPENCV=1

# ARCH= -gencode arch=compute_20,code=[sm_20,sm_21] \
# 	  -gencode arch=compute_30,code=sm_30 \
# 	  -gencode arch=compute_35,code=sm_35 \
# 	  -gencode arch=compute_50,code=[sm_50,compute_50] \
# 	  -gencode arch=compute_52,code=[sm_52,compute_52]

# This is what I use, uncomment if you know your arch and want to specify
ARCH= -gencode arch=compute_61,code=compute_61 # 1080 TI
# ARCH= -gencode arch=compute_61,code=compute_61 # Tegra TX2

VPATH=./darknet/src/:./darknet/examples
LIB=libyolo.a
OBJDIR=./obj/

CC=gcc -fopenmp -lm -lmvec -lpthread `pkg-config --libs opencv` -lstdc++
AR=ar
NVCC=nvcc 
OPTS=-Ofast
COMMON= 
CFLAGS=-Wall -Wfatal-errors -Wno-unused-result -fPIC
CFLAGS+=-I./darknet/src -I./darknet/include

ifeq ($(DEBUG), 1) 
OPTS=-O0 -g
endif

CFLAGS+=$(OPTS)

ifeq ($(OPENCV), 1) 
COMMON+= -DOPENCV
CFLAGS+= -DOPENCV
COMMON+= `pkg-config --libs --cflags opencv` -lstdc++
endif

ifeq ($(GPU), 1) 
COMMON+= -DGPU -I/usr/local/cuda/include/
CFLAGS+= -DGPU
endif

ifeq ($(CUDNN), 1) 
COMMON+= -DCUDNN 
CFLAGS+= -DCUDNN
endif

OBJ=libyolo.o gemm.o utils.o cuda.o deconvolutional_layer.o convolutional_layer.o list.o image.o activations.o im2col.o col2im.o blas.o crop_layer.o dropout_layer.o maxpool_layer.o softmax_layer.o data.o matrix.o network.o connected_layer.o cost_layer.o parser.o option_list.o 
OBJ+=detection_layer.o route_layer.o upsample_layer.o box.o normalization_layer.o avgpool_layer.o layer.o local_layer.o shortcut_layer.o logistic_layer.o activation_layer.o rnn_layer.o gru_layer.o crnn_layer.o demo.o batchnorm_layer.o region_layer.o reorg_layer.o tree.o  lstm_layer.o l2norm_layer.o yolo_layer.o 
OBJ+=captcha.o lsd.o super.o art.o tag.o cifar.o go.o rnn.o segmenter.o regressor.o classifier.o coco.o yolo.o detector.o nightmare.o darknet.o 
ifeq ($(GPU), 1) 
OBJ+=convolutional_kernels.o deconvolutional_kernels.o activation_kernels.o im2col_kernels.o col2im_kernels.o blas_kernels.o crop_layer_kernels.o dropout_layer_kernels.o maxpool_layer_kernels.o avgpool_layer_kernels.o # network_kernels.o
endif

OBJS = $(addprefix $(OBJDIR), $(OBJ))
DEPS = $(wildcard src/*.h) Makefile

all: obj $(LIB)

$(LIB): $(OBJS)
	$(AR) rcs $@ $^

$(OBJDIR)%.o: %.c $(DEPS)
	$(CC) $(COMMON) $(CFLAGS) -c $< -o $@

$(OBJDIR)%.o: %.cu $(DEPS)
	$(NVCC) $(ARCH) $(COMMON) --compiler-options "$(CFLAGS)" -c $< -o $@

obj:
	mkdir -p obj

.PHONY: clean

clean:
	rm -rf $(OBJS) $(LIB)


setup_gpu.py:

from distutils.core import setup, Extension
import numpy

module = Extension('pyyolo',
	library_dirs=['.', '/usr/local/cuda/lib64', '/usr/local/'],
	libraries=['yolo', 'cuda', 'cudart', 'cublas', 'curand', 'cudnn'],
	include_dirs=[numpy.get_include(), './darknet/include'],
	sources = ['module.c'],
	extra_compile_args=['-fopenmp'],
	extra_link_args=['-lgomp', '-lm', '-lmvec', '-lpthread', '-lstdc++'])

setup (name = 'pyyolo',
	version = '0.1',
	description = 'YOLO wrapper',
	ext_modules = [module])

I built OpenCV 3.4.3 from source.
cuDNN v7
Python 3.5
CUDA 9.0

Thank you very much.

@lesreaper
Copy link

lesreaper commented Nov 19, 2018

I'm having the exact same issue with almost the same settings on an aarch64 system.

OpenCV 3.4.0
Python3.5
CUDA 9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants