-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
issue with darknet-nnpack python library #17
Comments
I made python module for darknet-nnpack. |
@digitalbrain79, thanks for the response. I tried the pyyolo, here are my findings: 1. GPU=0 CUDNN=0: 38s/imageI changed GPU=0 CUDNN=0 in Makefile, since I am on a Raspberry PI 3 without GPU The test result is 38s/image.
2. NNPACK=1 and ARM_NEON=1: 16s/imageI added the NNPACK and ARM_NEON logic from darknet-nnpack/Makefile to pyyolo/Makfile, as shown below:
Rebuilt pyyolo with the updated Makefile, reran the test, the test result is 16s/image
Any advice on how could I achieve the 1.3s/image as darknet-nnpack? |
I'm also very curious about how to use the CDLL functionality of the original libdarknet.so but with added NNPACK optimization. One option that seems reasonable is to use the latest upstream darknet commit and update it with NNPACK calls. I also a tried adding in LDFLAGS to the Makefile for darknet-nnpack so that the library libdarknet.so would be built, but I get the following failure when running make: I will poke around a little with the error. Your suggestion about a static link makes since considering the error I'm seeing: https://stackoverflow.com/questions/13812185/how-to-recompile-with-fpic My current Makefile is:
Beyond that, please update if you figure out how to get fast (1 frame/sec) detection through a python interface (pyyolo) or are able to get the library to build with nnpack. ============== Update: adding the -fPIC flag to cflags within the NNPACK-darknet build.ninja options worked. Now when running the Makefile for darknet-nnpack, I get a shared library libdarknet.so that allows loading within Python. Detection times are around 600-900 ms. Let me know if you'd like more details. |
@tahouse I got the same result with you, python could load libdarknet.so, but could not detect any object from the images. Here are what I did:
I also tried to make the compiling flags be the same for NNPACK-darknet and darknet-nnpack, but it did not help. @digitalbrain79 Could you shed us some light on the directions? Thank you. |
Hi, everyone |
I haven't been very lucky with running the python library. So I opted for a quick workaround by modifying the source to include a TCP server (In C) which I can talk to using Python: https://github.com/amwfarid/DarkNet-NNPack-Python-Library Mind you this is really meant as a workaround, not a full replacement until things are resolved. |
您好!请问我运行 digitalbrain79 的pyyolo为何会报错?我也是在raspberry pi3b上面运行的,一编译python文件夹里面的darknet.py就报错,更不用说make了,是要改什么地方才能编译通过吗? |
如果自己改darknet with nnpack的代码,用python封装它然后运行可以吗? |
@BogiHsu It still doesn't work,the problem is still "undefined symbol: nnp_convolution_inference",how do you make it run successfully? |
Any solution for this? |
Pull request #27 resolve "undefined symbol: nnp_convolution_inference" error. You only need to have libnnpack.a and libpthreadpool.a in your LD_LIBRARY_PATH environment variable. Alternatively you can modify Makefile to link statically to libdarknet.so |
Hi,@hastou, i tried to find libnnpack.a as below:
which means this two
and do souce
but error exists.Can you show some detail about how to do it? |
Just an FYI: After trying everything here exhaustively (on a new RPi) I gave up and went with OpenCV 4 Beta’s yolo implementation which works like a charm in Py3. Yolo3-Lite averages about 1.4s/image and Yolo3 full averages around 14s/image (when complied with processor optimizations...which takes about 16 hours if you do it on device). I would have liked to use Darknet+NNPACK but I doubt it would get that much faster on a smaller device. |
@shartoo if you have "undefined symbol error" try to clone the last version of the repository and follow the README tutorial. It should work. |
I did the following
I did this with the latest code from this project with raspi 3b+ .
|
Seems a big bug problem then.. |
Any updates on this? |
How slove the problem?Thanks. |
HI,
I am trying to run detection on multiple images (currently static images, will be image snapshots from a video in the future) on my Raspberry PI 3, the CLI works great and I get the same result 1.3s/image as claimed, but because the CLI needs to load the network and metadata every time, it slows down the detection, so I wrote the following python script to automate the images detection without needing to load the network and metadata every time:
I put the python script under darknet-nnpack directory, and update the darknet-nnpack/python/darknet.py with the following line:
The python script runs correctly with the upstream darknet(https://github.com/pjreddie/darknet), but as expected, it runs terribly slow(40s+/image) and does not work for my scenario.
The python script could not be run with the darknet-nnpack, with the following error:
I feel that some compile options will be needed to static link the nnpack library into libdarknet.so, or some environment variable to point to the NNPACK-darknet, but I was not able to figure it out.
Any suggestion on how I could move forward will be highly appreciated.
The text was updated successfully, but these errors were encountered: