digitalbrain79 / darknet-nnpack

Darknet with NNPACK
Other
306 stars 76 forks source link

Segmentation fault #51

Closed Shivankit99 closed 4 years ago

Shivankit99 commented 4 years ago

tiny yolov3 always gives segmentation fault after loading the entire network and loading the weights. Im doing it on a raspberry pi3b+ and doing using the network to detect on 2 classes. using batch=1 and subdivisions=1. Can anyone help ?

angmorpri commented 4 years ago

I was having trouble with Segmentation Fault errors too. I managed to solve it by using another NNPACK repo, https://github.com/shizukachan/NNPACK.

Shivankit99 commented 4 years ago

@angmorpri ive tried that repository. It seems to be a problem with NNPACK. Did you install NNPACK using cmake or confu ?

angmorpri commented 4 years ago

I used the cmake option, with confu I didn't even managed to build it. Precisely, what I do is:

cd NNPACK
mkdir build && cd build
cmake -G Ninja -D BUILD_SHARED_LIBS=ON ..
ninja
sudo ninja install
Shivankit99 commented 4 years ago

My build with Ninja always fails saying : ninja: build stopped: subcommand failed. ive added ninja to the path variables as well. Any ideas on how to work around this ?

angmorpri commented 4 years ago

Maybe it has to do something with this issue in original NNPACK repo. If that does not solve it but the issue is the same (I have not tested it), I was able to fix it previously with the steps here.

Shivankit99 commented 4 years ago

My builds are successful with ninja now. But still the segmentation fault persists. i ran it under gdb:

0xb6f35dd4 in compute_gemm_convolution_inference.isra () from /usr/local/lib/libnnpack.so

1 0x00000000 in ?? ()

Backtrace stopped: previous frame identical to this frame (corrupt stack?) (gdb)

This is what i got .. Any ideas on how to debug this ? any help would be greatly appreciated. Ive tried the solutions in the NNPACK repository as well

Shivankit99 commented 4 years ago

@angmorpri Ive got a raspberry pi 3b+ and a raspberry pi 4b as well. Both give me the exact same issue.

angmorpri commented 4 years ago

May I see which command are you using or what are you trying to run?

Shivankit99 commented 4 years ago

git clone https://github.com/Maratyszcza/NNPACK cd NNPACK mkdir build cd build cmake -G Ninja -DBUILD_SHARED_LIBS=on-DCMAKE_C_FLAGS=-march=armv6k .. ninja sudo ninja install git clone https://github.com/shizukachan/darknet-nnpack.git cd darknet-nnpack make wget https://pjreddie.com/media/files/yolov3-tiny.weights ./darknet detector test cfg/coco.data cfg/yolov3-tiny.cfg yolov3-tiny.weights data/dog.jpg

please let me know if you need additional information

Shivankit99 commented 4 years ago

im able to use the darknet-nnpack repository without NNPACK. But the model is just not fast enough then.

angmorpri commented 4 years ago

Try using this repo for NNPACK instead of Maratyszcza. You can follow the same building steps.

Shivankit99 commented 4 years ago

@angmorpri Thank you so much for the help. it works now. Although predictions are taking longer than what the results are shown in the repository. For eg. the pretrained yolov3-tiny took 2.9 seconds. Any ideas why this is happening ? opencv NNPACK NNPACK_FAST ARM_NEON and OPENMP all are = 1

angmorpri commented 4 years ago

That is something I have not figured out yet. It happens to me too. In fact, I'm surprised it only takes you 2.9 seconds; mine uses literally the same repositories and takes around 4 seconds on average.

Shivankit99 commented 4 years ago

im testing on a raspberry pi 4b maybe thats the difference. Although have you tried with other repositories for darknet-nnpack? Also the results for the pretrained yolo model with 80 classes and a custom trained model with just two classes is the same 2.9 seconds. I was able to get better results on two classes without NNPACK.

Shivankit99 commented 4 years ago

@angmorpri its probably because of the values of height and width in the cfg file. Try reducing it 256. It reduces the time by 1 second but it does reduce the confidence scores as well. Although still cant match the results in the readme files

angmorpri commented 4 years ago

Actually, for my purposes I don't really need to lower the inference time, but thanks for the recommendation! Anyway, as the original problem seems to be solved I think we should close this issue.

Shivankit99 commented 4 years ago

Thanks for the help

aijunitasari commented 6 months ago

cmake -G Ninja -DBUILD_SHARED_LIBS=on-DCMAKE_C_FLAGS=-march=armv6k ..

Hi, i tried to run this command cmake -G Ninja -DBUILD_SHARED_LIBS=on-DCMAKE_C_FLAGS=-march=armv6k .. but the process always stuck at [37/123] Building CXX object CMakeFiles.../test/convolutional-outpu/alexnet.cc.o did you get the same problem? could you tell me how to fix it?