LdDl / go-darknet

Go bindings for Darknet (YOLO v4 / v7-tiny / v3)
Apache License 2.0
82 stars 19 forks source link

Segmentation Violation #8

Closed sam-cts closed 4 years ago

sam-cts commented 4 years ago

I went into segmentation violation while running detection.

then I located it happened in following line:

network_predict_ptr(n, sized.data); in line 17, network.c

I simply switch it to network_predict_image(n, sized); and it works fine

here's the segmentation error that I got before the change

`fatal error: unexpected signal during runtime execution [signal SIGSEGV: segmentation violation code=0x2 addr=0x7f87d443c000 pc=0x7f8a45518d8f]

runtime stack: runtime.throw(0x53d64e, 0x2a) /usr/local/go/src/runtime/panic.go:1116 +0x72 runtime.sigpanic() /usr/local/go/src/runtime/signal_unix.go:679 +0x46a

goroutine 1 [syscall]: runtime.cgocall(0x4f04f0, 0xc00006dbc0, 0xc00007a028) /usr/local/go/src/runtime/cgocall.go:133 +0x5b fp=0xc00006db90 sp=0xc00006db58 pc=0x405b3b github.com/LdDl/go-darknet._Cfunc_perform_network_detect(0x116e1f0, 0xc00007a028, 0x3e80000000000001, 0x3ee666663f000000, 0x0, 0x0, 0x0) _cgo_gotypes.go:869 +0x4d fp=0xc00006dbc0 sp=0xc00006db90 pc=0x4cd2dd github.com/LdDl/go-darknet.(YOLONetwork).Detect.func1(0xc00006de78, 0xc00007a000, 0x0, 0x0) /home/idx/go/src/github.com/LdDl/go-darknet/network.go:72 +0x117 fp=0xc00006dc30 sp=0xc00006dbc0 pc=0x4cf5b7 github.com/LdDl/go-darknet.(YOLONetwork).Detect(0xc00006de78, 0xc00007a000, 0xc00007a000, 0x0, 0x0) /home/idx/go/src/github.com/LdDl/go-darknet/network.go:72 +0x8e fp=0xc00006dd40 sp=0xc00006dc30 pc=0x4cec1e main.main() /home/idx/go/src/github.com/LdDl/go-darknet/example/main.go:66 +0x339 fp=0xc00006df88 sp=0xc00006dd40 pc=0x4ef9a9 runtime.main() /usr/local/go/src/runtime/proc.go:203 +0x1fa fp=0xc00006dfe0 sp=0xc00006df88 pc=0x4353ea runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc00006dfe8 sp=0xc00006dfe0 pc=0x45fb71 exit status 2`

LdDl commented 4 years ago

Hello Thanks for the issue. Can your provide hash of used version of AlexeyAB's darknet?

Latest tested by me: 08bc0c9373158da6c42f11b1359ca2c017cef1b5

sam-cts commented 4 years ago

Currently I am using: 9dc897d2c77d5ef43a6b237b717437375765b527

LdDl commented 4 years ago

Currently I am using: 9dc897d2c77d5ef43a6b237b717437375765b527

Seems like breaking changes for us. I'm getting this one

Calloc error - possibly out of CPU RAM 

I'll make update soon.

LdDl commented 4 years ago

Can you check current version of go-darknet for your environment now? I haven't used _network_predictimage because of internal resizing image (which have done already before object detection), but used _networkpredict (which accepts *net instead &net)