Search code examples
opencvubuntuyolodarknet

YoloV3 : undefined symbol: _ZN9_IplImageC1ERKN2cv3MatE when Build with OpenCV


I use https://github.com/AlexeyAB/darknet to run Yolo V3 and darknet is built using OpenCV 3.4.0.

When I tried to run this command ./darknet detector train data/obj.data cfg/objyolov3.cfg darknet53.conv.74 to train my own dataset, with OPENCV = 0 training works successfully, but when I build with OPENCV=1, I got this following error :

Loading weights from darknet53.conv.74...
 seen 64 
Done!
Learning Rate: 0.001, Momentum: 0.9, Decay: 0.0005
 If error occurs - run training with flag: -dont_show 
Resizing
896 x 896 
./darknet: symbol lookup error: ./darknet: undefined symbol: _ZN9_IplImageC1ERKN2cv3MatE

The chart image showed up but closed immediately, adding -dont_show also not helping. I couldn't find similar problem on the internet, any solution for this?


Solution

  • I know this is very rare to encounter this problem. But I managed to solve it after discussed it with the repo's author. Insted building darknet using make, it works when I built darknet using cmake.

    • Edit CMakeLists.txt in darknet folder and add this line : SET(OpenCV_DIR /home/<Change this to your OPENCV path installation>/OpenCV-3.4.0/share/OpenCV/)
    • cmake .
    • make

    Original github issue : https://github.com/AlexeyAB/darknet/issues/2489