mattn / go-tflite

Go binding for TensorFlow Lite
MIT License
304 stars 44 forks source link

Segmentation violation when trying to use EdgeTPU example #52

Open timorkal opened 11 months ago

timorkal commented 11 months ago

Hi, regular examples work fine for me, but when I try to use the edgeTPU examples I am having this kind of segmentation fault. The tensforflow version which was compiled is 2.15.0 with cmake for arm64. edgetpu shared lib is installed through "apt-get install -y libedgetpu-dev:arm64" Just also want to mention that python examples from the pycoral repo works fine with the tpu, so the shared lib should be fine.

root@1bd8084e7e4b:/go-tflite/_example/label_image_edgetpu# go run main.go
EdgeTPU Version: BuildLabel(COMPILER=6.3.0 20170516,DATE=redacted,TIME=redacted), RuntimeVersion(14)
SIGSEGV: segmentation violation
PC=0xffffa9a807e0 m=0 sigcode=1
signal arrived during cgo execution

goroutine 1 [syscall]:
runtime.cgocall(0x4adfa8, 0x4000042a88)
        /usr/local/go/src/runtime/cgocall.go:157 +0x44 fp=0x4000042a40 sp=0x4000042a00 pc=0x4059f4
github.com/mattn/go-tflite._Cfunc_TfLiteInterpreterCreate(0x1627aaa0, 0x16282c60)
        _cgo_gotypes.go:405 +0x34 fp=0x4000042a80 sp=0x4000042a40 pc=0x49db44
github.com/mattn/go-tflite.NewInterpreter.func1(0x1627c6c0?, 0x16282c60)
        /go-tflite/tflite.go:104 +0x84 fp=0x4000042ad0 sp=0x4000042a80 pc=0x49e984
github.com/mattn/go-tflite.NewInterpreter(0x16282c60?, 0x4faef8?)
        /go-tflite/tflite.go:104 +0x30 fp=0x4000042b00 sp=0x4000042ad0 pc=0x49e8a0
main.main()
        /go-tflite/_example/label_image_edgetpu/main.go:95 +0x594 fp=0x4000042f30 sp=0x4000042b00 pc=0x4ac794
runtime.main()
        /usr/local/go/src/runtime/proc.go:267 +0x2bc fp=0x4000042fd0 sp=0x4000042f30 pc=0x4365dc
runtime.goexit()
        /usr/local/go/src/runtime/asm_arm64.s:1197 +0x4 fp=0x4000042fd0 sp=0x4000042fd0 pc=0x4619a4

goroutine 2 [force gc (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        /usr/local/go/src/runtime/proc.go:398 +0xc8 fp=0x4000032f90 sp=0x4000032f70 pc=0x436a08
runtime.goparkunlock(...)
        /usr/local/go/src/runtime/proc.go:404
runtime.forcegchelper()
        /usr/local/go/src/runtime/proc.go:322 +0xb8 fp=0x4000032fd0 sp=0x4000032f90 pc=0x436898
runtime.goexit()
        /usr/local/go/src/runtime/asm_arm64.s:1197 +0x4 fp=0x4000032fd0 sp=0x4000032fd0 pc=0x4619a4
created by runtime.init.6 in goroutine 1
        /usr/local/go/src/runtime/proc.go:310 +0x24

goroutine 3 [GC sweep wait]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        /usr/local/go/src/runtime/proc.go:398 +0xc8 fp=0x4000033760 sp=0x4000033740 pc=0x436a08
runtime.goparkunlock(...)
        /usr/local/go/src/runtime/proc.go:404
runtime.bgsweep(0x0?)
        /usr/local/go/src/runtime/mgcsweep.go:280 +0xa0 fp=0x40000337b0 sp=0x4000033760 pc=0x4231c0
runtime.gcenable.func1()
        /usr/local/go/src/runtime/mgc.go:200 +0x28 fp=0x40000337d0 sp=0x40000337b0 pc=0x417f68
runtime.goexit()
        /usr/local/go/src/runtime/asm_arm64.s:1197 +0x4 fp=0x40000337d0 sp=0x40000337d0 pc=0x4619a4
created by runtime.gcenable in goroutine 1
        /usr/local/go/src/runtime/mgc.go:200 +0x6c

goroutine 4 [GC scavenge wait]:
runtime.gopark(0x400005a000?, 0x4f9268?, 0x1?, 0x0?, 0x40000031e0?)
        /usr/local/go/src/runtime/proc.go:398 +0xc8 fp=0x4000033f50 sp=0x4000033f30 pc=0x436a08
runtime.goparkunlock(...)
        /usr/local/go/src/runtime/proc.go:404
runtime.(*scavengerState).park(0x59ab80)
        /usr/local/go/src/runtime/mgcscavenge.go:425 +0x5c fp=0x4000033f80 sp=0x4000033f50 pc=0x420a8c
runtime.bgscavenge(0x0?)
        /usr/local/go/src/runtime/mgcscavenge.go:653 +0x44 fp=0x4000033fb0 sp=0x4000033f80 pc=0x420fd4
runtime.gcenable.func2()
        /usr/local/go/src/runtime/mgc.go:201 +0x28 fp=0x4000033fd0 sp=0x4000033fb0 pc=0x417f08
runtime.goexit()
        /usr/local/go/src/runtime/asm_arm64.s:1197 +0x4 fp=0x4000033fd0 sp=0x4000033fd0 pc=0x4619a4
created by runtime.gcenable in goroutine 1
        /usr/local/go/src/runtime/mgc.go:201 +0xac

goroutine 18 [finalizer wait]:
runtime.gopark(0xb?, 0x0?, 0xe8?, 0x25?, 0x47d8ac?)
        /usr/local/go/src/runtime/proc.go:398 +0xc8 fp=0x4000032580 sp=0x4000032560 pc=0x436a08
runtime.runfinq()
        /usr/local/go/src/runtime/mfinal.go:193 +0x108 fp=0x40000327d0 sp=0x4000032580 pc=0x417018
runtime.goexit()
        /usr/local/go/src/runtime/asm_arm64.s:1197 +0x4 fp=0x40000327d0 sp=0x40000327d0 pc=0x4619a4
created by runtime.createfing in goroutine 1
        /usr/local/go/src/runtime/mfinal.go:163 +0x80

r0      0x162960c0
r1      0xffffa9fa6b88
r2      0x162a2e50
r3      0x1627c6c0
r4      0x0
r5      0x33
r6      0x100000008
r7      0x162a2cd0
r8      0xffffa997c0d0
r9      0xffffa9979860
r10     0xffffa99e4b50
r11     0x1
r12     0xffffa9a80ff0
r13     0x376f623
r14     0x7
r15     0xc
r16     0xffffa9641cb8
r17     0xffffa97df614
r18     0x50
r19     0x162a2e50
r20     0x1627c6c0
r21     0x100000008
r22     0x162a2e50
r23     0xffffc9e46e70
r24     0x162960c0
r25     0xffffc9e46f98
r26     0xffffc9e46f74
r27     0xffffc9e46f80
r28     0x59ac20
r29     0xffffc9e46d60
lr      0xffffa9a8103c
sp      0xffffc9e46d50
pc      0xffffa9a807e0
fault   0x100000040
exit status 2
Xaik89 commented 11 months ago

I have a same issue

AmmarMalik93 commented 3 months ago

Any update on this issue?

mattn commented 3 months ago

I don't reproduce this.

AmmarMalik93 commented 3 months ago

The reason for you not being able to reproduce is most likely is that the .tflite models in edgetpu examples are not edgetpu.tflite models but rather they are simple . tflite models. It would be good if the examples can be provided using actual edgetpu.tflite models. Even better if some examples can be provided for some of latest Yolo models like Yolov8.