Sparkling-Water/yolo_darknet

Help! I got troubles!

Opened this issue · 5 comments

when I compile the makefile, there was a error as follows:

g++ -std=c++11 -D_GNU_SOURCE -D_REENTRANT=1 -D_FILE_OFFSET_BITS=64 -DNDEBUG -march=native -O2 -fPIC -fomit-frame-pointer -pipe -Wall -Wextra -Wno-unused-result -fno-strict-aliasing -ffunction-sections -fdata-sections -I/usr/local/include/opencv4 -I. -ldarknet -L/usr/local/lib -lopencv_gapi -lopencv_highgui -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_video -lopencv_calib3d -lopencv_features2d -lopencv_dnn -lopencv_flann -lopencv_videoio -lopencv_imgcodecs -lopencv_imgproc -lopencv_core -c ./detection.cpp
In file included from ./detection.cpp:8:0:
./yolo_v2_class.hpp: In constructor ‘track_kalman_t::track_kalman_t(int, int, float, cv::Size)’:
./yolo_v2_class.hpp:708:14: warning: ‘track_kalman_t::img_size’ will be initialized after [-Wreorder]
cv::Size img_size; // max value of x,y,w,h
^~~~~~~~
./yolo_v2_class.hpp:700:9: warning: ‘int track_kalman_t::track_id_counter’ [-Wreorder]
int track_id_counter;
^~~~~~~~~~~~~~~~
./yolo_v2_class.hpp:853:5: warning: when initialized here [-Wreorder]
track_kalman_t(int _max_objects = 1000, int _min_frames = 3, float _max_dist = 40, cv::Size _img_size = cv::Size(10000, 10000)) :
^~~~~~~~~~~~~~
./yolo_v2_class.hpp: In member function ‘void track_kalman_t::clear_old_states()’:
./yolo_v2_class.hpp:879:50: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if ((result_vec_pred[state_id].x > img_size.width) ||
./yolo_v2_class.hpp:880:50: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
(result_vec_pred[state_id].y > img_size.height))
./yolo_v2_class.hpp: In member function ‘track_kalman_t::tst_t track_kalman_t::get_state_id(bbox_t, std::vector&)’:
./yolo_v2_class.hpp:900:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (size_t i = 0; i < max_objects; ++i)
~~^~~~~~~~~~~~~
./yolo_v2_class.hpp: In member function ‘std::vector<bbox_t> track_kalman_t::predict()’:
./yolo_v2_class.hpp:990:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (size_t i = 0; i < max_objects; ++i)
~~^~~~~~~~~~~~~
./yolo_v2_class.hpp: In member function ‘std::vector<bbox_t> track_kalman_t::correct(std::vector<bbox_t>)’:
./yolo_v2_class.hpp:1025:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (size_t i = 0; i < max_objects; ++i)
~~^~~~~~~~~~~~~
./detection.cpp: In function ‘void Drawer(cv::Mat&, std::vector<bbox_t>, std::vector<std::__cxx11::basic_string >)’:
./detection.cpp:43:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < outs.size(); i++)
~~^~~~~~~~~~~~~
g++ -std=c++11 -o main detection.o -I. -ldarknet -L/usr/local/lib -lopencv_gapi -lopencv_highgui -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_video -lopencv_calib3d -lopencv_features2d -lopencv_dnn -lopencv_flann -lopencv_videoio -lopencv_imgcodecs -lopencv_imgproc -lopencv_core # 生成可执行文件
detection.o:在函数‘main’中:
detection.cpp:(.text.startup.main+0x25f):对‘Detector::Detector(std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, int)’未定义的引用
collect2: error: ld returned 1 exit status
makefile:85: recipe for target 'all' failed
make: *** [all] Error 1

请问一下,你这个问题解决了吗,我也是这个报错,换了好几个版本gcc和g++都不行

请问一下,你这个问题解决了吗,我也是这个报错,换了好几个版本gcc和g++都不行

我的解决了,把yolov3中的darknet.h放到和detection.cpp一个文件夹下。如果还不行,则要注意生成libdarknet.so动态库的过程要注意cudnn和cuda的路径。

请问一下,你这个问题解决了吗,我也是这个报错,换了好几个版本gcc和g++都不行

我的解决了,把yolov3中的darknet.h放到和detection.cpp一个文件夹下。如果还不行,则要注意生成libdarknet.so动态库的过程要注意cudnn和cuda的路径。

感谢回复,我按照这个思路,但还是同样的报错,请问您的意思是我附图中这样吗,这个darknet.h是darknet源码中的
2022-04-20 16-49-45屏幕截图

这是我的材料,你需要把yolov4.weight文件加进对应的文件夹下(太大了,没法发送邮件,我就删除了)。我电脑可以跑。 另外,我刚才提的“生成libdarknet.so动态库的过程要注意cudnn和cuda的路径”,生成动态库应该在原yolov3中的make文件中吧,不是你提到的makefile文件。

------------------ 原始邮件 ------------------ 发件人: "Sparkling-Water/yolo_darknet" @.>; 发送时间: 2022年4月20日(星期三) 下午4:50 @.>; @.@.>; 主题: Re: [Sparkling-Water/yolo_darknet] Help! I got troubles! (Issue #3) 请问一下,你这个问题解决了吗,我也是这个报错,换了好几个版本gcc和g++都不行 我的解决了,把yolov3中的darknet.h放到和detection.cpp一个文件夹下。如果还不行,则要注意生成libdarknet.so动态库的过程要注意cudnn和cuda的路径。 感谢回复,我按照这个思路,但还是同样的报错,请问您的意思是我附图中这样吗,这个darknet.h是darknet源码中的 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

我是用的yolov4-tiny.weight,已经放在了刚才图片的yolo文件夹下了。刚才图片中那个Makefile文件是darknet源码中的,我是在源码中先编译生成动态库,再把.so文件放到/uer/lib文件夹下面的