dog-qiuqiu / Yolo-Fastest

:zap: Based on yolo's ultra-lightweight universal target detection algorithm, the calculation amount is only 250mflops, the ncnn model size is only 666kb, the Raspberry Pi 3b can run up to 15fps+, and the mobile terminal can run up to 178fps+
Other
1.98k stars 427 forks source link

About ncnn_sample Compile Guide #25

Closed Hideousmon closed 1 year ago

Hideousmon commented 3 years ago

Sincerely suggest that you could add “\” before the “`” in ncnn_sample's README.md, so that it may be easier for new comers to get started.

2684160504 commented 3 years ago

Sincerely suggest that you could add “\” before the “`” in ncnn_sample's README.md, so that it may be easier for new comers to get started.

HI,* g++ -o yolo-fastest yolo-fastest.cpp -I include/ncnn/ lib/libncnn.a pkg-config --libs --cflags opencv -fopenmp

Hideousmon commented 3 years ago

Sincerely suggest that you could add “\” before the “`” in ncnn_sample's README.md, so that it may be easier for new comers to get started.

HI,* g++ -o yolo-fastest yolo-fastest.cpp -I include/ncnn/ lib/libncnn.a pkg-config --libs --cflags opencv -fopenmp

  • Usage: ./yolo-fastest: how to use?

If there is no errors while compiling, you should be able to simply run ./yolo-fastest in the dir.

2684160504 commented 3 years ago

Sincerely suggest that you could add “\” before the “`” in ncnn_sample's README.md, so that it may be easier for new comers to get started.

HI,* g++ -o yolo-fastest yolo-fastest.cpp -I include/ncnn/ lib/libncnn.a pkg-config --libs --cflags opencv -fopenmp

  • Usage: ./yolo-fastest: how to use?

If there is no errors while compiling, you should be able to simply run ./yolo-fastest in the dir.

Screenshot from 2020-10-20 14-59-52 After compiling NCNN,run Yolo-fastest?

Hideousmon commented 3 years ago

Sincerely suggest that you could add “\” before the “`” in ncnn_sample's README.md, so that it may be easier for new comers to get started.

HI,* g++ -o yolo-fastest yolo-fastest.cpp -I include/ncnn/ lib/libncnn.a pkg-config --libs --cflags opencv -fopenmp

  • Usage: ./yolo-fastest: how to use?

If there is no errors while compiling, you should be able to simply run ./yolo-fastest in the dir.

Screenshot from 2020-10-20 14-59-52 After compiling NCNN,run Yolo-fastest?

  1. complie ncnn.
  2. copy NCNN's 'lib' and 'include' (in the dir 'ncnn->build->install' after successfully compiling ncnn ) into the dir 'ncnn_sample'.
  3. run the instruction to compile: g++ -o yolo-fastest yolo-fastest.cpp -I include/ncnn/ lib/libncnn.a `pkg-config --libs --cflags opencv` -fopenmp and if you use OPENCV 4.X, it should be: g++ -o yolo-fastest yolo-fastest.cpp -I include/ncnn/ lib/libncnn.a `pkg-config --libs --cflags opencv4` -fopenmp
  4. run ./yolo-fastest

Hope helpful.

2684160504 commented 3 years ago

Thanks very much!

---Original--- From: "Zhenyu ZHAO"<notifications@github.com> Date: Tue, Oct 20, 2020 15:12 PM To: "dog-qiuqiu/Yolo-Fastest"<Yolo-Fastest@noreply.github.com>; Cc: "Comment"<comment@noreply.github.com>;"2684160504"<2684160504@qq.com>; Subject: Re: [dog-qiuqiu/Yolo-Fastest] About ncnn_sample Compile Guide (#25)

Sincerely suggest that you could add “\” before the “`” in ncnn_sample's README.md, so that it may be easier for new comers to get started.

HI,* g++ -o yolo-fastest yolo-fastest.cpp -I include/ncnn/ lib/libncnn.a pkg-config --libs --cflags opencv -fopenmp

Usage: ./yolo-fastest: how to use?

If there is no errors while compiling, you should be able to simply run ./yolo-fastest in the dir.

After compiling NCNN,run Yolo-fastest?

complie ncnn.

copy NCNN's 'lib' and 'include' (in the dir 'ncnn->build->install' after successfully compiling ncnn ) into the dir 'ncnn_sample'.

run the instruction to compile: g++ -o yolo-fastest yolo-fastest.cpp -I include/ncnn/ lib/libncnn.a pkg-config --libs --cflags opencv -fopenmp and if you use OPENCV 4.X, it should be: g++ -o yolo-fastest yolo-fastest.cpp -I include/ncnn/ lib/libncnn.a pkg-config --libs --cflags opencv4 -fopenmp

run ./yolo-fastest

Hope helpful.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

2684160504 commented 3 years ago

Sincerely suggest that you could add “\” before the “`” in ncnn_sample's README.md, so that it may be easier for new comers to get started.

Hi,how do the other files work in yolofastestmaster?Such as darknet_image.py.I,m looking forward to your reply,thank you.

Hideousmon commented 3 years ago

Sincerely suggest that you could add “\” before the “`” in ncnn_sample's README.md, so that it may be easier for new comers to get started.

Hi,how do the other files work in yolofastestmaster?Such as darknet_image.py.I,m looking forward to your reply,thank you.

I haven't tried to run darknet_image.py. 😂 You can refer to the the usage in yolov3, maybe.

2684160504 commented 3 years ago

Sincerely suggest that you could add “\” before the “`” in ncnn_sample's README.md, so that it may be easier for new comers to get started.

Hi,how do the other files work in yolofastestmaster?Such as darknet_image.py.I,m looking forward to your reply,thank you.

I haven't tried to run darknet_image.py. joy You can refer to the the usage in yolov3, maybe.

Thanks a lot,I will try it.

wwdok commented 3 years ago
  1. complie ncnn.
  2. copy NCNN's 'lib' and 'include' (in the dir 'ncnn->build->install' after successfully compiling ncnn ) into the dir 'ncnn_sample'.
  3. run the instruction to compile: g++ -o yolo-fastest yolo-fastest.cpp -I include/ncnn/ lib/libncnn.a `pkg-config --libs --cflags opencv` -fopenmp and if you use OPENCV 4.X, it should be: g++ -o yolo-fastest yolo-fastest.cpp -I include/ncnn/ lib/libncnn.a `pkg-config --libs --cflags opencv4` -fopenmp
  4. run ./yolo-fastest

Hope helpful.

Hi, @Hideousmon Could you let me see your contents in ncnn\build\install\lib my lib folder seems not include libncnn.a: image

Hideousmon commented 3 years ago

image

It's on Ubunutu 18.04 Mate. I didn't have a try on Windows.

  1. complie ncnn.
  2. copy NCNN's 'lib' and 'include' (in the dir 'ncnn->build->install' after successfully compiling ncnn ) into the dir 'ncnn_sample'.
  3. run the instruction to compile: g++ -o yolo-fastest yolo-fastest.cpp -I include/ncnn/ lib/libncnn.a `pkg-config --libs --cflags opencv` -fopenmp and if you use OPENCV 4.X, it should be: g++ -o yolo-fastest yolo-fastest.cpp -I include/ncnn/ lib/libncnn.a `pkg-config --libs --cflags opencv4` -fopenmp
  4. run ./yolo-fastest

Hope helpful.

Hi, @Hideousmon Could you let me see your contents in ncnn\build\install\lib my lib folder seems not include libncnn.a: image

jiangjiaxiaotianxia commented 3 years ago

anyone who know how to compile this demo in window?

jiangjiaxiaotianxia commented 3 years ago

@2684160504 @Hideousmon

Hideousmon commented 3 years ago

anyone who know how to compile this demo in window?

I did not try that.:sweat: It should be similar to compiling the other C++ programs on Windows but include ncnn's libs since ncnn is supported on Windows.

jiangjiaxiaotianxia commented 3 years ago

my instruction in the ncnn sample dir in cmd: g++ -o yolo-fastest yolo-fastest.cpp -I include/ncnn lib/ncnn.lib 'pkg-config --libs --cflags opencv' -fopenmp mistake: g++: error: 'pkg-config: No such file or directory g++: error: opencv': No such file or directory g++: error: unrecognized command line option '--libs' g++: error: unrecognized command line option '--cflags'

Hideousmon commented 3 years ago

my instruction in the ncnn sample dir in cmd: g++ -o yolo-fastest yolo-fastest.cpp -I include/ncnn lib/ncnn.lib 'pkg-config --libs --cflags opencv' -fopenmp mistake: g++: error: 'pkg-config: No such file or directory g++: error: opencv': No such file or directory g++: error: unrecognized command line option '--libs' g++: error: unrecognized command line option '--cflags'

Try to replace ' with `.:smiley:

jiangjiaxiaotianxia commented 3 years ago

instruction :g++ -o yolo-fastest yolo-fastest.cpp -I include/ncnn lib/ncnn.lib pkg-config --libs --cflags opencv -fopenmp still this mistake: g++: error: pkg-config: No such file or directory g++: error: opencv: No such file or directory g++: error: unrecognized command line option '--libs' g++: error: unrecognized command line option '--cflags'

CW-B-W commented 3 years ago

instruction :g++ -o yolo-fastest yolo-fastest.cpp -I include/ncnn lib/ncnn.lib pkg-config --libs --cflags opencv -fopenmp still this mistake: g++: error: pkg-config: No such file or directory g++: error: opencv: No such file or directory g++: error: unrecognized command line option '--libs' g++: error: unrecognized command line option '--cflags'

I didn't try this on Windows But I think you may try to replace `pkg-config --libs --cflags` with the -L -I options because pkg-config is a Linux command.

For example in OpenCV C++ installation on Windows with MinGW Step 5,

$ g++ -I"C:\opencv\install\include" -L"C:\opencv\install\x64\mingw\lib" -L"C:\opencv\install\x64\mingw\bin"  opencvtry.cpp -lopencv_core420 -lopencv_highgui420 -lopencv_imgproc420 -lopencv_imgcodecs420 -o app

Replace the above path with your opencv installation path.

The -I option tell g++ where to search the opencv header files, the -L option tell g++ where to search the opencv libs.


Or it looks like we could install pkg-config on Windows, How to install pkg config in windows?

Maybe you could try it, I am curious about the results.

Hideousmon commented 3 years ago

instruction :g++ -o yolo-fastest yolo-fastest.cpp -I include/ncnn lib/ncnn.lib pkg-config --libs --cflags opencv -fopenmp still this mistake: g++: error: pkg-config: No such file or directory g++: error: opencv: No such file or directory g++: error: unrecognized command line option '--libs' g++: error: unrecognized command line option '--cflags'

On linux, it should work if ncnn and opencv are well installed. CW-B-W's reply seems quite helpful for compling the demo on Windows.

jiangjiaxiaotianxia commented 3 years ago

@Hideousmon @CW-B-W

my instruction in the ncnn sample dir in cmd:g++ -o yolo-fastest yolo-fastest.cpp -I"D:\Yolo-fastest-github\Yolo-Fastest-master\ncnn_sample\include\ncnn" -L"D:\Yolo-fastest-github\Yolo-Fastest-master\ncnn_sample\lib/ncnn.lib" -L"D:\opencv3.4.1\opencv\build\x64\vc14\lib" -I"D:\opencv3.4.1\opencv\build\include" -fopenmp

I try it and still meet the question on the next:

C:\Users\~1\AppData\Local\Temp\ccNA9Hda.o:yolo-fastest.cpp:(.text+0x141): undefined reference to ncnn::Mat::from_pixels_resize(unsigned char const*, int, int, int, int, int, ncnn::Allocator*)' C:\Users\~1\AppData\Local\Temp\ccNA9Hda.o:yolo-fastest.cpp:(.text+0x1ad): undefined reference toncnn::Mat::substract_mean_normalize(float const, float const)' C:\Users\~1\AppData\Local\Temp\ccNA9Hda.o:yolo-fastest.cpp:(.text+0x1c3): undefined reference to ncnn::Net::create_extractor() const' C:\Users\~1\AppData\Local\Temp\ccNA9Hda.o:yolo-fastest.cpp:(.text+0x1e4): undefined reference toncnn::Extractor::set_num_threads(int)' C:\Users\~1\AppData\Local\Temp\ccNA9Hda.o:yolo-fastest.cpp:(.text+0x205): undefined reference to ncnn::Extractor::input(char const*, ncnn::Mat const&)' C:\Users\~1\AppData\Local\Temp\ccNA9Hda.o:yolo-fastest.cpp:(.text+0x245): undefined reference toncnn::Extractor::extract(char const, ncnn::Mat&, int)' C:\Users\~1\AppData\Local\Temp\ccNA9Hda.o:yolo-fastest.cpp:(.text+0x451): undefined reference to cv::rectangle(cv::_InputOutputArray const&, cv::Point_<int>, cv::Point_<int>, cv::Scalar_<double> const&, int, int, int)' C:\Users\~1\AppData\Local\Temp\ccNA9Hda.o:yolo-fastest.cpp:(.text+0x504): undefined reference tocv::getTextSize(cv::String const&, int, double, int, int)' C:\Users\~1\AppData\Local\Temp\ccNA9Hda.o:yolo-fastest.cpp:(.text+0x5fc): undefined reference to cv::putText(cv::_InputOutputArray const&, cv::String const&, cv::Point_<int>, int, double, cv::Scalar_<double>, int, int, bool)' C:\Users\~1\AppData\Local\Temp\ccNA9Hda.o:yolo-fastest.cpp:(.text+0x665): undefined reference toncnn::Extractor::~Extractor()' C:\Users\~1\AppData\Local\Temp\ccNA9Hda.o:yolo-fastest.cpp:(.text+0x776): undefined reference to ncnn::Extractor::~Extractor()' C:\Users\~1\AppData\Local\Temp\ccNA9Hda.o:yolo-fastest.cpp:(.text+0x882): undefined reference toncnn::Net::Net()' C:\Users\~1\AppData\Local\Temp\ccNA9Hda.o:yolo-fastest.cpp:(.text+0x8a0): undefined reference to ncnn::Net::load_param(char const*)' C:\Users\~1\AppData\Local\Temp\ccNA9Hda.o:yolo-fastest.cpp:(.text+0x8b7): undefined reference toncnn::Net::load_model(char const*)' C:\Users\~1\AppData\Local\Temp\ccNA9Hda.o:yolo-fastest.cpp:(.text+0x8f0): undefined reference to cv::VideoCapture::VideoCapture(int)' C:\Users\~1\AppData\Local\Temp\ccNA9Hda.o:yolo-fastest.cpp:(.text+0x8f8): undefined reference tocv::VideoCapture::operator>>(cv::Mat&)' C:\Users\~1\AppData\Local\Temp\ccNA9Hda.o:yolo-fastest.cpp:(.text+0x91a): undefined reference to ncnn::get_current_time()' C:\Users\~1\AppData\Local\Temp\ccNA9Hda.o:yolo-fastest.cpp:(.text+0x948): undefined reference toncnn::get_current_time()' C:\Users\~1\AppData\Local\Temp\ccNA9Hda.o:yolo-fastest.cpp:(.text+0x9b7): undefined reference to cv::imshow(cv::String const&, cv::_InputArray const&)' C:\Users\~1\AppData\Local\Temp\ccNA9Hda.o:yolo-fastest.cpp:(.text+0x9eb): undefined reference tocv::waitKey(int)' C:\Users\~1\AppData\Local\Temp\ccNA9Hda.o:yolo-fastest.cpp:(.text+0xa50): undefined reference to cv::VideoCapture::~VideoCapture()' C:\Users\~1\AppData\Local\Temp\ccNA9Hda.o:yolo-fastest.cpp:(.text+0xae2): undefined reference toncnn::Net::~Net()' d:/pkg-config-for-g++/windows--build/bin/../lib/gcc/i686-w64-mingw32/4.8.3/../../../../i686-w64-mingw32/bin/ld.exe: C:\Users\~1\AppData\Local\Temp\ccNA9Hda.o: bad reloc address 0x0 in section `.data' d:/pkg-config-for-g++/windows--build/bin/../lib/gcc/i686-w64-mingw32/4.8.3/../../../../i686-w64-mingw32/bin/ld.exe: final link failed: Invalid operation collect2.exe: error: ld returned 1 exit status

instruction :g++ -o yolo-fastest yolo-fastest.cpp -I include/ncnn lib/ncnn.lib pkg-config --libs --cflags opencv -fopenmp still this mistake: g++: error: pkg-config: No such file or directory g++: error: opencv: No such file or directory g++: error: unrecognized command line option '--libs' g++: error: unrecognized command line option '--cflags'

On linux, it should work if ncnn and opencv are well installed. CW-B-W's reply seems quite helpful for compling the demo on Windows.

jiangjiaxiaotianxia commented 3 years ago

I install the pkg-config and window--build,but still questions I decide to give up .Thank you very much for helping me .