-
Notifications
You must be signed in to change notification settings - Fork 164
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
Unable to import pydarknet #1
Comments
Hi,
|
@Ntweat, can I know the version of OpenCV you used? I managed to reproduce this issue by compiling with OpenCV 3.4.1 in Ubuntu 16.04. It can be resolved by compiling using Open CV 3.4.0. In fact, it is mentioned here that darknet does not work with OpenCV 3.4.1 due to an issue in Open CV 3.4.1 C API. On a side note, you have to compile Darknet with OpenCV enabled as explained here. I have forgotten to mention this step at the Readme. Does compiling with OpenCV 3.4.0 solve this issue for you? |
I'm getting the exact same error. I'm sure I have opencv 3.4.0 because I get this if I check my version in python:
Or, if I do
Also, if I run darknet test: Also, when using setup.py I get:
Maybe this might be the problem? If so, how can I fix it? I use Linux (Fedora). |
Based on the |
@justinas-kazanavicius Can you do the following and let me know whether it works?
Also, would like to know how you installed Open CV. |
I've just reinstalled OpenCV-3.4.0 in ~/Libs/opencv-3.4.0 Also, I've tried creating symlinks for all .so files in /usr/lib, /usr/lib64
|
@justinas-kazanavicius Did you follow the It seems pkg-config is not updated after the new installation of OpenCV. For example, pkg-config lists a result called |
@madhawav Saw your comment just after fixing it. You're right, I did not. I fixed it by completely uninstalling all opencv packages on my computer. Re-installing OpenCV-3.4.0, using these instructions from this repo. And then running What confused me was the other packages of opencv that I had on my computer. They allowed me to compile darknet sucessfully, and that made me think my opencv-3.4.0 installation was successful. Thanks for the help! |
However... even though it installs, it still doesn't run. I get
I found that other people from a different, older YOLO library had the same problem. |
It looks like your executable cannot resolve your OpenCV libraries. Try adding the path with your opencv install to BTW, you may want to install your libraries in |
@justinas-kazanavicius Did you do a clean build on darknet after re-installing OpenCV ?
Maybe your re-using the old libdarknet.so file which you made with previous installation of OpenCV. It would probably fail to link with new installation of OpenCV. |
@abossenbroek @
@madhawav @madhawav @abossenbroek
Paths seem to be set up well.
Darknet is working fine by itself too. |
run |
@justinas-kazanavicius |
Thanks |
How much slower is this direct conversion compared to the OpenCV method? |
@justinas-kazanavicius Glad to here! I've just managed to re-produce the error Could that be the reason why you couldn't use the code from master branch? Also, I will send you a performance comparison between two branches soon. |
@justinas-kazanavicius Master Branch
direct-numpy-to-darknet-image-conversion Branch
Internal time measurement at pydarknet.pyx internal_start = time.time()
network_predict_image(self.net, image.img)
dets = get_network_boxes(self.net, image.img.w, image.img.h, thresh, hier_thresh, <int*>0, 0, pnum)
num = pnum[0]
if (nms > 0):
do_nms_obj(dets, num, self.meta.classes, nms)
internal_end = time.time()
self.average_internal_time = self.average_internal_time * 0.8 + (internal_end-internal_start) * 0.2
print("Internal Time:",internal_end-internal_start, ":", self.average_internal_time) Total time measurement at webcam_test.py start_time = time.time()
# Only measure the time taken by YOLO and API Call overhead
dark_frame = Image(frame)
results = net.detect(dark_frame)
del dark_frame
end_time = time.time()
average_time = average_time * 0.8 + (end_time-start_time) * 0.2
print("Total Time:", end_time-start_time, ":", average_time)
print("Efficiency:", net._get_average_time()/average_time) |
Found the issue! Previously before compiling darknet, I executed So, that empty gcc argument was probably my empty I've added Thanks for all your help @madhawav and @abossenbroek ! |
Glad to help @justinas-kazanavicius. Happy coding! |
hi i am getting ImportError: /home/step/YOLO3P/pydarknet.cpython-35m-x86_64-linux-gnu.so: undefined symbol: _ZN2cv8fastFreeEPv |
Hi I am getting following error
`>>> import pydarknet
Traceback (most recent call last):
File "", line 1, in
ImportError: /home/ntweat/Desktop/yolo/PyYOLOV3/pydarknet.cpython-35m-x86_64-linux-gnu.so: undefined symbol: _ZN2cv8fastFreeEPv
Thanks for the wrapper
The text was updated successfully, but these errors were encountered: