AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.65k stars 7.95k forks source link

Ubantu 18.04 Make is not working #4256

Open newmluser opened 4 years ago

newmluser commented 4 years ago

I am trying to make on Ubantu 18.04 and it is failing even opencv2 is installed. Can you please correct me if I am missing anything.

==== /YOLO/darknet-master$ python3 Python 3.6.8 (default, Oct 7 2019, 12:59:55) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.

import cv2 print(cv2.version) 4.1.1 quit()

:~/YOLO/darknet-master$ :~/YOLO/darknet-master$ make chmod +x *.sh g++ -std=c++11 -Iinclude/ -I3rdparty/stb/include -DOPENCV pkg-config --cflags opencv -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/image_opencv.cpp -o obj/image_opencv.o Package opencv was not found in the pkg-config search path. Perhaps you should add the directory containing `opencv.pc' to the PKG_CONFIG_PATH environment variable No package 'opencv' found ./src/image_opencv.cpp:15:10: fatal error: opencv2/core/version.hpp: No such file or directory

include <opencv2/core/version.hpp>

      ^~~~~~~~~~~~~~~~~~~~~~~~~~

compilation terminated. Makefile:149: recipe for target 'obj/image_opencv.o' failed make: *** [obj/image_opencv.o] Error 1

the make file is : GPU=1 CUDNN=0 CUDNN_HALF=0 OPENCV=1 AVX=0 OPENMP=0 LIBSO=0 ZED_CAMERA=0

set GPU=1 and CUDNN=1 to speedup on GPU

set CUDNN_HALF=1 to further speedup 3

AlexeyAB commented 4 years ago

What OpenCV version do you use? How did you install OpenCV?

git clone https://github.com/opencv/opencv.git

cd opencv
mkdir build
cd build

cmake -D CMAKE_BUILD_TYPE=RELEASE \
      -D CMAKE_INSTALL_PREFIX=/usr/local \
      -D INSTALL_C_EXAMPLES=ON \
      -D INSTALL_PYTHON_EXAMPLES=ON \
      -D WITH_V4L=ON \
      -D WITH_QT=ON \
      -D WITH_OPENGL=ON \
      -D WITH_FFMPEG=ON \
      -D BUILD_EXAMPLES=ON ..

make -j4
sudo make install
sudo sh -c 'echo "/usr/local/lib" >> /etc/ld.so.conf.d/opencv.conf'
sudo ldconfig

More: https://www.learnopencv.com/install-opencv3-on-ubuntu/

peterdn1 commented 4 years ago

Good instruction here for Ubuntu 18.04. https://www.pyimagesearch.com/2018/05/28/ubuntu-18-04-how-to-install-opencv/

Cloud-Forge commented 4 years ago

change makfile openCV condition :

ifeq ($(OPENCV), 1) 
COMMON+= -DOPENCV
CFLAGS+= -DOPENCV
LDFLAGS+= `pkg-config --libs opencv 2> /dev/null || pkg-config --libs opencv4` -lstdc++
COMMON+= `pkg-config --cflags opencv 2> /dev/null || pkg-config --cflags opencv4`
endif