Closed Grench6 closed 3 years ago
Some changes I suggest to the setup for Ubuntu:
sudo apt install gfortran
./amdgpu-install –pro –opencl=pal,legacy -y
with ./amdgpu-pro-install -y --opencl=pal,legacy
sudo cp cp library/libclBLAS.so.2.12.0 /usr/lib/x86_64-linux-gnu/libclBLAS.so.2.12.0
with sudo cp library/libclBLAS.so.2.12.0 /usr/lib/x86_64-linux-gnu/libclBLAS.so.2.12.0
sudo ldconfig
cat Makefile.bak | sed ‘s/NVIDIA=1/NVIDIA=0/g’ | sed ‘s/AMD=0/AMD=1/g’ > Makefile
not working, had to change the Makefile with gedit.Cheers
@Grench6 Thank you very much, overall it works or not? Thx!
Hello! To be able to determine if darknet works in the "overall" meaning of the word I decided to do the following:
Makefile
../examples/cgan.c
which make use of OpenCV../src/image.c
(to be able to see the results).
printf("%s: %.0f%%\n", names[j], dets[i].prob[j]*100);
if (bot > im.h - 1) bot = im.h - 1;
on the same function modified above (line no. 297):
printf("Bounding Box: Left=%d, Top=%d, Right=%d, Bottom=%d\n", left, top, right, bot);
After rebuilding darknet with those changes, everything seems to be working properly:
user@user-pc:~/github/darknet$ ./darknet detect cfg/yolov3.cfg yolov3.weights data/dog.jpg
Device IDs: 1
Device ID: 0
Device name: Ellesmere
Device vendor: Advanced Micro Devices, Inc.
Device opencl availability: OpenCL 1.2 AMD-APP (3180.7)
Device opencl used: 3180.7
Device double precision: YES
Device max group size: 256
Device address bits: 64
layer filters size input output
0 conv 32 3 x 3 / 1 608 x 608 x 3 -> 608 x 608 x 32 0.639 BFLOPs
1 conv 64 3 x 3 / 2 608 x 608 x 32 -> 304 x 304 x 64 3.407 BFLOPs
[...]
105 conv 255 1 x 1 / 1 76 x 76 x 256 -> 76 x 76 x 255 0.754 BFLOPs
106 yolo
Loading weights from yolov3.weights...Done!
data/dog.jpg: Predicted in 1.645569 seconds.
dog: 100%
Bounding Box: Left=134, Top=214, Right=313, Bottom=542
truck: 92%
Bounding Box: Left=476, Top=81, Right=684, Bottom=168
bicycle: 99%
Bounding Box: Left=99, Top=124, Right=589, Bottom=448
user@user-pc:~/github/darknet$
So yes, in overall darknet is working properly, but then why is opencv not working when displaying the results (throwing the exception in the title)?
PS: Now I see the error in
Fix cat Makefile.bak | sed ‘s/NVIDIA=1/NVIDIA=0/g’ | sed ‘s/AMD=0/AMD=1/g’ > Makefile not working, had to change the Makefile with gedit.
For some reason the command has ‘ instead of '. The correct one is: cat Makefile.bak | sed 's/NVIDIA=1/NVIDIA=0/g' | sed 's/AMD=0/AMD=1/g' > Makefile
Okay, I found a way to make it work:
sudo apt install libgtk2.0-dev libcanberra-gtk-module libcanberra-gtk0
wget https://github.com/opencv/opencv/archive/3.4.0.tar.gz
And then OpenCV should work as expected with darknet. The main issue with 3.4.0 version was the Gimp Toolkit components missing.
I could not find a way to make it work with OpenCV3.4.12 as I kept getting the exact same error:
terminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(3.4.12) /home/user/clBLAS-2.12-sowson/src/build/opencv-3.4.12/modules/core/src/matrix_wrap.cpp:771: error: (-215:Assertion failed) (flags & FIXED_TYPE) != 0 in function 'type'
Aborted (core dumped)
I suggest to include the installation of the Gimp Toolkit packages (described at the beginning) and use OpenCV 3.4.0 in the setup instructions.
The error can be reproduced by following the setup commands in a fresh and clean installation of Ubuntu 20.04.1 LTS.
After compiling and building everything, nothing seems wrong at all... until you try to use darknet:
I already tried downgrading opencv to 3.4.0 as @AlexeyAB proposed for his repo in an issue:
Also found this similar issue:
but it threw another error (which had something to do with an unimplemented method of a cvWindow or something like that).
I don't know a thing about the OpenCV API, however, your project seems to be using the good C++ API and not the C deprecated one (read from here), so I just don't get what its wrong...