AlexeyAB / darknet

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

Broken opencv #3406

Closed vfbsilva closed 5 years ago

vfbsilva commented 5 years ago

Some update broke my machine as it seems I can no longer train. I do have this lib installed but when I try to compile darknet I get:

/usr/bin/ld: aviso: libdc1394.so.22, necessária para /opt/opencv3/lib/libopencv_videoio.so, não localizada (tente usar -rpath ou -rpath-link)
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_capture_is_frame_corrupt"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_video_set_operation_mode"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_camera_new"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_video_set_mode"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_capture_enqueue"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_capture_stop"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_get_color_coding_from_video_mode"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_camera_free_list"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_debayer_frames"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_get_image_size_from_video_mode"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_feature_set_value"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_feature_set_absolute_control"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_convert_frames"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_free"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_feature_whitebalance_set_value"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_get_control_registers"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_capture_get_fileno"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_video_set_framerate"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_get_color_coding_bit_size"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_new"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_video_set_transmission"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_video_set_iso_speed"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_feature_set_power"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_feature_get_value"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_camera_free"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_video_get_supported_modes"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_set_control_registers"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_video_get_mode"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_video_get_supported_framerates"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_feature_get_all"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_capture_dequeue"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_deinterlace_stereo"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_capture_setup"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_feature_set_mode"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_feature_whitebalance_get_value"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_camera_enumerate"
collect2: error: ld returned 1 exit status
make: *** [Makefile:77: darknet] Error 1

Do I need to downgrade opencv?

AlexeyAB commented 5 years ago

Did you update your OpenCV? Do you use Cmake+make or just make to re-compile Darknet? Try to download the latest version of Darknet and compile it by using make. If it doesn't help then by using cmake . && make

vfbsilva commented 5 years ago

@AlexeyAB thanks for the super swiftly reply. I did upgrade opencv by mistake I bumped version 4.1 by mistake. I'm aware this is distro specific so just to clear im using archlinux. What I did was to reinstall my old opencv:

sudo pacman -U /var/cache/pacman/pkg/opencv3-opt-3.4.5-4-x86_64.pkg.tar.xz sudo pacman -U /var/cache/pacman/pkg/opencv3-opt-samples-3.4.5-4-x86_64.pkg.tar.xz

Then I tried:

 cmake .
-- Autodetected CUDA architecture(s):  6.1
-- Building with CUDA flags: -gencode;arch=compute_61,code=sm_61
-- Found OpenMP_C: -fopenmp  
-- Found OpenMP_CXX: -fopenmp  
-- Found OpenMP: TRUE   
--   ->  darknet is fine for now, but uselib_track has been disabled!
--   ->  Please rebuild OpenCV from sources with CUDA support to enable it
-- Found cuDNN: v7.6.0  (include: /usr/include, library: /usr/lib/libcudnn.so)
-- CMAKE_CUDA_FLAGS: -gencode arch=compute_61,code=sm_61 --compiler-options " -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -Wno-deprecated-declarations -Wno-write-strings -DGPU -DCUDNN -DOPENCV -fPIC -fopenmp -Ofast " 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/imanewbie/Source/darknet-AlexeyAB/darknet

And finally:

[ 49%] Built target dark [ 50%] Linking CXX executable uselib /usr/bin/ld: aviso: libdc1394.so.22, necessária para /opt/opencv3/lib/libopencv_videoio.so.3.4.5, não localizada (tente usar -rpath ou -rpath-link) /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_capture_is_frame_corrupt" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_video_set_operation_mode" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_camera_new" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_video_set_mode" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_capture_enqueue" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_capture_stop" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_get_color_coding_from_video_mode" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_camera_free_list" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_debayer_frames" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_get_image_size_from_video_mode" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_feature_set_value" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_feature_set_absolute_control" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_convert_frames" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_free" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_feature_whitebalance_set_value" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_get_control_registers" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_capture_get_fileno" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_video_set_framerate" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_get_color_coding_bit_size" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_new" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_video_set_transmission" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_video_set_iso_speed" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_feature_set_power" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_feature_get_value" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_camera_free" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_video_get_supported_modes" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_set_control_registers" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_video_get_mode" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_video_get_supported_framerates" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_feature_get_all" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_capture_dequeue" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_deinterlace_stereo" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_capture_setup" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_feature_set_mode" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_feature_whitebalance_get_value" /usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so.3.4.5: referência não definida para "dc1394_camera_enumerate" collect2: error: ld returned 1 exit status make[2]: [CMakeFiles/uselib.dir/build.make:134: uselib] Error 1 make[1]: [CMakeFiles/Makefile2:73: CMakeFiles/uselib.dir/all] Error 2

So I understand my downgrade is not oki but I don't know why.

acxz commented 5 years ago

@AlexeyAB I am able to replicate a similar issue as well on archlinux. My opencv version is 4.1 and I am building (using cmake) the latest master ( a1abd07 at this time) of darknet. Here are my errors.

I decided to also see where the build stopped breaking. Going down, commits happened earlier in time. Checking HEAD^ ( bd689f9 at this time): I get the following error:

/usr/bin/ld: CMakeFiles/uselib_track.dir/src/yolo_console_dll.cpp.o: undefined reference to symbol 'pthread_create@@GLIBC_2.2.5'
/usr/bin/ld: /usr/lib/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/uselib_track.dir/build.make:134: uselib_track] Error 1
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/uselib_track.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

Checking b78db93 I get the same errors as in the latest master branch.

Checking ... Any way long story short the latest commit I can properly build right now is f1b6a6e. The first commit that gives me an error is the one right after: f14c6e2 in which I get the same error as posted in the gist that I linked previously.

AlexeyAB commented 5 years ago

@acxz Can you successfully build Darknet with the earlier commit? for example https://github.com/AlexeyAB/darknet/commit/3ff27b1cdd4580e6e9346bd7a2c63bde3498a2e3 https://github.com/AlexeyAB/darknet/tree/3ff27b1cdd4580e6e9346bd7a2c63bde3498a2e3

acxz commented 5 years ago

Im actually checking that rn EDIT: refer to my last comment.

acxz commented 5 years ago

@AlexeyAB If you could make a release from commit f1b6a6e or 378d49e (the one before f1b6a6e) then I can update/fix the archlinux package breaking real quick so that it uses the working release instead of pointing to a master branch that might occasionally break like rn, so that @vfbsilva and others on archlinux can use darknet properly.

vfbsilva commented 5 years ago

@acxz can we have a gpu Version on aur? :D

acxz commented 5 years ago

Also when I try to build with make on commit 378d49e (the one that works with cmake) and I set the OpenCV flag to 1. I get the following error:

chmod +x *.sh
g++ -std=c++11 -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv` -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -ffp-contract=fast -mavx -mavx2 -msse3 -msse4.1 -msse4.2 -msse4a -Ofast -DOPENCV -fopenmp -fPIC -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
Package 'opencv', required by 'virtual:world', not 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.
make: *** [Makefile:149: obj/image_opencv.o] Error 1

This is understandable though since my opencv version is 4.1 instead of specifically opencv2.

acxz commented 5 years ago

@acxz can we have a gpu Version on aur? :D

haha, from what I understand the CMakeLists.txt should be able to detect if you have CUDA (which is listed as an optional dependency just like opencv) installed or not and build based off that. I haven't been able to test it though since my nvidia drivers have been acting up. For example if you uninstall opencv from your machine and trying installing the package or making darknet manually, it will not error. Just tested this on the latest commit. So yeah the CMakelists.txt detects what dependencies you have installed and builds based off that. Which means the AUR package does have GPU support.

AlexeyAB commented 5 years ago

@acxz

This is understandable though since my opencv version is 4.1 instead of specifically opencv2.

opencv2 isn't a version and I can build it successfully on Ubuntu with OpenCV 4.1.0. OpenCV 4.x and 3.x use the same folder /opencv2/ as in OpenCV 2.x.

It just can't filen opencv.pc consequently it doesn't know where is file opencv2/core/version.hpp


Try to build your OpenCV version without VTK. Since it can't find https://vtk.org/ (for viz module).

AlexeyAB commented 5 years ago

@cenit Hi,

Do you know why this commit https://github.com/AlexeyAB/darknet/commit/f14c6e2fd9bbab16c34c0fab8bfc56dc4acd2814 and give an error during building? More: https://github.com/AlexeyAB/darknet/issues/3406#issuecomment-501920119

cenit commented 5 years ago

Away without pc. Will look into it asap. dc1394 looks like a broken build of opencv, built requesting its support but then redistributing without that lib. Apart from that, I have to check better about the other problems described later in this issue. I can suggest to delete the build_* folder in which people are building with cmake and restart from scratch. It may help after big system updates/downgrades

acxz commented 5 years ago

@cenit all of my checks have been with a clean build folder.

acxz commented 5 years ago

@AlexeyAB you are right I checked my paths again and the file that is being requested (version.hpp) is found under /usr/include/opencv4/opencv2/core/version.hpp on my system. As for opencv.pc i have not been able to find it under my /usr/ folder. But I was able to find opencv4.pc under /usr/lib/pkgconfig/.

I actually do not have vtk installed. I assume you want me to try to build opencv with vtk?

acxz commented 5 years ago

I just tried building darknet (using cmake) with vtk installed for opencv on master (a1abd07) and it built fine! @AlexeyAB good catch! I still have the same error with the make build process as previously described (Package opencv was not found in the pkg-config search path.).

In any case it seems like later commits in darknet depend on vtk. So we can just edit the readme and add vtk as a dependency right? That fixes the problem. I am sure there is some deeper stuff we uncovered here but that fix should be enough for users.

AlexeyAB commented 5 years ago

@acxz

No, Darknet doesn't use VTK and doesn't use VIZ-module.

It seems something wrong in OpenCV, since it requires VTK. Did you install OpenCV-release or master-branch, may be OpenCV master-branch can have a bug or you installed OpenCV incorrectly.

acxz commented 5 years ago

I have installed the version of opencv on the ArchLinux repos, which is the latest release version of opencv, 4.1.

cenit commented 5 years ago

OpenCV has been built with vtk support but vtk has not been declared as a dependency for the opencv package. Not a darknet bug. Similar problem for the dc1394 opening post maybe

acxz commented 5 years ago

I had assumed that vtk was an optional dependency for opencv?

acxz commented 5 years ago

On release 4.1 for opencv: Here in the CMakeLists.txt it shows vtk being an optional 3rd party library for opencv: https://github.com/opencv/opencv/blob/4.1.0/CMakeLists.txt/#L224-L240 Line 240 specifically

acxz commented 5 years ago

@cenit can you give a link to the dc1394 post you have been mentioning?

cenit commented 5 years ago

vtk (but also many other libraries) has been an optional dependency for OpenCV since a long time. The problem arises when you build OpenCV from source. If you build with VTK support but then forget to redistribute also VTK together with OpenCV, then your OpenCV fails. I fear that some Archlinux package maintainer did a mistake, built OpenCV with dc1394 and VTK support by default but then forgot to add those dependencies for people upgrading/installing opencv, then the mess. Again, not a darknet bug, it's just related to archlinux packaging

acxz commented 5 years ago

Ah I understand thank you for explaining it! I will try compiling opencv 4.1 from source myself and see what happens later.

vfbsilva commented 5 years ago

I still have the same error with the make build process as previously described (Package opencv was not found in the pkg-config search path.).

I also did have this problem, seems to be something regarding pkg-config not finding it in arch on lines:

45:LDFLAGS+= `pkg-config --libs opencv` -lstdc++
46:COMMON+= `pkg-config --cflags opencv` 

A fix for anyone interested is to export it manually: export PKG_CONFIG_PATH=/opt/opencv3/lib/pkgconfig/

@cenit I'm not sure if it is the whole issue as I did downgrade opencv and it kept broken. Maybe there is some more dependency at least in archlinux.

acxz commented 5 years ago

@vfbsilva the opencv3-opt package on Arch has the same vtk dependencies as opencv package. Both list vtk as a make dependency as well as an optional dependency.

vfbsilva commented 5 years ago

@acxz yes I did see it and did downgrade from aur. But still hit the issue. I'm no expert in code handling so I'm a bit clueless about why my regression did not work. Also, just to be 100% sincere I`m using manjaro.

vfbsilva commented 5 years ago

@acxz guys on the manjaro forum did the following comment which I think might be usefull:

It looks for libdc1394.so.22 (part of libdc1394 package), but Manjaro currently has libdc1394.so.25

acxz commented 5 years ago

@vfbsilva I am not currently looking at the Arch packages for opencv. Once I get time later in the day or tomorrow I will try compiling darknet with a source build from opencv to reduce the potential errors the Arch packages may have on the darknet build. I suggest you do the same as of now. Another thing is I would recommend you use the opencv package from the Arch Repos instead of the opencv3-opt package from the AUR if you do not specifically need opencv3.

cenit commented 5 years ago

Or just using vcpkg? :)

vfbsilva commented 5 years ago

@vfbsilva I am not currently looking at the Arch packages for opencv. Once I get time later in the day or tomorrow I will try compiling darknet with a source build from opencv to reduce the potential errors the Arch packages may have on the darknet build. I suggest you do the same as of now. Another thing is I would recommend you use the opencv package from the Arch Repos instead of the opencv3-opt package from the AUR if you do not specifically need opencv3.

Tried with no luck:

 pkg-config --modversion opencv
3.4.5

make clean
rm -rf ./obj/gemm.o ./obj/utils.o ./obj/cuda.o ./obj/deconvolutional_layer.o ./obj/convolutional_layer.o ./obj/list.o ./obj/image.o ./obj/activations.o ./obj/im2col.o ./obj/col2im.o ./obj/blas.o ./obj/crop_layer.o ./obj/dropout_layer.o ./obj/maxpool_layer.o ./obj/softmax_layer.o ./obj/data.o ./obj/matrix.o ./obj/network.o ./obj/connected_layer.o ./obj/cost_layer.o ./obj/parser.o ./obj/option_list.o ./obj/detection_layer.o ./obj/route_layer.o ./obj/upsample_layer.o ./obj/box.o ./obj/normalization_layer.o ./obj/avgpool_layer.o ./obj/layer.o ./obj/local_layer.o ./obj/shortcut_layer.o ./obj/logistic_layer.o ./obj/activation_layer.o ./obj/rnn_layer.o ./obj/gru_layer.o ./obj/crnn_layer.o ./obj/demo.o ./obj/batchnorm_layer.o ./obj/region_layer.o ./obj/reorg_layer.o ./obj/tree.o ./obj/lstm_layer.o ./obj/l2norm_layer.o ./obj/yolo_layer.o ./obj/iseg_layer.o ./obj/image_opencv.o ./obj/convolutional_kernels.o ./obj/deconvolutional_kernels.o ./obj/activation_kernels.o ./obj/im2col_kernels.o ./obj/col2im_kernels.o ./obj/blas_kernels.o ./obj/crop_layer_kernels.o ./obj/dropout_layer_kernels.o ./obj/maxpool_layer_kernels.o ./obj/avgpool_layer_kernels.o libdarknet.so libdarknet.a darknet ./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 ./obj//*
imanewbie@mordor ~/Source/darknet-SERPRO/darknet $ make
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/gemm.c -o obj/gemm.o
./src/gemm.c: In function ‘time_gpu’:
./src/gemm.c:232:9: warning: ‘cudaThreadSynchronize’ is deprecated [-Wdeprecated-declarations]
         cudaThreadSynchronize();
         ^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/cuda/include/cuda_runtime.h:96,
                 from include/darknet.h:11,
                 from ./src/utils.h:5,
                 from ./src/gemm.c:2:
/usr/local/cuda/include/cuda_runtime_api.h:957:57: note: declared here
 extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaThreadSynchronize(void);
                                                         ^~~~~~~~~~~~~~~~~~~~~
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/utils.c -o obj/utils.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/cuda.c -o obj/cuda.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/deconvolutional_layer.c -o obj/deconvolutional_layer.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/convolutional_layer.c -o obj/convolutional_layer.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/list.c -o obj/list.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/image.c -o obj/image.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/activations.c -o obj/activations.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/im2col.c -o obj/im2col.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/col2im.c -o obj/col2im.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/blas.c -o obj/blas.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/crop_layer.c -o obj/crop_layer.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/dropout_layer.c -o obj/dropout_layer.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/maxpool_layer.c -o obj/maxpool_layer.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/softmax_layer.c -o obj/softmax_layer.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/data.c -o obj/data.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/matrix.c -o obj/matrix.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/network.c -o obj/network.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/connected_layer.c -o obj/connected_layer.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/cost_layer.c -o obj/cost_layer.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/parser.c -o obj/parser.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/option_list.c -o obj/option_list.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/detection_layer.c -o obj/detection_layer.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/route_layer.c -o obj/route_layer.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/upsample_layer.c -o obj/upsample_layer.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/box.c -o obj/box.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/normalization_layer.c -o obj/normalization_layer.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/avgpool_layer.c -o obj/avgpool_layer.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/layer.c -o obj/layer.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/local_layer.c -o obj/local_layer.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/shortcut_layer.c -o obj/shortcut_layer.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/logistic_layer.c -o obj/logistic_layer.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/activation_layer.c -o obj/activation_layer.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/rnn_layer.c -o obj/rnn_layer.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/gru_layer.c -o obj/gru_layer.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/crnn_layer.c -o obj/crnn_layer.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/demo.c -o obj/demo.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/batchnorm_layer.c -o obj/batchnorm_layer.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/region_layer.c -o obj/region_layer.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/reorg_layer.c -o obj/reorg_layer.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/tree.c -o obj/tree.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/lstm_layer.c -o obj/lstm_layer.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/l2norm_layer.c -o obj/l2norm_layer.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/yolo_layer.c -o obj/yolo_layer.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/iseg_layer.c -o obj/iseg_layer.o
g++ -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./src/image_opencv.cpp -o obj/image_opencv.o
nvcc  -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] -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  --compiler-options "-Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN" -c ./src/convolutional_kernels.cu -o obj/convolutional_kernels.o
nvcc  -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] -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  --compiler-options "-Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN" -c ./src/deconvolutional_kernels.cu -o obj/deconvolutional_kernels.o
nvcc  -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] -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  --compiler-options "-Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN" -c ./src/activation_kernels.cu -o obj/activation_kernels.o
nvcc  -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] -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  --compiler-options "-Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN" -c ./src/im2col_kernels.cu -o obj/im2col_kernels.o
nvcc  -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] -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  --compiler-options "-Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN" -c ./src/col2im_kernels.cu -o obj/col2im_kernels.o
nvcc  -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] -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  --compiler-options "-Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN" -c ./src/blas_kernels.cu -o obj/blas_kernels.o
nvcc  -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] -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  --compiler-options "-Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN" -c ./src/crop_layer_kernels.cu -o obj/crop_layer_kernels.o
nvcc  -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] -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  --compiler-options "-Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN" -c ./src/dropout_layer_kernels.cu -o obj/dropout_layer_kernels.o
nvcc  -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] -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  --compiler-options "-Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN" -c ./src/maxpool_layer_kernels.cu -o obj/maxpool_layer_kernels.o
nvcc  -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] -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  --compiler-options "-Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN" -c ./src/avgpool_layer_kernels.cu -o obj/avgpool_layer_kernels.o
gcc -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -shared obj/gemm.o obj/utils.o obj/cuda.o obj/deconvolutional_layer.o obj/convolutional_layer.o obj/list.o obj/image.o obj/activations.o obj/im2col.o obj/col2im.o obj/blas.o obj/crop_layer.o obj/dropout_layer.o obj/maxpool_layer.o obj/softmax_layer.o obj/data.o obj/matrix.o obj/network.o obj/connected_layer.o obj/cost_layer.o obj/parser.o obj/option_list.o obj/detection_layer.o obj/route_layer.o obj/upsample_layer.o obj/box.o obj/normalization_layer.o obj/avgpool_layer.o obj/layer.o obj/local_layer.o obj/shortcut_layer.o obj/logistic_layer.o obj/activation_layer.o obj/rnn_layer.o obj/gru_layer.o obj/crnn_layer.o obj/demo.o obj/batchnorm_layer.o obj/region_layer.o obj/reorg_layer.o obj/tree.o obj/lstm_layer.o obj/l2norm_layer.o obj/yolo_layer.o obj/iseg_layer.o obj/image_opencv.o obj/convolutional_kernels.o obj/deconvolutional_kernels.o obj/activation_kernels.o obj/im2col_kernels.o obj/col2im_kernels.o obj/blas_kernels.o obj/crop_layer_kernels.o obj/dropout_layer_kernels.o obj/maxpool_layer_kernels.o obj/avgpool_layer_kernels.o -o libdarknet.so -lm -pthread  `pkg-config --libs opencv` -lstdc++ -L/usr/local/cuda/lib64 -lcuda -lcudart -lcublas -lcurand -lcudnn -lstdc++ 
ar rcs libdarknet.a obj/gemm.o obj/utils.o obj/cuda.o obj/deconvolutional_layer.o obj/convolutional_layer.o obj/list.o obj/image.o obj/activations.o obj/im2col.o obj/col2im.o obj/blas.o obj/crop_layer.o obj/dropout_layer.o obj/maxpool_layer.o obj/softmax_layer.o obj/data.o obj/matrix.o obj/network.o obj/connected_layer.o obj/cost_layer.o obj/parser.o obj/option_list.o obj/detection_layer.o obj/route_layer.o obj/upsample_layer.o obj/box.o obj/normalization_layer.o obj/avgpool_layer.o obj/layer.o obj/local_layer.o obj/shortcut_layer.o obj/logistic_layer.o obj/activation_layer.o obj/rnn_layer.o obj/gru_layer.o obj/crnn_layer.o obj/demo.o obj/batchnorm_layer.o obj/region_layer.o obj/reorg_layer.o obj/tree.o obj/lstm_layer.o obj/l2norm_layer.o obj/yolo_layer.o obj/iseg_layer.o obj/image_opencv.o obj/convolutional_kernels.o obj/deconvolutional_kernels.o obj/activation_kernels.o obj/im2col_kernels.o obj/col2im_kernels.o obj/blas_kernels.o obj/crop_layer_kernels.o obj/dropout_layer_kernels.o obj/maxpool_layer_kernels.o obj/avgpool_layer_kernels.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./examples/captcha.c -o obj/captcha.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./examples/lsd.c -o obj/lsd.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./examples/super.c -o obj/super.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./examples/art.c -o obj/art.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./examples/tag.c -o obj/tag.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./examples/cifar.c -o obj/cifar.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./examples/go.c -o obj/go.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./examples/rnn.c -o obj/rnn.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./examples/segmenter.c -o obj/segmenter.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./examples/regressor.c -o obj/regressor.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./examples/classifier.c -o obj/classifier.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./examples/coco.c -o obj/coco.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./examples/yolo.c -o obj/yolo.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./examples/detector.c -o obj/detector.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./examples/nightmare.c -o obj/nightmare.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./examples/instance-segmenter.c -o obj/instance-segmenter.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN -c ./examples/darknet.c -o obj/darknet.o
gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -DCUDNN  -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -O0 -g -DOPENCV -DGPU -DCUDNN 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++ -L/usr/local/cuda/lib64 -lcuda -lcudart -lcublas -lcurand -lcudnn -lstdc++  libdarknet.a
/usr/bin/ld: aviso: libdc1394.so.22, necessária para /opt/opencv3/lib/libopencv_videoio.so, não localizada (tente usar -rpath ou -rpath-link)
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_capture_is_frame_corrupt"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_video_set_operation_mode"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_camera_new"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_video_set_mode"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_capture_enqueue"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_capture_stop"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_get_color_coding_from_video_mode"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_camera_free_list"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_debayer_frames"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_get_image_size_from_video_mode"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_feature_set_value"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_feature_set_absolute_control"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_convert_frames"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_free"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_feature_whitebalance_set_value"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_get_control_registers"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_capture_get_fileno"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_video_set_framerate"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_get_color_coding_bit_size"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_new"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_video_set_transmission"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_video_set_iso_speed"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_feature_set_power"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_feature_get_value"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_camera_free"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_video_get_supported_modes"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_set_control_registers"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_video_get_mode"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_video_get_supported_framerates"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_feature_get_all"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_capture_dequeue"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_deinterlace_stereo"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_capture_setup"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_feature_set_mode"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_feature_whitebalance_get_value"
/usr/bin/ld: /opt/opencv3/lib/libopencv_videoio.so: referência não definida para "dc1394_camera_enumerate"
collect2: error: ld returned 1 exit status
make: *** [Makefile:77: darknet] Error 1

Also so how do I removed this amazing new opencv I just installed and also does not work so I can start over? It does not offer a make uninstall.

@acxz can I unstall it with aur as it is properly listed?

extra/opencv 4.1.0-2 [installed: 3.4.2-2]
    Open Source Computer Vision Library
acxz commented 5 years ago

@vfbsilva I have went ahead and added vtk as a make dependency for the arch package. There is something deeper here, but the package now installs properly, which is good enough for now. As for you @vfbsilva I would recommend you just uninstall all instances of opencv and then go ahead and install the opencv package. The official opencv does have a make uninstall target. For any packages you can pacman -Rns the opencv packages and then pacman -S opencv. After that you should be good to go. If what you downloaded does not have a make uninstall I question where you got your opencv source code. But you can manually remove all associated files installed by it, albeit painfully.

vfbsilva commented 5 years ago

@acxz I've removed them manually but sosmething is broken both on opencv on arch or on the package from aur as I can no longer build:

==> Entrando no ambiente fakeroot...
==> Iniciando package()...
==> Installing files
cp: não foi possível obter estado de '/tmp/yaourt-tmp-imanewbie/aur-darknet-alexeyab-git/src/darknet/build-release/uselib_track': Arquivo ou diretório inexistente
==> ERRO: Uma falha ocorreu em package().
    Abortando...
==> ERRO: Makepkg não conseguiu compilar darknet-alexeyab-git
acxz commented 5 years ago

@vfbsilva for questions relating directly to the Arch package you should post in the respective packages comments section.

vfbsilva commented 5 years ago

Okay I did clean my opencv and installed it properly again but I'm still unable to compile. make: *** No rule to make target 'obj/image_opencv.o', needed by 'libdarknet.so'. Pare.

pkg-config --modversion opencv
4.1.0

This is my makefile:

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

ARCH= -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]
#      -gencode arch=compute_20,code=[sm_20,sm_21] \ This one is deprecated?

# This is what I use, uncomment if you know your arch and want to specify
# ARCH= -gencode arch=compute_52,code=compute_52

VPATH=./src/:./examples
SLIB=libdarknet.so
ALIB=libdarknet.a
EXEC=darknet
OBJDIR=./obj/

CC=gcc
CPP=g++
NVCC=nvcc 
AR=ar
ARFLAGS=rcs
OPTS=-Ofast
LDFLAGS= -lm -pthread 
COMMON= -Iinclude/ -Isrc/
CFLAGS=-Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC

ifeq ($(OPENMP), 1) 
CFLAGS+= -fopenmp
endif

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

CFLAGS+=$(OPTS)

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

ifeq ($(GPU), 1) 
COMMON+= -DGPU -I/usr/local/cuda/include/
CFLAGS+= -DGPU
LDFLAGS+= -L/usr/local/cuda/lib64 -lcuda -lcudart -lcublas -lcurand
endif

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

OBJ=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 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 iseg_layer.o 
EXECOBJA=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 instance-segmenter.o darknet.o
ifeq ($(GPU), 1) 
LDFLAGS+= -lstdc++ 
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
endif

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

all: obj backup results $(SLIB) $(ALIB) $(EXEC)
#all: obj  results $(SLIB) $(ALIB) $(EXEC)

$(EXEC): $(EXECOBJ) $(ALIB)
    $(CC) $(COMMON) $(CFLAGS) $^ -o $@ $(LDFLAGS) $(ALIB)

$(ALIB): $(OBJS)
    $(AR) $(ARFLAGS) $@ $^

$(SLIB): $(OBJS)
    $(CC) $(CFLAGS) -shared $^ -o $@ $(LDFLAGS)

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

$(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
backup:
    mkdir -p backup
results:
    mkdir -p results

.PHONY: clean

clean:
    rm -rf $(OBJS) $(SLIB) $(ALIB) $(EXEC) $(EXECOBJ) $(OBJDIR)/*
acxz commented 5 years ago

@vfbsilva That makefile that you are using does not seem to be from the master branch. Can you make sure to use the master branch of darknet.

vfbsilva commented 5 years ago

@acxz you are right, I messed my folders sorry. It did work with the Makefile from the master branch:

`GPU=1 CUDNN=1 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 x times (Mixed-precision on Tensor Cores) GPU: Volta, Xavier, Turing and higher

set AVX=1 and OPENMP=1 to speedup on CPU (if error occurs then set AVX=0)

DEBUG=0

ARCH= -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] \ -gencode arch=compute_61,code=[sm_61,compute_61]

OS := $(shell uname)

Tesla V100

ARCH= -gencode arch=compute_70,code=[sm_70,compute_70]

GeForce RTX 2080 Ti, RTX 2080, RTX 2070, Quadro RTX 8000, Quadro RTX 6000, Quadro RTX 5000, Tesla T4, XNOR Tensor Cores

ARCH= -gencode arch=compute_75,code=[sm_75,compute_75]

Jetson XAVIER

ARCH= -gencode arch=compute_72,code=[sm_72,compute_72]

GTX 1080, GTX 1070, GTX 1060, GTX 1050, GTX 1030, Titan Xp, Tesla P40, Tesla P4

ARCH= -gencode arch=compute_61,code=sm_61 -gencode arch=compute_61,code=compute_61

GP100/Tesla P100 - DGX-1

ARCH= -gencode arch=compute_60,code=sm_60

For Jetson TX1, Tegra X1, DRIVE CX, DRIVE PX - uncomment:

ARCH= -gencode arch=compute_53,code=[sm_53,compute_53]

For Jetson Tx2 or Drive-PX2 uncomment:

ARCH= -gencode arch=compute_62,code=[sm_62,compute_62]

VPATH=./src/ EXEC=darknet OBJDIR=./obj/

ifeq ($(LIBSO), 1) LIBNAMESO=libdarknet.so APPNAMESO=uselib endif

CC=gcc CPP=g++ NVCC=nvcc OPTS=-Ofast LDFLAGS= -lm -pthread COMMON= -Iinclude/ -I3rdparty/stb/include CFLAGS=-Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC

ifeq ($(DEBUG), 1)

OPTS= -O0 -g

OPTS= -Og -g

COMMON+= -DDEBUG CFLAGS+= -DDEBUG else ifeq ($(AVX), 1) CFLAGS+= -ffp-contract=fast -mavx -mavx2 -msse3 -msse4.1 -msse4.2 -msse4a endif endif

CFLAGS+=$(OPTS)

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

ifeq ($(OPENMP), 1) CFLAGS+= -fopenmp LDFLAGS+= -lgomp endif

ifeq ($(GPU), 1) COMMON+= -DGPU -I/usr/local/cuda/include/ CFLAGS+= -DGPU ifeq ($(OS),Darwin) #MAC LDFLAGS+= -L/usr/local/cuda/lib -lcuda -lcudart -lcublas -lcurand else LDFLAGS+= -L/usr/local/cuda/lib64 -lcuda -lcudart -lcublas -lcurand endif endif

ifeq ($(CUDNN), 1) COMMON+= -DCUDNN ifeq ($(OS),Darwin) #MAC CFLAGS+= -DCUDNN -I/usr/local/cuda/include LDFLAGS+= -L/usr/local/cuda/lib -lcudnn else CFLAGS+= -DCUDNN -I/usr/local/cudnn/include LDFLAGS+= -L/usr/local/cudnn/lib64 -lcudnn endif endif

ifeq ($(CUDNN_HALF), 1) COMMON+= -DCUDNN_HALF CFLAGS+= -DCUDNN_HALF ARCH+= -gencode arch=compute_70,code=[sm_70,compute_70] endif

ifeq ($(ZED_CAMERA), 1) CFLAGS+= -DZED_STEREO -I/usr/local/zed/include LDFLAGS+= -L/usr/local/zed/lib -lsl_core -lsl_input -lsl_zed

-lstdc++ -D_GLIBCXX_USE_CXX11_ABI=0

endif

OBJ=image_opencv.o http_stream.o gemm.o utils.o dark_cuda.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 darknet.o detection_layer.o captcha.o route_layer.o writing.o box.o nightmare.o normalization_layer.o avgpool_layer.o coco.o dice.o yolo.o detector.o layer.o compare.o classifier.o local_layer.o swag.o shortcut_layer.o activation_layer.o rnn_layer.o gru_layer.o rnn.o rnn_vid.o crnn_layer.o demo.o tag.o cifar.o go.o batchnorm_layer.o art.o region_layer.o reorg_layer.o reorg_old_layer.o super.o voxel.o tree.o yolo_layer.o upsample_layer.o lstm_layer.o conv_lstm_layer.o ifeq ($(GPU), 1) LDFLAGS+= -lstdc++ OBJ+=convolutional_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 network_kernels.o avgpool_layer_kernels.o endif

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

all: obj backup results setchmod $(EXEC) $(LIBNAMESO) $(APPNAMESO)

ifeq ($(LIBSO), 1) CFLAGS+= -fPIC

$(LIBNAMESO): $(OBJS) include/yolo_v2_class.hpp src/yolo_v2_class.cpp $(CPP) -shared -std=c++11 -fvisibility=hidden -DLIB_EXPORTS $(COMMON) $(CFLAGS) $(OBJS) src/yolo_v2_class.cpp -o $@ $(LDFLAGS)

$(APPNAMESO): $(LIBNAMESO) include/yolo_v2_class.hpp src/yolo_console_dll.cpp $(CPP) -std=c++11 $(COMMON) $(CFLAGS) -o $@ src/yolo_console_dll.cpp $(LDFLAGS) -L ./ -l:$(LIBNAMESO) endif

$(EXEC): $(OBJS) $(CPP) -std=c++11 $(COMMON) $(CFLAGS) $^ -o $@ $(LDFLAGS)

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

$(OBJDIR)%.o: %.cpp $(DEPS) $(CPP) -std=c++11 $(COMMON) $(CFLAGS) -c $< -o $@

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

obj: mkdir -p obj backup: mkdir -p backup results: mkdir -p results setchmod: chmod +x *.sh

.PHONY: clean

clean: rm -rf $(OBJS) $(EXEC) $(LIBNAMESO) $(APPNAMESO) ` As long as I don't try to build libso.

acxz commented 5 years ago

@AlexeyAB I got around to test the opencv source code. To provide closure to this issue:

Installed opencv 4.1 from source without vtk and vtk not installed:

Installed opencv 4.1 from source without vtk and vtk installed:

Installed opencv 4.1 from source with vtk and still had vtk installed:

Installed opencv 4.1 from source with vtk and uninstalled vtk:

Installed opencv (4.1) from Arch repos (vtk is make dependency), but vtk uninstalled:

Installed opencv (4.1) from Arch repos (vtk is make dependency), and vtk installed:

TLDR: opencv packaging issue on Arch

AlexeyAB commented 5 years ago

@acxz Excellent conclusion! Have you created an Issue/Bug report for an OpenCV package in Arch Linux?

acxz commented 5 years ago

@AlexeyAB I was about to but after some searching of old bug reports I found this: https://bugs.archlinux.org/task/62873 Which was closed due to being a duplicate of this: https://bugs.archlinux.org/task/59745

I suggest you read them. In the end the maintainer recommends to either bring the issue up to the opencv repo or fix the issue on the application side of opencv.

But this is a bit weird since if that was the case I would have ran into an issue when I checked opencv from source with vtk and then uninstalled vtk.

EDIT: another thing, I looked at the opencv package for Ubuntu to see how other distros deal with this and the opencv package for ubuntu actually has vtk as a required dependency. e.g. there is no way to install opencv without vtk on ubuntu unless you install opencv from source.

AlexeyAB commented 5 years ago

@acxz

https://bugs.archlinux.org/task/62873

Steps to reproduce:

  1. Uninstall any of the listed dependencies (vtk, glew, hdf5).
  2. Create file a.cpp with contents (not even including a header):

It seems, he uninstalled VTK after OpenCV package installation.


Did you unustall VTK after OpenCV package installation?

If no, then it is not duplicate of any of these bugs https://bugs.archlinux.org/task/62873 and https://bugs.archlinux.org/task/59745

Then it can'be be solved by Application or OpenCV-repo, so should be created new bug-report.

acxz commented 5 years ago

@AlexeyAB yes I uninstalled VTK after installing OpenCV both package and source, that is what I meant by

Installed opencv 4.1 from source with vtk and uninstalled vtk:

and

Installed opencv (4.1) from Arch repos (vtk is make dependency), but vtk uninstalled:

I have a doubt in my mind that I did not sudo ldconfig each time after installing opencv from source, so I am actually redoing the first quote right now.

AlexeyAB commented 5 years ago

@acxz If VTK is uninstalled after OpenCV installation, then this is a problem the user has created, and it should solve the user. It can not be resolved in any way: neither in opencv-repo, nor in opencv-package, nor in the application (that does not use vtk directly).

acxz commented 5 years ago

@AlexeyAB That makes sense, but then again it is weird that my source install of opencv (compiled against vtk) was able to build darknet correctly even after I uninstalled vtk (just tried again to make sure). And this behaviour specifically is not being replicated by the Arch Package. (the Arch opencv package installation does not build darknet, if vtk is not installed)

Once I get time, I will try to submit a bug report to the Arch opencv package with a small example based on the darknet build. I will be sure to let you guys know what becomes of it.

AlexeyAB commented 5 years ago

@acxz That is why I asked if VTK was removed before or after installing OpenCV-pack. If before - then it isn't a duplicate of any of these bugs https://bugs.archlinux.org/task/62873 and https://bugs.archlinux.org/task/59745 This is another bug - since Arch-OpenCV-package must forcibly install VTK as mandatory dependecy.