pjreddie / darknet

Convolutional Neural Networks
http://pjreddie.com/darknet/
Other
25.84k stars 21.33k forks source link

Error while compiling darknet #1706

Open anirudh164 opened 5 years ago

anirudh164 commented 5 years ago

So I am new to deep learning and all but for now the issue I am encountering is when I open my darknet folder, and when I enter make in my terminal. I get this issue -

anirudh@anirudh-hp:~/Desktop/darknet$ make
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -DOPENCV obj/captcha.o obj/lsd.o obj/super.o obj/art.o obj/tag.o obj/cifar.o obj/go.o obj/rnn.o obj/segmenter.o obj/regressor.o obj/classifier.o obj/coco.o obj/yolo.o obj/detector.o obj/nightmare.o obj/instance-segmenter.o obj/darknet.o libdarknet.a -o darknet -lm -pthread  `pkg-config --libs opencv` -lstdc++ libdarknet.a
/usr/bin/ld: cannot find -lopencv_bioinspired
/usr/bin/ld: cannot find -lopencv_xfeatures2d
/usr/bin/ld: cannot find -lopencv_core
collect2: error: ld returned 1 exit status
Makefile:77: recipe for target 'darknet' failed
make: *** [darknet] Error 1

I am using darknet with OpenCV and not CUDA/GPU

Here is my Makefile -

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

Somewhere I read the error is due to some OpenCV issue? I am using OpenCV 4.1.0. I dont know what to do. I am using my own dataset.

vfbsilva commented 5 years ago

Yes it is. You are missing the insallation of opencv. Or the installation is not properly working. What istge output of pkg-config --cflags opencv Which linux distro are you using?

anirudh164 commented 5 years ago

I am getting this output - -I/usr/local/include/opencv -I/usr/local/include I am using Ubuntu 16.04

vfbsilva commented 5 years ago

What version of opencv? Similar report here

guischmitd commented 5 years ago

I've been working with darknet from this repo for the best part of this year with no major problems so far. Recently though I got a new machine and after my ubuntu 18.04 fresh install I could not get darknet to compile with OPENCV=1 (tried compiling opencv 3.4.0, 3.4.4 and 4.0.0 from source to no success).

So far I didn't really need to run it on video for a demo so it wasnt a problem. The solution I found after digging around a bunch was switching to AlexeyAB's repo (https://github.com/AlexeyAB/darknet) and compiling using cmake . and make. Problem solved, not a single error, and ./darknet detector demo works like a charm on FHD and 4K video with opencv and cuda support. Just figured I'd comment on open issues since I finally found a solution that worked for me.

vfbsilva commented 5 years ago

@guischmitd this is not a proper solution as the code here is still somehow broken.

guischmitd commented 5 years ago

@vfbsilva I agree, just wanted to register a possible alternative to anyone facing issues with this repo. If you believe this clutters the issues page I can delete my comment, maybe stackoverflow is a better channel for this sort of "solution".

vfbsilva commented 5 years ago

@guischmitd I might have sounded pedant so I will rephrase. This is the original repo afaik, AlexeyAB is an amazing addon but if something is broken here we need to fix it here with the help from @pjreddie . @anirudh164 try opencv 3.4.7 to use this repo.

guischmitd commented 5 years ago

@vfbsilva not at all! I'm pretty new to github as a member of the community, still getting used to the etiquette. Thanks for the heads up anyway!