digitalbrain79 / darknet-nnpack

Darknet with NNPACK
Other
306 stars 76 forks source link

Build Issue on Rasp 4 #54

Open ivanh23 opened 4 years ago

ivanh23 commented 4 years ago

Hello , i am getting the following error :

pi@raspberrypi:~/NNPACK-darknet $ $NINJA_PATH/ninja [1/72] CC deps/pthreadpool/src/pthreads.c FAILED: /home/pi/NNPACK-darknet/build/deps/pthreadpool/src/pthreads.c.o gcc -o /home/pi/NNPACK-darknet/build/deps/pthreadpool/src/pthreads.c.o -c /home/pi/NNPACK-darknet/deps/pthreadpool/src/pthreads.c -MMD -MF /home/pi/NNPACK-darknet/build/deps/pthreadpool/src/pthreads.c.o.d -std=gnu11 -g -pthread -O2 -I/home/pi/NNPACK-darknet/deps/pthreadpool/include -I/home/pi/NNPACK-darknet/deps/pthreadpool/src -I/home/pi/NNPACK-darknet/deps/fxdiv/include In file included from /home/pi/NNPACK-darknet/deps/pthreadpool/src/pthreads.c:50: /home/pi/NNPACK-darknet/deps/pthreadpool/include/pthreadpool.h:727:2: warning: ‘pthreadpool_function_1d_t’ is deprecated [-Wdeprecated-declarations] pthreadpool_function_1d_t function, ^~~~~~~~~ /home/pi/NNPACK-darknet/deps/pthreadpool/include/pthreadpool.h:733:2: warning: ‘pthreadpool_function_1d_tiled_t’ is deprecated [-Wdeprecated-declarations] pthreadpool_function_1d_tiled_t function, ^~~~~~~ /home/pi/NNPACK-darknet/deps/pthreadpool/include/pthreadpool.h:740:2: warning: ‘pthreadpool_function_2d_t’ is deprecated [-Wdeprecated-declarations] pthreadpool_function_2d_t function, ^~~~~~~~~ /home/pi/NNPACK-darknet/deps/pthreadpool/include/pthreadpool.h:747:2: warning: ‘pthreadpool_function_2d_tiled_t’ is deprecated [-Wdeprecated-declarations] pthreadpool_function_2d_tiled_t function, ^~~~~~~ /home/pi/NNPACK-darknet/deps/pthreadpool/include/pthreadpool.h:756:2: warning: ‘pthreadpool_function_3d_tiled_t’ is deprecated [-Wdeprecated-declarations] pthreadpool_function_3d_tiled_t function, ^~~~~~~ /home/pi/NNPACK-darknet/deps/pthreadpool/include/pthreadpool.h:767:2: warning: ‘pthreadpool_function_4d_tiled_t’ is deprecated [-Wdeprecated-declarations] pthreadpool_function_4d_tiled_t function, ^~~~~~~ /tmp/ccht4UVM.s: Assembler messages: /tmp/ccht4UVM.s:86: Error: selected processor does not support yield' in ARM mode /tmp/ccht4UVM.s:420: Error: selected processor does not supportyield' in ARM mode [6/72] CXX test/fully-connected-inference/overfeat-fast.cc ninja: build stopped: subcommand failed.

Jaswar commented 4 years ago

Hello, I am facing a similar issue. I also found out that if you retry this command, you can continue, but it will crash at some point completely, so that you will no longer be able to enter this command. Does someone know a possible solution to this?

HaroldSP commented 4 years ago

@Jaswar @ivanh23 This helped in my case https://github.com/Maratyszcza/NNPACK/issues/189#issuecomment-627540950

But the thing is that I've faced the following issues https://github.com/digitalbrain79/darknet-nnpack/issues/53#issuecomment-629628245

So if you will reach some positive results, it would be very nice of you if you would post your solutions, thanks.

ivanh23 commented 4 years ago

@Jaswar @HaroldSp Okey , thank you for the comment , i will try this on Monday , and i will let you guys know

Shivankit99 commented 4 years ago

Hey @ivanh23, Those statements are to install the dependencies and update the environment variables. sudo ninja install or sudo make install whichever one you're building NNPACK with does that work. Those commands were used earlier when NNPACK was built with confu. I personally havent been able to build NNPACK with confu. But it works perfectly with cmake.

Jaswar commented 4 years ago

Hi @ivanh23 @HaroldSP I have omitted the problem by simply downloading the disk image from this GitHub page. No installation is required and everything works right.

Shivankit99 commented 4 years ago

@Jaswar what inference time did you get with the tiny yolov3 model? Im getting 2.9 seconds with opencv nnpack enabled.

Jaswar commented 4 years ago

@Shivankit99 I get around 6FPS (or at least that's what the code says, for me this looks like 2FPS). I have set OPENCV=1 and NNPACK=1. Also I am using Raspberry Pi 4B. Now I have another problem, which is that when using ./darknet detector demo I get no results with the camera (testing on images only works though).

HaroldSP commented 4 years ago

@Jaswar @ivanh23 @Shivankit99 Gentlemen, here's the small wiki that I've written.

Hi @ivanh23 @HaroldSP I have omitted the problem by simply downloading the disk image from this GitHub page. No installation is required and everything works right.

I saw that option, but it was around 4 GB as far as I remember, and that was way too much for me in order just to add some new stuff to my Pi.

@Shivankit99 I get around 6FPS (or at least that's what the code says, for me this looks like 2FPS). I have set OPENCV=1 and NNPACK=1. Also I am using Raspberry Pi 4B. Now I have another problem, which is that when using ./darknet detector demo I get no results with the camera (testing on images only works though).

I get 0.5 FPS on Pi 4 when I run that command and that is making me quite upset. You can check my wiki, there I've found some possible solutions for your case.

By the way, does anyone has a nice code for real-time detection from pi cam?

Jaswar commented 4 years ago

@HaroldSP Thank you for the wiki, it does not solve my problem though. Are you sure that you have changed NNPACK=0 to NNPACK=1 before make? Maybe that's the reason why your solution is slower.

HaroldSP commented 4 years ago

@Jaswar

Yep, my full list is that one:

GPU=0
CUDNN=0
OPENCV=1
NNPACK=1
NNPACK_FAST=1
ARM_NEON=1
OPENMP=0
DEBUG=0
QPU_GEMM=0

What is yours? This is how much time does it take to predict a photo:

data/dog.jpg: Predicted in 2.881168 seconds.
dog: 57%
car: 52%

And did you try that?

sudo apt-get update && sudo apt-get upgrade
sudo rpi-update
#reboot

Also you can rise up GPU memory to 256 Mb

Jaswar commented 4 years ago

@HaroldSP These are the first lines of my Makefile: GPU=0 CUDNN=0 CUDNN_HALF=0 OPENCV=1 AVX=0 OPENMP=0 LIBSO=0 ZED_CAMERA=0 NNPACK=1

I was still unable to solve my issue with the camera, I will try and open a new issue with that.

aidamanzano commented 4 years ago

Hi @Shivankit99 could you please let me know how you managed to get it to work on the Raspberry Pi 4 with cmake? Im using a RPi 4b, Raspberry Pi recommended OS 32 bit, should I use a different OS?

Shivankit99 commented 4 years ago

i used the raspbian buster OS. the cmake installation method can be found in the NNPACK repository. Although i would recommend you try using the OS image given in the read me file of this repository. you'll need to burn the OS to your sd card and boot with that. It involves no installation.

aidamanzano commented 4 years ago

Hi thank you for your reply! I actually finally managed to build the original NNPACK repo by Maratyszcza, and now I would like to try it with Darknet since I have trained a custom tiny-yolov3 and want to upload it on my Raspberry Pi 4. I saw your reply to this issue https://github.com/digitalbrain79/darknet-nnpack/issues/57 which is why I decided to install the original NNPACK, could I ask what steps you did to install darknet after that? Or if you actually still installed darknet-nnpack and built it with Cmake? Apologies if its a silly question im a complete beginner and a bit lost.

Shivankit99 commented 4 years ago

After installing NNPACK. you can install darknet with a simple make command. cd darknet-nnpack make

That should do the job for you

panban-ux commented 3 years ago

The only thing I gathered so far, I tested multiple methods and repositories is that I always stuck at the end. In the make command for darknet-nnpack. While it builds it I have an exit error 1 in the end. Previous steps are completed successfully. I have a 4B with 4gb ram in 20.10 desktop. Had similar results with x64 server edition. What's going wrong? gcc -Iinclude/ -Isrc/ -DNNPACK -DNNPACK_FAST -Wall -Wno-unknown-pragmas -Wfatal-errors -fPIC -march=native -Ofast -DNNPACK -DNNPACK_FAST obj/captcha.o obj/lsd.o obj/super.o obj/art.o obj/tag.o obj/cifar.o obj/go.o obj/rnn.o obj/segmenter.o obj/regressor.o obj/classifier.o obj/coco.o obj/yolo.o obj/detector.o obj/nightmare.o obj/darknet.o libdarknet.a -o darknet -lm -pthread -lnnpack -lpthreadpool libdarknet.a /usr/bin/ld: cannot find -lnnpack /usr/bin/ld: cannot find -lpthreadpool collect2: error: ld returned 1 exit status make: *** [Makefile:105: darknet] Error 1

YaKalmar0 commented 3 years ago

The only thing I gathered so far, I tested multiple methods and repositories is that I always stuck at the end. In the make command for darknet-nnpack. While it builds it I have an exit error 1 in the end. Previous steps are completed successfully. I have a 4B with 4gb ram in 20.10 desktop. Had similar results with x64 server edition. What's going wrong? gcc -Iinclude/ -Isrc/ -DNNPACK -DNNPACK_FAST -Wall -Wno-unknown-pragmas -Wfatal-errors -fPIC -march=native -Ofast -DNNPACK -DNNPACK_FAST obj/captcha.o obj/lsd.o obj/super.o obj/art.o obj/tag.o obj/cifar.o obj/go.o obj/rnn.o obj/segmenter.o obj/regressor.o obj/classifier.o obj/coco.o obj/yolo.o obj/detector.o obj/nightmare.o obj/darknet.o libdarknet.a -o darknet -lm -pthread -lnnpack -lpthreadpool libdarknet.a /usr/bin/ld: cannot find -lnnpack /usr/bin/ld: cannot find -lpthreadpool collect2: error: ld returned 1 exit status make: *** [Makefile:105: darknet] Error 1

The same here. Please, keep in touch if you find a solution!

panban-ux commented 3 years ago

The only thing I gathered so far, I tested multiple methods and repositories is that I always stuck at the end. In the make command for darknet-nnpack. While it builds it I have an exit error 1 in the end. Previous steps are completed successfully. I have a 4B with 4gb ram in 20.10 desktop. Had similar results with x64 server edition. What's going wrong? gcc -Iinclude/ -Isrc/ -DNNPACK -DNNPACK_FAST -Wall -Wno-unknown-pragmas -Wfatal-errors -fPIC -march=native -Ofast -DNNPACK -DNNPACK_FAST obj/captcha.o obj/lsd.o obj/super.o obj/art.o obj/tag.o obj/cifar.o obj/go.o obj/rnn.o obj/segmenter.o obj/regressor.o obj/classifier.o obj/coco.o obj/yolo.o obj/detector.o obj/nightmare.o obj/darknet.o libdarknet.a -o darknet -lm -pthread -lnnpack -lpthreadpool libdarknet.a /usr/bin/ld: cannot find -lnnpack /usr/bin/ld: cannot find -lpthreadpool collect2: error: ld returned 1 exit status make: *** [Makefile:105: darknet] Error 1

The same here. Please, keep in touch if you find a solution!

Unfortunately i switched back to raspian and i made a success. But you can try it in ubuntu and tell me if it works. First delete all nnpack-darknet-ninja folders and try this approach: https://github.com/HaroldSP/Harold/wiki/4.-Installing-darknet-nnpack-to-run-YOLOv3-on-Raspberry-pi-4 While here continue until step 2 an cd NNPACK then from there go to: https://github.com/digitalbrain79/darknet-nnpack/issues/53#issuecomment-627878333 apply the solution and after ninja install switch back to the HaroldSp clone and make. It will succeed

YaKalmar0 commented 3 years ago

@panban-ux thank you a lot, it helped me with pthread library. Now I'm stuck with this:

/usr/bin/ld: cannot find -lopencv_contrib
/usr/bin/ld: cannot find -lopencv_legacy
/usr/bin/ld: cannot find -l-lnnpack

Btw, I am building on Raspberry OS. Any help would be appreciated.

panban-ux commented 3 years ago

Thats the flag opencv=1 inside your make file? make it zero. Do you need opencv ?

YaKalmar0 commented 3 years ago

@panban-ux oh, I just was following your guide and that point was default there. Now after setting OpenCV to 0 I get:

/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/8/../../../libnnpack.a(init.c.o): in function `cpuinfo_has_arm_neon_fp16':
init.c:(.text+0x18): undefined reference to `cpuinfo_isa'
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/8/../../../libnnpack.a(init.c.o): in function `init_hwinfo':
init.c:(.text+0x304): undefined reference to `cpuinfo_isa'
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/8/../../../libnnpack.a(init.c.o): in function `nnp_initialize':
init.c:(.text+0x330): undefined reference to `cpuinfo_initialize'
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/8/../../../libnnpack.a(init.c.o): in function `nnp_deinitialize':
init.c:(.text+0x374): undefined reference to `cpuinfo_deinitialize'

Any ideas?

YaKalmar0 commented 3 years ago

The only thing I gathered so far, I tested multiple methods and repositories is that I always stuck at the end. In the make command for darknet-nnpack. While it builds it I have an exit error 1 in the end. Previous steps are completed successfully. I have a 4B with 4gb ram in 20.10 desktop. Had similar results with x64 server edition. What's going wrong? gcc -Iinclude/ -Isrc/ -DNNPACK -DNNPACK_FAST -Wall -Wno-unknown-pragmas -Wfatal-errors -fPIC -march=native -Ofast -DNNPACK -DNNPACK_FAST obj/captcha.o obj/lsd.o obj/super.o obj/art.o obj/tag.o obj/cifar.o obj/go.o obj/rnn.o obj/segmenter.o obj/regressor.o obj/classifier.o obj/coco.o obj/yolo.o obj/detector.o obj/nightmare.o obj/darknet.o libdarknet.a -o darknet -lm -pthread -lnnpack -lpthreadpool libdarknet.a /usr/bin/ld: cannot find -lnnpack /usr/bin/ld: cannot find -lpthreadpool collect2: error: ld returned 1 exit status make: *** [Makefile:105: darknet] Error 1

The same here. Please, keep in touch if you find a solution!

Unfortunately i switched back to raspian and i made a success. But you can try it in ubuntu and tell me if it works. First delete all nnpack-darknet-ninja folders and try this approach: https://github.com/HaroldSP/Harold/wiki/4.-Installing-darknet-nnpack-to-run-YOLOv3-on-Raspberry-pi-4 While here continue until step 2 an cd NNPACK then from there go to: #53 (comment) apply the solution and after ninja install switch back to the HaroldSp clone and make. It will succeed

Sorry, maybe I missed something here. Am I supposed to install NNPACK as it is in #53 and then switch back to HaroldSp clone to the step of downloading and building darknet-nnpack?

panban-ux commented 3 years ago

yes steps from the beginning are you install peachpy confu ninja bla bla, install NNPACK cd nnpack then you go to comment #53 and continue from there. In the end switch back to instructions No1 and git clone https://github.com/shizukachan/darknet-nnpack.git cd darknet-nnpack make.

soumyanaveen commented 3 years ago

Settings: NNPACK=1, ARM_NEON=1. At the end while running the "make " , I'm getting the error message "/usr/bin/ld: cannot find -lnnpack, collect2: erro :ld returned 1 exit status, make[1]: ***[Makefile:102: darknet] Error 1. Please help me to resolve the issue. image

Shivankit99 commented 3 years ago

@soumyanaveen could you give all the commands you've used from the start ?

zubaidah93 commented 3 years ago

@soumyanaveen did u solve it? i have the same issue