Skip to content
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

How to setup? #1

Open
yacaeh opened this issue Dec 29, 2017 · 17 comments
Open

How to setup? #1

yacaeh opened this issue Dec 29, 2017 · 17 comments

Comments

@yacaeh
Copy link

yacaeh commented Dec 29, 2017

Thanks for the great work!
I was also looking for the openpose + darknet version, But I have some problem with setup this project. And also, is it possible to work with not just images but with video and webcam as well?

First I had error with C++11 but adding QMAKE_CXXFLAGS += -std=c++11 solved the problem. Also Tuple error with main.cpp so I included tuple by #include <tuple>
Also had to undefined reference to symbol '_ZN2cv6imreadERKNS_6StringEi error so added
LIBS += -lopencv_imgcodecs

Finally all compiled and when I used
./openpose-darknet person.jpg openpose.cfg openpose.weight
get the following error
./openpose-darknet: error while loading shared libraries: libdarknet.so: cannot open shared object file: No such file or directory
I already have llibdarknet.so file in my darknet folder and darknet folder is already included in the openpose-darknet.pro.

@lincolnhard
Copy link
Owner

Hi @yacaeh
I add darknet library path to LD_LIBRARY_PATH.

vi ~/.bashrc #put the following at the bottom
export LD_LIBRARY_PATH=path_to_your_darknet_folder"${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

source ~/.bashrc

@yacaeh
Copy link
Author

yacaeh commented Dec 29, 2017

Thanks for the quick reply!
I've successfully run but have error with opencv now :(

Loading weights from openpose.weight...Done!
forward fee: 696.37ms
OpenCV Error: Assertion failed (ssize.width > 0 && ssize.height > 0) in resize, file /root/opencv-3.2.0/modules/imgproc/src/imgwarp.cpp, line 3492
terminate called after throwing an instance of 'cv::Exception'
what(): /root/opencv-3.2.0/modules/imgproc/src/imgwarp.cpp:3492: error: (-215) ssize.width > 0 && ssize.height > 0 in function resize

@lincolnhard
Copy link
Owner

Hi @yacaeh
Looks like something wrong in netout size (Line 560 in main.cpp)

  1. Have you change the net width and height in openpose.cfg? You could check if the final net output size is larger than zero.
  2. Are you running darknet in GPU mode? I encounter some problem when reading last layer member (net->layers[net->n - 1]), you may want to check line 19 & 20 in run_darknet.c.
  3. I think working on video or webcam should be fine, sorry for the bugs, I need to fix them someday.

@yacaeh
Copy link
Author

yacaeh commented Jan 4, 2018

Happy new year :)
Yeah I think there is problem with the resizing with outw and outh, I've forced to change the size in run_darknet.c and it shows images, but it couldn't detect anything.

  1. I didn't change anything on openpose.cfg, I've tried with different sizes like 400, 100, 50 but didn't work. In main.cpp net_outh,net_outw shows 0, and netout shows nothing nmsin shows only zeros
    Also I noticed in main.cpp resizing net output back to get heatmap, Mat nmsin shows only zeros, is it normal?

  2. Yes I'm running in GPU mode, is it only work with none-GPU mode(It didn't work when I tried without cuda and it showed error)? I've tried changing it to n-1 but still got the same error when change n-1,2,3 showed 0 for the size of outw,outh but showed 256, 972095488 respectively when changed to n-0.

@yacaeh
Copy link
Author

yacaeh commented Jan 9, 2018

I tried with cudnn enabled for my darknet and it works perfect now! 👍

@lincolnhard
Copy link
Owner

@yacaeh nice to know you can run it correctly now, and thank you to reveal those problems.

@Seongmun-Hong
Copy link

@yacaeh
Can I ask you one question?

OpenCV Error: Assertion failed (ssize.width> 0 && ssize.height> 0) in resize, file /root/opencv-3.2.0/modules/imgproc/src/imgwarp.cpp, line 3492
terminate called after an instance of 'cv :: Exception'
what: (): /root/opencv-3.2.0/modules/imgproc/src/imgwarp.cpp:3492: error: (-215) ssize.width> 0 && ssize.height> 0 in function resize

How did you solve this problem? Can you give me a solution? I will wait for you.

@yacaeh
Copy link
Author

yacaeh commented May 18, 2018

@hongsungmoon Hi Sungmoon, As I commented before it should running in GPU mode. Make sure you enable your cudnn as well from your darknet Makefile :)

@Seongmun-Hong
Copy link

Seongmun-Hong commented May 18, 2018

@yacaeh Thank you very much for your quick reply. I installed cuda and compiled darknet to use opencv, cudnn. Could you tell me which version of cuda you are using and cudnn version? And what do you mean you have to take the path of cudnn?

Additionally, the value of net_outh does not change from 0.

@yacaeh
Copy link
Author

yacaeh commented May 18, 2018

@hongsungmoon It's cuda 8.0 cudnn 5.1, if you take a look at Makefile of darknet there is setting for enabling cudnn.
GPU=1 CUDNN=1 OPENCV=1 OPENMP=0 DEBUG=0
And build your darknet with 'make' again. Or if you are using docker check if you are running your docker with nvidia-docker.

About net_outh I'm not sure but it would work after you enable it.
But it should work after not showing any errors.

FYI I've changed openpose.cfg [net] to the following.
[net]
width=608
height=608
channels=3
It was optimal net for me.

@Seongmun-Hong
Copy link

Seongmun-Hong commented May 18, 2018

@yacaeh It matches exactly my environment ... I have not found the cause yet, but the width and height of the output are zero. Thank you. Your answer helped me a lot. I will tell you if I find the exact problem.

@shreyasrajesh
Copy link

@hongsungmoon I am facing a very similar issue. I am getting the exact same error. Did you manage to find a solution ?

@Seongmun-Hong
Copy link

Seongmun-Hong commented Jun 8, 2018

@shreyasrajesh In my case, there was a change in the structure padding as the darknet model moved from c to c ++. Therefore, the size of the structure changed and the model could not be loaded. I think you need to check the size of the structure as well.

@anguoyang
Copy link

@hongsungmoon I have the same problem, the out_w/h will be zero after loading the weights file, but actually it is 25 I can see from the command line after loading the config file.
it is really strange that when I disable the cudnnn, then it is fine, but, the forward fee is about 800ms(1080 ti).
I use windows/darknet.

@Seongmun-Hong
Copy link

Seongmun-Hong commented Jun 8, 2018

@anguoyang I think darknet is not installed as a GPU version. You should first install cuda and cudnn and opencv. Then, before building darknet, you need to modify the makefile to cudnn = 1, opencv = 1, and gpu = 1.

@adujardin
Copy link

I had the same issue. You need to take an older version of darknet, at this commit 80d9bec20f0a44ab07616215c6eadb2d633492fe. It seems there were some breaking changes after that.

@aakendi
Copy link

aakendi commented Dec 18, 2018

I had issue:
Loading weights from openpose.weight...Done!
forward fee: 179.921ms
Segmentation fault (core dumped)
Would you like to give me a solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants