Closed vfbsilva closed 4 years ago
Hello @vfbsilva, which kind of machine did you use for compiling darknet? I succeeded in thinkpad x200 (which is a 64-bit machine) and failed with the same error message as yours in thinkpad x60 (which is a 32-bit machine.) Besides, did you pacman -S opencv? I mean, did you compile opencv from source or install from pacman? (my x60 is parabola and x200 arch linux)
I did install from pacman. The machine is 64 bits.
Ok, let me find some time writing my own experience on this. I just noticed there is one difference: I pacman installed opencv too, but my paths are always opencv4, unlike yours (opencv3). Anyway, I might as well help others if I managed to share.
@phunc20 thanks a lot. I've found a work around with docker. But It does involve creating my own image so I can load my weighs and then run it as:
docker run --net=host --env="DISPLAY" --volume="$HOME/.Xauthority:/root/.Xauthority:rw" --runtime=nvidia --rm -v $PWD:/workspace -w /workspace daisukekobayashi/darknet:gpu-cv darknet detector demo cfg/coco.data cfg/yolov3.cfg yolov3.weights -i 0 -thresh 0.25 'Yourvideo.mp4'
Basically you need to append the files you want to run on the following makefile:
ARG BASE_IMAGE=nvidia/cuda:10.0-cudnn7-devel
FROM $BASE_IMAGE
LABEL maintainer="Daisuke Kobayashi <daisuke@daisukekobayashi.com>"
ENV DEBIAN_FRONTEND noninteractive
ARG ADDITIONAL_PACKAGES=""
RUN apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y gnupg2 ca-certificates \
git build-essential $ADDITIONAL_PACKAGES \
&& rm -rf /var/lib/apt/lists/*
COPY configure.sh /tmp/
ARG SOURCE_BRANCH=unspecified
ENV SOURCE_BRANCH $SOURCE_BRANCH
ARG SOURCE_COMMIT=unspecified
ENV SOURCE_COMMIT $SOURCE_COMMIT
ARG CONFIG
RUN git clone https://github.com/AlexeyAB/darknet.git && cd darknet \
&& git checkout $SOURCE_BRANCH \
&& git reset --hard $SOURCE_COMMIT \
&& /tmp/configure.sh $CONFIG && make \
&& cp darknet /usr/local/bin \
&& cd .. && rm -rf darknet
And from my understanding to train under this setup I need volumes so I can persist the trained files which is again a new level of complexity.
Thanks, I haven't tried with docker, but I think I'll follow your instructions next time I wanted to use opencv with darknet.
Basically, I just sudo pacman -S opencv
, and then follow this link to modify two files in the darknet
repo. (I used only pjreddie's github repo only, not AlexeyAB's.) Once the files modified, you can start to compile (either make
or make clean all
). Back when I compiled, I still met some error messages, but those eventually turned out being able to be solved simply by installing more packages from, e.g. in my case, sudo pacman -S qt5 hdf5 vtk glew
. Sorry for not being spontaneously enough, because i/ I was kind of busy these days; ii/ I experimented once more on my parabola thinkpad x201 (which unfortunately failed and which made me wonder if on parabola one need some extra effort to make it work.) If my memory serves me well, this is all that I did to make it work on my x200; otherwise, one might need to make one or two symlink, but I think my memory is correct and that's all one needs to do.
@vfbsilva
It seems that there is an issue in Archlinx+OpenCV+OPENEXR
Do you mean that you can't compile OpenCV on Archlinux ?
Do you mean that you can't compile OpenCV on Archlinux by using Pacman
https://www.archlinux.org/packages/?q=opencv ?
And do you mean that you can compile OpenCV and then Darknet on Archlinux only by using Docker?
I found your issue: https://forum.manjaro.org/t/undefined-references-to-libimf-in-opencv/112184/4
Possible solution: try to build OpenCV with cmake -DBUILD_OPENEXR=OFF -WITH_OPENEXR=OFF
do you actually need openexr support (floating point images, HDR and such) ?
it seems, some dependancies of the 3rdparty openexr module have the wrong version.
you could disable it with
cmake -DBUILD_OPENEXR=OFF -WITH_OPENEXR=OFF
I can't compile OpenCV on Manjaro (arch derivative). I don't use pacman on my install I've tried both aur and source. Yes I've looked for that before but I might be setting this options wrongly. Whats the right way to do it? @acxz does it help?
@vfbsilva What command did you use for training OpenCV from source?
Did you add these flags to cmake command?
-DBUILD_OPENEXR=OFF -WITH_OPENEXR=OFF
I did not compile opencv from source. I've tried https://github.com/acxz/pkgbuilds/blob/master/darknet-alexeyab-git/PKGBUILD
I did try to add those flags. Maybe I did it wrongly. I added: set (CMAKE_CXX_FLAGS " -DBUILD_OPENEXR=OFF -WITH_OPENEXR=OFF") to the makefile
I have managed to get darknet working on ArchLinux using the AUR package, darknet-alexeyab-git
. I had to use opencv, openexr, and ilmbase compiled with gcc8 however. See https://aur.archlinux.org/packages/darknet-alexeyab-git/#pinned-736206 for more information.
Note: the AUR does not support Manjaro, and by extension I also do not. However, maybe what works on ArchLinux might also work for you. I highly recommend using ArchLinux or a proper Arch-Repo compatible distro like EndeavourOS, instead of an Arch-Repo incompatible distro like Manjaro, which comes with its own set of issues.
@acxz Do you use KDE? Cause I do and the removal of the packages you suggests breaks among other things KDE libs.
LC_ALL=en_US sudo pacman -Rns opencv openexr
[sudo] password for vfbsilva:
checking dependencies...
error: failed to prepare transaction (could not satisfy dependencies)
:: removing openexr breaks dependency 'openexr' required by freeimage
:: removing openexr breaks dependency 'openexr' required by gegl
:: removing openexr breaks dependency 'openexr' required by gimp
:: removing openexr breaks dependency 'openexr' required by gst-plugins-bad
:: removing openexr breaks dependency 'openexr' required by kdelibs
:: removing openexr breaks dependency 'openexr' required by kimageformats
:: removing openexr breaks dependency 'openexr' required by kio-extras
:: removing openexr breaks dependency 'openexr' required by krita
:: removing opencv breaks dependency 'opencv=4.2.0' required by opencv-samples
vfbsilva@mordor ~/Downloads/pacotes $
I can switch to endeavour or arch but I wanna be sure of that would be a real fix in my case.
I do not use KDE.
I would recommend switching to EndeavourOS in any case.
I have updated the instructions, that do not involve uninstalling. https://aur.archlinux.org/packages/darknet-alexeyab-git/#pinned-736206
@acxz updated instructions fixed the issue I'm closing it as a solution was provided.
I stumble always in the following error: