floe / backscrub

Virtual Video Device for Background Replacement with Deep Semantic Segmentation
Apache License 2.0
735 stars 86 forks source link

Error when running deepseg #26

Closed AwesomeKenP closed 3 years ago

AwesomeKenP commented 4 years ago

Complied successfully after setting TFBASE=../tensorflow but following error greets me when starting it:

`./deepseg -d -c /dev/video0 -v /dev/video1

deepseg v0.1.0 (c) 2020 by floe@butterbrot.org https://github.com/floe/deepseg debug: 1 ccam: /dev/video0 vcam: /dev/video1 width: 640 height: 480 back: background.png threads:2 deepseg: loopback.cc:57: int loopback_init(const char*, int, int, int): Assertion `ret_code != -1' failed.

Aborted `

floe commented 4 years ago

Did you load the v4l2loopback module first (see https://github.com/floe/deepbacksub#usage )?

floe commented 4 years ago

Or maybe you have more than one physical video device, in that case, the virtual cam device might get a higher number?

kpoman commented 3 years ago

Same problem here, trying different devices. My computer has right now builtin webcam and extra usb webcam (logitech c922). Logitech is video1 and supports 960x720. I try running the app like and get this:

kpoman@kpoman-T460s:~/Downloads/deepbacksub/deepbacksub-master$ ./deepseg -d -c /dev/video1 -v /dev/video5 -w 960 -h 720
deepseg v0.1.0
(c) 2020 by floe@butterbrot.org
https://github.com/floe/deepseg
debug:  1
ccam:   /dev/video1
vcam:   /dev/video5
width:  960
height: 720
back:   background.png
threads:2
deepseg: loopback.cc:37: int loopback_init(const char*, int, int, int): Assertion `fdwr >= 0' failed.
Aborted (core dumped)
(base) kpoman@kpoman-T460s:~/Downloads/deepbacksub/deepbacksub-master$

v4l2loopback is loaded


base) kpoman@kpoman-T460s:~/Downloads/deepbacksub/deepbacksub-master$ lsmod | grep v4l
v4l2loopback           40960  0
videobuf2_v4l2         24576  1 uvcvideo
videobuf2_common       49152  2 videobuf2_v4l2,uvcvideo
videodev              225280  4 videobuf2_v4l2,v4l2loopback,uvcvideo,videobuf2_common
mc                     53248  5 videodev,snd_usb_audio,videobuf2_v4l2,uvcvideo,videobuf2_common
(base) kpoman@kpoman-T460s:~/Downloads/deepbacksub/deepbacksub-master$ 
floe commented 3 years ago

Mmh. If it already errors out at fwdr >= 0, then it can't even open the loopback device, so I would assume some sort of permission or devicename issue here?

kpoman commented 3 years ago

Hi floe, I tried now without setting the width and it fails on line 57:

(base) kpoman@kpoman-T460s:~/Downloads/deepbacksub/deepbacksub-master$ ./deepseg -d -c /dev/video1 -v /dev/video2
deepseg v0.1.0
(c) 2020 by floe@butterbrot.org
https://github.com/floe/deepseg
debug:  1
ccam:   /dev/video1
vcam:   /dev/video2
width:  640
height: 480
back:   background.png
threads:2
deepseg: loopback.cc:57: int loopback_init(const char*, int, int, int): Assertion `ret_code != -1' failed.
Aborted (core dumped)
(base) kpoman@kpoman-T460s:~/Downloads/deepbacksub/deepbacksub-master$ 

Is there a simple way to dump the query caps picked here ret_code = ioctl(fdwr, VIDIOC_QUERYCAP, &vid_caps); ? Maybe that would help in debugging.

floe commented 3 years ago

Try to comment out line 57, then it should print the format and IIRC you should be able to see which part of the video format caused the error.

kpoman commented 3 years ago

Ok, I now got this:

(base) kpoman@kpoman-T460s:~/Downloads/deepbacksub/deepbacksub-master$ ./deepseg -d -c /dev/video1 -v /dev/video2
deepseg v0.1.0
(c) 2020 by floe@butterbrot.org
https://github.com/floe/deepseg
debug:  1
ccam:   /dev/video1
vcam:   /dev/video2
width:  640
height: 480
back:   background.png
threads:2
    vid_format->type                = 2
    vid_format->fmt.pix.width       = 640
    vid_format->fmt.pix.height      = 480
    vid_format->fmt.pix.pixelformat = 1448695129
    vid_format->fmt.pix.sizeimage   = 614400
    vid_format->fmt.pix.field       = 1
    vid_format->fmt.pix.bytesperline= 1280
    vid_format->fmt.pix.colorspace  = 8
Error at deepseg.cc:164
(base) kpoman@kpoman-T460s:~/Downloads/deepbacksub/deepbacksub-master$ 

this was on my video1 (c922) cam, trying it on my video0, I got a fake device working:

(base) kpoman@kpoman-T460s:~/Downloads/deepbacksub/deepbacksub-master$ ./deepseg -d -c /dev/video0 -v /dev/video4
deepseg v0.1.0
(c) 2020 by floe@butterbrot.org
https://github.com/floe/deepseg
debug:  1
ccam:   /dev/video0
vcam:   /dev/video4
width:  640
height: 480
back:   background.png
threads:2
    vid_format->type                = 2
    vid_format->fmt.pix.width       = 640
    vid_format->fmt.pix.height      = 480
    vid_format->fmt.pix.pixelformat = 1448695129
    vid_format->fmt.pix.sizeimage   = 614400
    vid_format->fmt.pix.field       = 1
    vid_format->fmt.pix.bytesperline= 1280
    vid_format->fmt.pix.colorspace  = 8
tensor #183: 1
tensor #183: 257
tensor #183: 257
tensor #183: 3
tensor #168: 1
tensor #168: 257
tensor #168: 257
tensor #168: 21
FPS:  9.54

and using Cheese app, I can see the removal working ! Any clues if there is something to tweak for video1 ?

floe commented 3 years ago

What does v4l2-ctl --list-formats-ext -d /dev/video1 show?

floe commented 3 years ago

Any news here?

floe commented 3 years ago

Improved error messages being merged in #36.