prabindh / darknet

Convolutional Neural Networks
http://pjreddie.com/darknet/
Other
122 stars 46 forks source link

Darknet returning garbage bounding boxes in Qt Event Loop #3

Closed isgursoy closed 7 years ago

isgursoy commented 7 years ago

https://github.com/prabindh/qt5-opencv3-darknet/issues/1 https://groups.google.com/forum/#!topic/darknet/LHIwhQ2l3pQ

I am opening issue here; it is about darknet, nothing to do with that qt5-opencv3-darknet pseudo example.

prabindh commented 7 years ago

Since this issue does not arise when running outside of Qt5 as done by other users, I am considering this low priority. If there is sufficient interest, can look at it.

isgursoy commented 7 years ago

You mean Qt 1, 2, 3, 4 are okay? :) Qt is just a symptom, there is a heap corruption and you are considering this low priority.

isgursoy commented 7 years ago

Test Image: test Without QApplication: withoutqapplication With QApplication: withqapplication

prabindh commented 7 years ago

Igor, this is great. Are the wrong bounding boxes gone now ?

isgursoy commented 7 years ago

No Igor, QApplication is bringing false negatives as you see. I just want to visualize issue. Nothing changed.

prabindh commented 7 years ago

There was an update on Qt app (or any other app) that uses the shared library, in this https://github.com/prabindh/darknet/issues/11. Please check if it applies.

isgursoy commented 7 years ago

Does not work here. I tried both of the cpu and gpu versions.

Using same pri's for app and lib.

config.pri:

!CUDA_OFF{
        exists("/usr/local/cuda/version.txt") {    
            message("FOUND CUDA")             
            DEFINES+=CUDA_AVAILABLE             
            CONFIG+=CUDA_AVAILABLE               
            include(cuda.pri)
        }
    }
.
.
.
CONFIG+=c++14
QMAKE_CFLAGS_DEBUG +=-O0
QMAKE_CFLAGS_DEBUG +=-g
QMAKE_CFLAGS_RELEASE +=-Ofast
QMAKE_CFLAGS_RELEASE +=-O1
QMAKE_CXXFLAGS_RELEASE += -Ofast
QMAKE_CXXFLAGS_RELEASE += -O1
QMAKE_CXXFLAGS_WARN_ON = -Wall -Wno-unused-parameter -Wno-unused-function

cuda.pri

DEFINES += GPU
CONFIG+=GPU
#DEFINES += OPENCV
#CONFIG+= OPENCV
#DEFINES += DEBUG
#CONFIG+= DEBUG
#DEFINES += CUDNN
#CONFIG+= CUDNN

for(_defines, CUDA_DEFINES):{                                 
    formatted_defines += -D$$_defines
}

CUDA_DEFINES = $$formatted_defines
isgursoy commented 7 years ago

Solution is setlocale(LC_NUMERIC,"C"); right after QApplication ctor. https://doc.qt.io/qt-5/qcoreapplication.html#locale-settings

prabindh commented 7 years ago

So it turns it the label read was incorrect ? Good information.

isgursoy commented 7 years ago

I am not sure, something wrong with float's, probably corruption.

prabindh commented 7 years ago

Added a commit for this. I see this is also mentioned in - http://doc.qt.io/qt-5/qcoreapplication.html

prabindh commented 7 years ago

https://github.com/prabindh/darknet/commit/cdff53ece784229c3fd122d3b8bd1da94eaeb178

isgursoy commented 7 years ago

good job, we are done.