prabindh / darknet

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

arapaho.cpp:322:68: error when compiled with the latest darknet code #46

Closed rickythink closed 7 years ago

rickythink commented 7 years ago

much thanks for this great solution, do give me a big help! But when changing the src folder to the latest darknet source code[1e72980 ], it shows:

darknet-wrapper/arapaho.cpp: In member function ‘void ArapahoV2::__Detect(float*, float, float, int&)’:
/home/ricky/RICKY/EXTEND/PROJECT/FIRE-EYE/lib/darknet-wrapper/arapaho.cpp:322:68: error: invalid conversion from ‘float**’ to ‘int’ [-fpermissive]
   get_region_boxes(l, 1, 1, thresh, probs, boxes, 0, 0, hier_thresh);
                                                                    ^
/home/ricky/RICKY/EXTEND/PROJECT/FIRE-EYE/lib/darknet-wrapper/arapaho.cpp:322:68: error: cannot convert ‘box*’ to ‘float’ for argument ‘6’ to ‘void get_region_boxes(layer, int, int, int, int, float, float**, box*, float**, int, int*, float, int)’
make[2]: *** [darknet-wrapper/CMakeFiles/darknet_wrapper.dir/arapaho.cpp.o] 错误 1
make[1]: *** [darknet-wrapper/CMakeFiles/darknet_wrapper.dir/all] 错误 2

It seems like the definition of get_region_boxes in the darknet has been changed while the arapaho.cpp haven't adjust to it.

So has anyone faced the problem and solved it ?

prabindh commented 7 years ago

As mentioned in the readme, the latest changes are not in the main branch.

LSTM changes in mainline, are in the branch "merge_lstm_gru_jun17". Master always is stable.

prabindh commented 7 years ago

@RickyWong33 Please check with the merge_lstm_gru_jun17 branch and let me know.

rickythink commented 7 years ago

Much thanks for your quick reply. I just test the merge_lstm_gru_jun17 branch while the similar error occurs.

error: cannot convert ‘float’ to ‘int*’ for argument ‘11’ to ‘voidget_region_boxes(layer, int, int, int, int, float, float**, box*, float**, int, int*, float, int)’
   get_region_boxes(l, 1, 1, net.w, net.h, thresh, probs, boxes, 0, 0, hier_thresh, 0);
                                                                                     ^
make[2]: *** [darknet-wrapper/CMakeFiles/darknet_wrapper.dir/arapaho.cpp.o] 错误 1
make[1]: *** [darknet-wrapper/CMakeFiles/darknet_wrapper.dir/all] 错误 2

It turns out the get_region_boxes in the latest darknet defines as blow:

void get_region_boxes(layer l, int w, int h, int netw, int neth, float thresh, float **probs, box *boxes, float **masks, int only_objectness, int *map, float tree_thresh, int relative)

while we call this function in arapaho.cpp is

get_region_boxes(l, 1, 1, net.w, net.h, thresh, probs, boxes, 0, 0, hier_thresh, 0);

Apparently there is not enough parameters for the get_region_boxes function so I change the above like this:

get_region_boxes(l, 1, 1, net.w, net.h, thresh, probs, boxes, 0, 0, hier_thresh, 0, 0);

However, the key problem is the origin function requires an int *map variable but what we put in is hier_thresh, which is a float.

This is what i find till now.

prabindh commented 7 years ago

@RickyWong33 checking it now.

prabindh commented 7 years ago

@RickyWong33 The *map parameter can be passed as NULL in the _get_regionboxes call, as we do not do any remapping. I will have to do more testing before I can commit, but you can try with this change.

get_region_boxes(l, 1, 1, net.w, net.h, thresh, probs, boxes, 0, 0, NULL, hier_thresh, 0);

rickythink commented 7 years ago

yes sure, i have successfully applied this change for normal yolo v2 test. Howerver, yolo9000 test failed.

It seems like the yolo9000 will take use the map feature.

thanks bro.

prabindh commented 7 years ago

How did you test yolo9000 from Arapaho (since we are not using any map input) ?

rickythink commented 7 years ago

Sorry for the late reply. XD, I just made some mistakes at other part of my project.

And the fact is that it turns out this change

get_region_boxes(l, 1, 1, net.w, net.h, thresh, probs, boxes, 0, 0, NULL, hier_thresh, 0);

actually performs very well in yolo9000 test as well, without any error.

Maybe it will cause some unexpected things since we just ignore the map variable, but whatever I think we can use it as this way first.