AlexeyAB / darknet

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

Error Making with open cv=1 #4988

Closed jetsonnano2020 closed 4 years ago

jetsonnano2020 commented 4 years ago

i have nvidia jetson nano developer kit, i'm trying to run the make file while opencv=1 i get the following error

chmod +x *.sh g++ -std=c++11 -Iinclude/ -I3rdparty/stb/include -DOPENCV pkg-config --cflags opencv -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn/include -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:159: recipe for target 'obj/image_opencv.o' failed make: *** [obj/image_opencv.o] Error 1

Although i have opencv pre-installed when i run the command import cv2 print(cv2.version) i get 4.1.1

so what should i do?

d3-worgan commented 4 years ago

How did you install opencv? I think theres a version for python you can install with pip and a C++ version you probably install with apt-get?

AlexeyAB commented 4 years ago

You should install OpenCV by using:

jetsonnano2020 commented 4 years ago

You should install OpenCV by using:

i tried theses solutions and unfortunately it didn't work i made some modifications on my make file

ifeq ($(OPENCV), 1) COMMON+= -DOPENCV -I/usr/include/opencv2 CFLAGS+= -DOPENCV -I/usr/include/opencv2 LDFLAGS+= pkg-config --libs opencv4 COMMON+= pkg-config --cflags opencv4 endif

it compiled and i did some detections on images but live demo using this command

./darknet detector demo data/yolo.data cfg/yolov3_custom_train.cfg yolov3_custom_train_3000.weights -c 0

CUDA-version: 10000 (10000), cuDNN: 7.6.3, GPU count: 1
OpenCV version: 4.3.0 Demo net.optimized_memory = 0 Screenshot from 2020-03-09 16-18-26 Screenshot from 2020-03-09 16-18-26

i get the following warnings

[ WARN:0] global /home/jn/opencv_build/opencv/modules/videoio/src/cap_gstreamer.cpp (1759) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Internal data stream error. [ WARN:0] global /home/jn/opencv_build/opencv/modules/videoio/src/cap_gstreamer.cpp (888) open OpenCV | GStreamer warning: unable to start pipeline [ WARN:0] global /home/jn/opencv_build/opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created

then the demo window pops up and i get a constant green screen

i use nvidia jetson nano with rpi camera note that i'm 100% sure that the camera is compatible and working perfectly.

is there any recommended solution?