for-aiur / yolo_cpp

C++ed version of Yolo
Other
69 stars 37 forks source link

yolo_cpp not working with own weight-files #4

Closed gerritgr closed 6 years ago

gerritgr commented 6 years ago

Hi,

First of all great work! yolo_cpp helps us very much incorporating yolo seamless into our Cpp-framework. Everything works fine for us, using the pre--trained weights from the darknet-website. However, if we include weight-files, trained by ourselves no objects are detected anymore. Even when the threshold is set to a minimal value (e.g. 0.001). The self-trained weights work with the original yolo command line tool fine and detect objects classes as expected taking higher thresholds like e.g. 0.25. As we are not experiencing runtime errors, we are not sure were we are wrong. Any idea what might be the problem? Thanks in advance!

for-aiur commented 6 years ago

Hi,

It is really hard to find out where the problem lies. All I can say is, we are using our own weights as well without having similar issues. Maybe you set the wrong file for class labels or something similar.

gerritgr commented 6 years ago

Hi,

thank you very much for your fast response. We thought so, too, and doublechecked everything multiple times. However, the weird situation is, that keep everything (.cfg/.names/.data) and only switching between a self-trained and official weight-file causes the network to either predict some classes (depending on the threshold) or to show no reaction at all. Using the command line or the python-binding, everything works as expected.

Sorry to bother you again, but do you maybe have any idea, how we could narrow down the problem or if there is any way to check if the network loaded the weights correctly.

gerritgr commented 6 years ago

As it turned out, we used a version of darknet for training which contains a different procedure for image scaling (letterbox_image instead of resize_image). This results in incompatible weight files. Including letterbox_image and calling it, resolved the problem for us.

Sunyouteng commented 5 years ago

@gerritgr hello , friend. you just only make a change from resize_image to letterbox_image ? did you make other changes? I have the same problem as you. I have been debugging it for 3 days. I don't know can you push your code to github or send me the source to my email. I appreciate that a lot . sunyouteng@163.com