pjreddie / darknet

Convolutional Neural Networks
http://pjreddie.com/darknet/
Other
25.7k stars 21.33k forks source link

YOLO:segmentation fault on RaspberryPi #823

Open jinyu121 opened 6 years ago

jinyu121 commented 6 years ago

I cloned the darknet, and make it on my Pi, without ANY modification. No OpenCV.

But darknet fails both in detect and classifier.

I run darknet with ./darknet detect cfg/yolov3-tiny.cfg yolov3-tiny.weights data/kite.jpg

I traced some of the code, add printf("Check get_yolo_detections in FOR FOR %d %d / %d %d %d\n\n", n, j, l.classes, n*l.w*l.h + i, 4 + 1 + j); brfore https://github.com/pjreddie/darknet/blob/f6d861736038da22c9eb0739dca84003c5a5e275/src/yolo_layer.c#L334

And the output is

...
Check get_yolo_detections in FOR FOR 0 76 / 80 0 81
Check get_yolo_detections in FOR FOR 0 77 / 80 0 82
Check get_yolo_detections in FOR FOR 0 78 / 80 0 83
Check get_yolo_detections in FOR FOR 0 79 / 80 0 84
Check get_yolo_detections in FOR 1 
Check get_yolo_detections in FOR FOR 1 0 / 80 169 5
[1]    8781 segmentation fault  ./darknet detect cfg/yolov3-tiny.cfg

But on my PC, same code, same weights, and same command, it is OK. If I modify the code as above, the output is

...
Check get_yolo_detections in FOR FOR 0 76 / 80 498 81
Check get_yolo_detections in FOR FOR 0 77 / 80 498 82
Check get_yolo_detections in FOR FOR 0 78 / 80 498 83
Check get_yolo_detections in FOR FOR 0 79 / 80 498 84
Check get_yolo_detections in FOR FOR 1 0 / 80 1174 5
Check get_yolo_detections in FOR FOR 1 1 / 80 1174 6
Check get_yolo_detections in FOR FOR 1 2 / 80 1174 7
Check get_yolo_detections in FOR FOR 1 3 / 80 1174 8
...

I think that it is an Array out of bounds error here.


BTW: My PC is 64-bit Debian, and Pi is 32-bit offcial RASPBIAN with desktop, which can be download HERE

ysh329 commented 6 years ago

mark

ysh329 commented 6 years ago

Is this problem about big endian or little endian for model saving?

jinyu121 commented 6 years ago

@ysh329 Well, Google told me that it is little endian.


PS: You can use THIS VERSION.

ysh329 commented 6 years ago

@jinyu121 Thanks jinyu 👍

GordonDongZHAO commented 6 years ago

@jinyu121 I meet the same problem today. Can AlexeyAB's version solve this problem? I see the get_yolo_detections function is almost the same. Do you know the reason of this error? @pjreddie

jinyu121 commented 6 years ago

@GordonDongZHAO

Yes, AlexyAB's version is OK, even on RaspberryPi, while pjreddie's version crash in both detection and classification functions.

kesaroid commented 5 years ago

You can try reducing the memory split of GPU for the rapsberry-pi. Allocating 64mb worked for me

sedentaryOne commented 5 years ago

I had this problem as well in my pi 3b+ Moving to AlexeyAB/darknet not only worked but it's ridiculously fast. I mean, for a pi.