fangfufu / Linux-Fake-Background-Webcam

Faking your webcam background under GNU/Linux, now supports background blurring, animated background, colour map effect, hologram effect and on-demand processing.
GNU General Public License v3.0
1.61k stars 161 forks source link

docker: Cannot connect to host bodypix:9000 ssl:default [No address associated with hostname] #32

Closed JC1738 closed 4 years ago

JC1738 commented 4 years ago

Thank you for putting this together, been looking for a solution for background on Ubuntu using video camera.

I setup the docker-compse.yml as directed in the DOCKER.md. When running docker-compose up -d I get the camera to show it's starting (blue light indicating camera in use) but looking at docker-compose logs I see the following. Is there additional changes needed?

Thank you, Jim

`fakecam_1  | Traceback (most recent call last):
fakecam_1  |   File "fake.py", line 151, in get_frame
fakecam_1  |     mask = await self._get_mask(frame, session)
fakecam_1  |   File "fake.py", line 65, in _get_mask
fakecam_1  |     async with session.post(
fakecam_1  |   File "/usr/local/lib/python3.8/dist-packages/aiohttp/client.py", line 1012, in __aenter__
fakecam_1  |     self._resp = await self._coro
fakecam_1  |   File "/usr/local/lib/python3.8/dist-packages/aiohttp/client.py", line 480, in _request
fakecam_1  |     conn = await self._connector.connect(
fakecam_1  |   File "/usr/local/lib/python3.8/dist-packages/aiohttp/connector.py", line 523, in connect
fakecam_1  |     proto = await self._create_connection(req, traces, timeout)
fakecam_1  |   File "/usr/local/lib/python3.8/dist-packages/aiohttp/connector.py", line 858, in _create_connection
fakecam_1  |     _, proto = await self._create_direct_connection(
fakecam_1  |   File "/usr/local/lib/python3.8/dist-packages/aiohttp/connector.py", line 971, in _create_direct_connection
fakecam_1  |     raise ClientConnectorError(req.connection_key, exc) from exc
fakecam_1  | aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host bodypix:9000 ssl:default [No address associated with hostname]
fakecam_1  | Mask request failed, retrying: Cannot connect to host bodypix:9000 ssl:default [No address associated with hostname]
fakecam_1  | Traceback (most recent call last):
fakecam_1  |   File "/usr/local/lib/python3.8/dist-packages/aiohttp/connector.py", line 964, in _create_direct_connection
fakecam_1  |     hosts = await asyncio.shield(self._resolve_host(
fakecam_1  |   File "/usr/local/lib/python3.8/dist-packages/aiohttp/connector.py", line 829, in _resolve_host
fakecam_1  |     addrs = await \
fakecam_1  |   File "/usr/local/lib/python3.8/dist-packages/aiohttp/resolver.py", line 29, in resolve
fakecam_1  |     infos = await self._loop.getaddrinfo(
fakecam_1  |   File "/usr/lib/python3.8/asyncio/base_events.py", line 825, in getaddrinfo
fakecam_1  |     return await self.run_in_executor(
fakecam_1  |   File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
fakecam_1  |     result = self.fn(*self.args, **self.kwargs)
fakecam_1  |   File "/usr/lib/python3.8/socket.py", line 918, in getaddrinfo
fakecam_1  |     for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
fakecam_1  | socket.gaierror: [Errno -5] No address associated with hostname
fakecam_1  | 
fakecam_1  | The above exception was the direct cause of the following exception:
fakecam_1  | 
fakecam_1  | Traceback (most recent call last):
fakecam_1  |   File "fake.py", line 151, in get_frame
fakecam_1  |     mask = await self._get_mask(frame, session)
fakecam_1  |   File "fake.py", line 65, in _get_mask
fakecam_1  |     async with session.post(
fakecam_1  |   File "/usr/local/lib/python3.8/dist-packages/aiohttp/client.py", line 1012, in __aenter__
fakecam_1  |     self._resp = await self._coro
fakecam_1  |   File "/usr/local/lib/python3.8/dist-packages/aiohttp/client.py", line 480, in _request
fakecam_1  |     conn = await self._connector.connect(
fakecam_1  |   File "/usr/local/lib/python3.8/dist-packages/aiohttp/connector.py", line 523, in connect
fakecam_1  |     proto = await self._create_connection(req, traces, timeout)
fakecam_1  |   File "/usr/local/lib/python3.8/dist-packages/aiohttp/connector.py", line 858, in _create_connection
fakecam_1  |     _, proto = await self._create_direct_connection(
fakecam_1  |   File "/usr/local/lib/python3.8/dist-packages/aiohttp/connector.py", line 971, in _create_direct_connection
fakecam_1  |     raise ClientConnectorError(req.connection_key, exc) from exc
fakecam_1  | aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host bodypix:9000 ssl:default [No address associated with hostname]
JC1738 commented 4 years ago

Trying to run directly get the following when running node app.js bodypix git:master ❯ node app.js ✹ [1] 13278 illegal hardware instruction (core dumped) node app.js

fangfufu commented 4 years ago

Could you try and add network_mode: host?

It was undone in commit https://github.com/fangfufu/Linux-Fake-Background-Webcam/commit/964d0a1baa4bda6d5416ba34b04c623dd38c42d8, because someone didn't like the scripts to occupy the host's port.

JC1738 commented 4 years ago

Thanks @fangfufu

I tried

docker-compose.yml

version: '3'
services:
    bodypix:
        image: bodypix
        build:
            context: ./bodypix
        network_mode: host
        read_only: true
    fakecam:
        image: fakecam
        build:
            context: ./fakecam
        network_mode: host
        read_only: true
        volumes:
            - /home/jc/Pictures/simpson.jpeg:/src/background.jpg:ro
        #   - /path/to/foreground.jpg:/src/foreground.jpg:ro
        #   - /path/to/foreground-mask.png:/src/foreground-mask.png:ro
        devices:
            # input (webcam)
            - /dev/video0:/dev/video0
            # output (virtual webcam)
            - /dev/video2:/dev/video2
        depends_on:
            - bodypix
        entrypoint: [ 'python3', '-u', 'fake.py', '-b', 'http://bodypix:9000/']

Error in docker-compose logs

fakecam_1  | Traceback (most recent call last):
fakecam_1  |   File "fake.py", line 151, in get_frame
fakecam_1  |     mask = await self._get_mask(frame, session)
fakecam_1  |   File "fake.py", line 65, in _get_mask
fakecam_1  |     async with session.post(
fakecam_1  |   File "/usr/local/lib/python3.8/dist-packages/aiohttp/client.py", line 1012, in __aenter__
fakecam_1  |     self._resp = await self._coro
fakecam_1  |   File "/usr/local/lib/python3.8/dist-packages/aiohttp/client.py", line 480, in _request
fakecam_1  |     conn = await self._connector.connect(
fakecam_1  |   File "/usr/local/lib/python3.8/dist-packages/aiohttp/connector.py", line 523, in connect
fakecam_1  |     proto = await self._create_connection(req, traces, timeout)
fakecam_1  |   File "/usr/local/lib/python3.8/dist-packages/aiohttp/connector.py", line 858, in _create_connection
fakecam_1  |     _, proto = await self._create_direct_connection(
fakecam_1  |   File "/usr/local/lib/python3.8/dist-packages/aiohttp/connector.py", line 971, in _create_direct_connection
fakecam_1  |     raise ClientConnectorError(req.connection_key, exc) from exc
fakecam_1  | aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host bodypix:9000 ssl:default [No address associated with hostname]
fangfufu commented 4 years ago

You need to change your entry point to entrypoint: [ 'python3', '-u', 'fake.py', '-b', 'http://127.0.0.1:9000/'].

Btw, can you indent your code blocks properly using two pairs of ```, please? I edited your comments, but you keep changing them back to the malformed version.

JC1738 commented 4 years ago

Sorry, was wondering why it kept saying things changed :)

Yes, I had tried that in the past when I first saw the error in the logs:

fakecam_1  |     return await self._loop.create_connection(*args, **kwargs)  # type: ignore  # noqa
fakecam_1  |   File "/usr/lib/python3.8/asyncio/base_events.py", line 1025, in create_connection
fakecam_1  |     raise exceptions[0]
fakecam_1  |   File "/usr/lib/python3.8/asyncio/base_events.py", line 1010, in create_connection
fakecam_1  |     sock = await self._connect_sock(
fakecam_1  |   File "/usr/lib/python3.8/asyncio/base_events.py", line 924, in _connect_sock
fakecam_1  |     await self.sock_connect(sock, address)
fakecam_1  |   File "/usr/lib/python3.8/asyncio/selector_events.py", line 494, in sock_connect
fakecam_1  |     return await fut
fakecam_1  |   File "/usr/lib/python3.8/asyncio/selector_events.py", line 526, in _sock_connect_cb
fakecam_1  |     raise OSError(err, f'Connect call failed {address}')
fakecam_1  | ConnectionRefusedError: [Errno 111] Connect call failed ('127.0.0.1', 9000)
fakecam_1  |
fakecam_1  | The above exception was the direct cause of the following exception:
fakecam_1  |
fakecam_1  | Traceback (most recent call last):
fakecam_1  |   File "fake.py", line 151, in get_frame
fakecam_1  |     mask = await self._get_mask(frame, session)
fakecam_1  |   File "fake.py", line 65, in _get_mask
fakecam_1  |     async with session.post(
fakecam_1  |   File "/usr/local/lib/python3.8/dist-packages/aiohttp/client.py", line 1012, in __aenter__
fakecam_1  |     self._resp = await self._coro
fakecam_1  |   File "/usr/local/lib/python3.8/dist-packages/aiohttp/client.py", line 480, in _request
fakecam_1  |     conn = await self._connector.connect(
fakecam_1  |   File "/usr/local/lib/python3.8/dist-packages/aiohttp/connector.py", line 523, in connect
fakecam_1  |     proto = await self._create_connection(req, traces, timeout)
fakecam_1  |   File "/usr/local/lib/python3.8/dist-packages/aiohttp/connector.py", line 858, in _create_connection
fakecam_1  |     _, proto = await self._create_direct_connection(
fakecam_1  |   File "/usr/local/lib/python3.8/dist-packages/aiohttp/connector.py", line 1004, in _create_direct_connection
fakecam_1  |     raise last_exc
fakecam_1  |   File "/usr/local/lib/python3.8/dist-packages/aiohttp/connector.py", line 980, in _create_direct_connection
fakecam_1  |     transp, proto = await self._wrap_create_connection(
fakecam_1  |   File "/usr/local/lib/python3.8/dist-packages/aiohttp/connector.py", line 943, in _wrap_create_connection
fakecam_1  |     raise client_error(req.connection_key, exc) from exc
fakecam_1  | aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 127.0.0.1:9000 ssl:default [Connect call failed ('127.0.0.1', 9000)]
fangfufu commented 4 years ago

Are you running anything on your port 9000?

JC1738 commented 4 years ago

No, thought of that too, there is nothing running on this box as a service. No firewall is active either. I added privileged: true as well and that didn't help.

fangfufu commented 4 years ago

Okay, I guess let's try and run it without using Docker? What's in your kernel log when node.js gave the illegal instruction error? Have you tried a different version of Node? Which distro are you running?

JC1738 commented 4 years ago

popOS (Ubuntu 20.04) node --version v10.19.0 Sure, where would I get the core dump logs?

fangfufu commented 4 years ago

I was thinking of dmesg -w.

fangfufu commented 4 years ago

Can you upgrade your node to v12.17.0?

JC1738 commented 4 years ago

Sure, I will look to update node, here is the last log entries from dmesg -w

[ 3192.734735] Modules linked in: xt_nat xt_tcpudp veth xt_conntrack xt_MASQUERADE nf_conntrack_netlink nfnetlink xfrm_user xfrm_algo xt_addrtype iptable_filter iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 bpfilter br_netfilter bridge stp llc aufs nvidia_uvm(OE) overlay crypto_simd cryptd glue_helper snd_hda_codec_hdmi nvidia_drm(POE) intel_powerclamp nvidia_modeset(POE) coretemp snd_hda_codec_realtek snd_hda_codec_generic ledtrig_audio kvm_intel dcdbas snd_hda_intel snd_intel_dspcfg kvm snd_hda_codec snd_usb_audio uvcvideo snd_hda_core dell_smm_hwmon snd_usbmidi_lib nvidia(POE) intel_cstate snd_seq_midi videobuf2_vmalloc snd_hwdep snd_seq_midi_event videobuf2_memops snd_rawmidi snd_pcm videobuf2_v4l2 videobuf2_common snd_seq joydev snd_seq_device input_leds serio_raw snd_timer drm_kms_helper snd ipmi_devintf ioatdma soundcore ipmi_msghandler fb_sys_fops i7core_edac syscopyarea sysfillrect dca sysimgblt i5500_temp mac_hid sch_fq_codel v4l2loopback(OE) videodev mc parport_pc
[ 3192.734764]  ppdev lp parport drm ip_tables x_tables autofs4 dm_crypt raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid1 raid0 multipath linear system76_io(OE) wmi system76_acpi(OE) hid_microsoft ff_memless hid_generic usbhid hid gpio_ich firewire_ohci psmouse firewire_core crc_itu_t ahci lpc_ich r8169 i2c_i801 libahci realtek
[ 3192.734780] CPU: 4 PID: 22085 Comm: chrome Tainted: P        W IOE     5.4.0-7629-generic #33~1589834512~20.04~ff6e79e-Ubuntu
[ 3192.734781] Hardware name: Dell Inc. Studio XPS 9100/05DN3X, BIOS A02 05/26/2010
[ 3192.734787] RIP: 0010:v4l_querycap+0x8f/0xa0 [videodev]
[ 3192.734789] Code: 00 00 80 48 b9 00 00 20 00 00 00 20 00 48 0b 4b 54 21 d6 39 f2 75 13 48 89 4b 54 5b 41 5c 41 5d 41 5e 41 5f 5d c3 0f 0b eb d0 <0f> 0b 48 89 4b 54 5b 41 5c 41 5d 41 5e 41 5f 5d c3 66 66 66 66 90
[ 3192.734790] RSP: 0018:ffffaf0302acbc70 EFLAGS: 00010202
[ 3192.734792] RAX: 0000000000000000 RBX: ffffaf0302acbd88 RCX: 8520800285208002
[ 3192.734793] RDX: 0000000085008003 RSI: 0000000085008002 RDI: 0000000000000000
[ 3192.734794] RBP: ffffaf0302acbc98 R08: 0000000000000000 R09: 0000000000ffff0a
[ 3192.734795] R10: 0000000000000000 R11: 0000000000000000 R12: ffff89425b090000
[ 3192.734796] R13: ffff8942125fde00 R14: ffff894185d10dc0 R15: ffffffffc06f8380
[ 3192.734798] FS:  00007f9ee6ec2d80(0000) GS:ffff894267700000(0000) knlGS:0000000000000000
[ 3192.734799] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 3192.734800] CR2: 00003d01adb6c000 CR3: 00000005b5792000 CR4: 00000000000006e0
[ 3192.734801] Call Trace:
[ 3192.734808]  __video_do_ioctl+0x1a7/0x410 [videodev]
[ 3192.734815]  video_usercopy+0x2b5/0x670 [videodev]
[ 3192.734822]  ? v4l_s_fmt+0x670/0x670 [videodev]
[ 3192.734829]  video_ioctl2+0x15/0x20 [videodev]
[ 3192.734835]  v4l2_ioctl+0x4c/0x60 [videodev]
[ 3192.734837]  do_vfs_ioctl+0x407/0x670
[ 3192.734839]  ? putname+0x4a/0x50
[ 3192.734841]  ksys_ioctl+0x67/0x90
[ 3192.734843]  __x64_sys_ioctl+0x1a/0x20
[ 3192.734845]  do_syscall_64+0x57/0x190
[ 3192.734847]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 3192.734849] RIP: 0033:0x7f9ee812337b
[ 3192.734850] Code: 0f 1e fa 48 8b 05 15 3b 0d 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d e5 3a 0d 00 f7 d8 64 89 01 48
[ 3192.734851] RSP: 002b:00007fff66dfcd08 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[ 3192.734853] RAX: ffffffffffffffda RBX: 0000000000000017 RCX: 00007f9ee812337b
[ 3192.734854] RDX: 00007fff66dfcd90 RSI: ffffffff80685600 RDI: 0000000000000017
[ 3192.734855] RBP: 00007fff66dfce70 R08: 0000000000000000 R09: 00003d01adb5cd00
[ 3192.734856] R10: 0000000000000000 R11: 0000000000000246 R12: 00003d01adb56e00
[ 3192.734857] R13: 00003d01adb5cd50 R14: 00007fff66dfcd30 R15: 00003d01adb36090
[ 3192.734859] ---[ end trace 895e207bbc51adfd ]---
[ 3192.766019] ------------[ cut here ]------------
[ 3192.766033] WARNING: CPU: 5 PID: 22085 at drivers/media/v4l2-core/v4l2-ioctl.c:1064 v4l_querycap+0x8b/0xa0 [videodev]
[ 3192.766034] Modules linked in: xt_nat xt_tcpudp veth xt_conntrack xt_MASQUERADE nf_conntrack_netlink nfnetlink xfrm_user xfrm_algo xt_addrtype iptable_filter iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 bpfilter br_netfilter bridge stp llc aufs nvidia_uvm(OE) overlay crypto_simd cryptd glue_helper snd_hda_codec_hdmi nvidia_drm(POE) intel_powerclamp nvidia_modeset(POE) coretemp snd_hda_codec_realtek snd_hda_codec_generic ledtrig_audio kvm_intel dcdbas snd_hda_intel snd_intel_dspcfg kvm snd_hda_codec snd_usb_audio uvcvideo snd_hda_core dell_smm_hwmon snd_usbmidi_lib nvidia(POE) intel_cstate snd_seq_midi videobuf2_vmalloc snd_hwdep snd_seq_midi_event videobuf2_memops snd_rawmidi snd_pcm videobuf2_v4l2 videobuf2_common snd_seq joydev snd_seq_device input_leds serio_raw snd_timer drm_kms_helper snd ipmi_devintf ioatdma soundcore ipmi_msghandler fb_sys_fops i7core_edac syscopyarea sysfillrect dca sysimgblt i5500_temp mac_hid sch_fq_codel v4l2loopback(OE) videodev mc parport_pc
[ 3192.766066]  ppdev lp parport drm ip_tables x_tables autofs4 dm_crypt raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid1 raid0 multipath linear system76_io(OE) wmi system76_acpi(OE) hid_microsoft ff_memless hid_generic usbhid hid gpio_ich firewire_ohci psmouse firewire_core crc_itu_t ahci lpc_ich r8169 i2c_i801 libahci realtek
[ 3192.766087] CPU: 5 PID: 22085 Comm: chrome Tainted: P        W IOE     5.4.0-7629-generic #33~1589834512~20.04~ff6e79e-Ubuntu
[ 3192.766088] Hardware name: Dell Inc. Studio XPS 9100/05DN3X, BIOS A02 05/26/2010
[ 3192.766096] RIP: 0010:v4l_querycap+0x8b/0xa0 [videodev]
[ 3192.766098] Code: 54 81 ca 00 00 00 80 48 b9 00 00 20 00 00 00 20 00 48 0b 4b 54 21 d6 39 f2 75 13 48 89 4b 54 5b 41 5c 41 5d 41 5e 41 5f 5d c3 <0f> 0b eb d0 0f 0b 48 89 4b 54 5b 41 5c 41 5d 41 5e 41 5f 5d c3 66
[ 3192.766099] RSP: 0018:ffffaf0302acbc70 EFLAGS: 00010297
[ 3192.766101] RAX: 0000000000000000 RBX: ffffaf0302acbd88 RCX: 0000000000000001
[ 3192.766102] RDX: 0000000085008003 RSI: 0000000000000000 RDI: 0000000000000000
[ 3192.766103] RBP: ffffaf0302acbc98 R08: 0000000000000000 R09: 0000000000ffff0a
[ 3192.766104] R10: 0000000000000000 R11: 0000000000000000 R12: ffff89425b090000
[ 3192.766105] R13: ffff8941ce848e00 R14: ffff893fd84e26e0 R15: ffffffffc06f8380
[ 3192.766107] FS:  00007f9ee6ec2d80(0000) GS:ffff894267740000(0000) knlGS:0000000000000000
[ 3192.766108] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 3192.766109] CR2: 00003d01adb7a000 CR3: 00000005b5792000 CR4: 00000000000006e0
[ 3192.766110] Call Trace:
[ 3192.766118]  __video_do_ioctl+0x1a7/0x410 [videodev]
[ 3192.766125]  video_usercopy+0x2b5/0x670 [videodev]
[ 3192.766129]  ? v4l_s_fmt+0x670/0x670 [videodev]
[ 3192.766134]  video_ioctl2+0x15/0x20 [videodev]
[ 3192.766139]  v4l2_ioctl+0x4c/0x60 [videodev]
[ 3192.766142]  do_vfs_ioctl+0x407/0x670
[ 3192.766145]  ? putname+0x4a/0x50
[ 3192.766147]  ksys_ioctl+0x67/0x90
[ 3192.766149]  __x64_sys_ioctl+0x1a/0x20
[ 3192.766152]  do_syscall_64+0x57/0x190
[ 3192.766155]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 3192.766157] RIP: 0033:0x7f9ee812337b
[ 3192.766159] Code: 0f 1e fa 48 8b 05 15 3b 0d 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d e5 3a 0d 00 f7 d8 64 89 01 48
[ 3192.766160] RSP: 002b:00007fff66dfcd08 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[ 3192.766161] RAX: ffffffffffffffda RBX: 0000000000000018 RCX: 00007f9ee812337b
[ 3192.766162] RDX: 00007fff66dfcd90 RSI: ffffffff80685600 RDI: 0000000000000018
[ 3192.766164] RBP: 00007fff66dfce70 R08: 0000000000000000 R09: 00003d01adb5cbe0
[ 3192.766164] R10: 0000000000000000 R11: 0000000000000246 R12: 00003d01adb397a0
[ 3192.766165] R13: 00003d01adb5c4b0 R14: 00007fff66dfcd30 R15: 00003d01adb36090
[ 3192.766167] ---[ end trace 895e207bbc51adfe ]---
[ 3192.766181] ------------[ cut here ]------------
[ 3192.766189] WARNING: CPU: 5 PID: 22085 at drivers/media/v4l2-core/v4l2-ioctl.c:1069 v4l_querycap+0x8f/0xa0 [videodev]
[ 3192.766189] Modules linked in: xt_nat xt_tcpudp veth xt_conntrack xt_MASQUERADE nf_conntrack_netlink nfnetlink xfrm_user xfrm_algo xt_addrtype iptable_filter iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 bpfilter br_netfilter bridge stp llc aufs nvidia_uvm(OE) overlay crypto_simd cryptd glue_helper snd_hda_codec_hdmi nvidia_drm(POE) intel_powerclamp nvidia_modeset(POE) coretemp snd_hda_codec_realtek snd_hda_codec_generic ledtrig_audio kvm_intel dcdbas snd_hda_intel snd_intel_dspcfg kvm snd_hda_codec snd_usb_audio uvcvideo snd_hda_core dell_smm_hwmon snd_usbmidi_lib nvidia(POE) intel_cstate snd_seq_midi videobuf2_vmalloc snd_hwdep snd_seq_midi_event videobuf2_memops snd_rawmidi snd_pcm videobuf2_v4l2 videobuf2_common snd_seq joydev snd_seq_device input_leds serio_raw snd_timer drm_kms_helper snd ipmi_devintf ioatdma soundcore ipmi_msghandler fb_sys_fops i7core_edac syscopyarea sysfillrect dca sysimgblt i5500_temp mac_hid sch_fq_codel v4l2loopback(OE) videodev mc parport_pc
[ 3192.766214]  ppdev lp parport drm ip_tables x_tables autofs4 dm_crypt raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid1 raid0 multipath linear system76_io(OE) wmi system76_acpi(OE) hid_microsoft ff_memless hid_generic usbhid hid gpio_ich firewire_ohci psmouse firewire_core crc_itu_t ahci lpc_ich r8169 i2c_i801 libahci realtek
[ 3192.766230] CPU: 5 PID: 22085 Comm: chrome Tainted: P        W IOE     5.4.0-7629-generic #33~1589834512~20.04~ff6e79e-Ubuntu
[ 3192.766231] Hardware name: Dell Inc. Studio XPS 9100/05DN3X, BIOS A02 05/26/2010
[ 3192.766237] RIP: 0010:v4l_querycap+0x8f/0xa0 [videodev]
[ 3192.766239] Code: 00 00 80 48 b9 00 00 20 00 00 00 20 00 48 0b 4b 54 21 d6 39 f2 75 13 48 89 4b 54 5b 41 5c 41 5d 41 5e 41 5f 5d c3 0f 0b eb d0 <0f> 0b 48 89 4b 54 5b 41 5c 41 5d 41 5e 41 5f 5d c3 66 66 66 66 90
[ 3192.766239] RSP: 0018:ffffaf0302acbc70 EFLAGS: 00010202
[ 3192.766240] RAX: 0000000000000000 RBX: ffffaf0302acbd88 RCX: 8520800285208002
[ 3192.766241] RDX: 0000000085008003 RSI: 0000000085008002 RDI: 0000000000000000
[ 3192.766242] RBP: ffffaf0302acbc98 R08: 0000000000000000 R09: 0000000000ffff0a
[ 3192.766242] R10: 0000000000000000 R11: 0000000000000000 R12: ffff89425b090000
[ 3192.766243] R13: ffff8941ce848e00 R14: ffff893fd84e26e0 R15: ffffffffc06f8380
[ 3192.766244] FS:  00007f9ee6ec2d80(0000) GS:ffff894267740000(0000) knlGS:0000000000000000
[ 3192.766245] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 3192.766246] CR2: 00003d01adb7a000 CR3: 00000005b5792000 CR4: 00000000000006e0
[ 3192.766246] Call Trace:
[ 3192.766252]  __video_do_ioctl+0x1a7/0x410 [videodev]
[ 3192.766259]  video_usercopy+0x2b5/0x670 [videodev]
[ 3192.766266]  ? v4l_s_fmt+0x670/0x670 [videodev]
[ 3192.766275]  video_ioctl2+0x15/0x20 [videodev]
[ 3192.766281]  v4l2_ioctl+0x4c/0x60 [videodev]
[ 3192.766282]  do_vfs_ioctl+0x407/0x670
[ 3192.766284]  ? putname+0x4a/0x50
[ 3192.766286]  ksys_ioctl+0x67/0x90
[ 3192.766288]  __x64_sys_ioctl+0x1a/0x20
[ 3192.766290]  do_syscall_64+0x57/0x190
[ 3192.766292]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 3192.766293] RIP: 0033:0x7f9ee812337b
[ 3192.766295] Code: 0f 1e fa 48 8b 05 15 3b 0d 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d e5 3a 0d 00 f7 d8 64 89 01 48
[ 3192.766296] RSP: 002b:00007fff66dfcd08 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[ 3192.766298] RAX: ffffffffffffffda RBX: 0000000000000018 RCX: 00007f9ee812337b
[ 3192.766299] RDX: 00007fff66dfcd90 RSI: ffffffff80685600 RDI: 0000000000000018
[ 3192.766299] RBP: 00007fff66dfce70 R08: 0000000000000000 R09: 00003d01adb5cbe0
[ 3192.766301] R10: 0000000000000000 R11: 0000000000000246 R12: 00003d01adb397a0
[ 3192.766301] R13: 00003d01adb5c4b0 R14: 00007fff66dfcd30 R15: 00003d01adb36090
[ 3192.766303] ---[ end trace 895e207bbc51adff ]---
[ 3820.106011] traps: node[25440] trap invalid opcode ip:7f8e39980da9 sp:7ffc0512e3a0 error:0 in libtensorflow_framework.so.1.15.0[7f8e3923c000+1945000]
fangfufu commented 4 years ago

I can't really tell what's going on, somethings' wrong with Node's binary. Just try a different version of Node for now. Also there might be some problem with your Docker installation.

JC1738 commented 4 years ago

It's a brand new install of docker (I just installed a fresh install of 20.04 this past week). I can try and check to see if other containers run better, but it's pretty straight forward installation.

I updated node to v12.17.0:

bodypix git:master ❯  node --version                                                  ⏎ ✹
v12.17.0
bodypix git:master ❯  node app.js                                                       ✹
[1]    39127 illegal hardware instruction (core dumped)  node app.js
bodypix git:master ❯                                                                  ⏎ ✹

Same result.

fangfufu commented 4 years ago

Hmm I have absolutely no idea why your Node wouldn't run - it is not really this script's problem anyway. I cannot reproduce the problem you have with Docker either.

I will leave this ticket open, hopefully someone else would have the answer.

In the meantime, you might want to check if your Docker containers can communicate with each other.

JC1738 commented 4 years ago

Thanks, yes, that's what I have been looking at, I was wondering if I need to expose 9000 and play with the network mode.

JC1738 commented 4 years ago

@fangfufu

I figured out what's wrong with docker. It's the exact same problem. My docker-compose logs was showing the end of fakecam container. I then checked and bodypix container fails right away (which is why there is no port 9000 available).

image

fangfufu commented 4 years ago

Well that's something wrong with your distro then. It might be the kernel or libc. I can only recommend you use another distro. I will close this issue for now, as it is not really within the remit of this project.

jamestutton commented 4 years ago

Hi just to say you are not alone. Get the same issue. Not 100% sure but from some googling around the subject I think you like me have an "older" CPU and are hitting an issue where we have no AVX CPU support

https://github.com/tensorflow/tensorflow/issues/23943

Hopefully someone with more knowledge may be able to help out as new to node and tensorflow myself so maybe wrong diagnosis.

fangfufu commented 4 years ago

@JC1738 , what CPU do you have?

fangfufu commented 4 years ago

@JC1738, @jamestutton, you both could try and compile your own Tensorflow C library. However I don't think the performance would be good. https://github.com/fangfufu/Linux-Fake-Background-Webcam/blob/master/TENSORFLOW.md

@jamestutton, what's your CPU?

jamestutton commented 4 years ago

CPU wise trying this in my home lab which is HP DL380 G6 with Dual X5570s. So 11year old CPU's but fairly top spec for the era. Will try the source option. Did build the python lib yesterday from source and that worked just couldnt figure howto get the node side working so thanks for the tips in readme.

JC1738 commented 4 years ago

@jamestutton @fangfufu

cpu family      : 6
model           : 26
model name      : Intel(R) Core(TM) i7 CPU         930  @ 2.80GHz

It's probably 9-10 year old machine.

fangfufu commented 4 years ago

@JC1738, your CPU is probably not fast enough to run this, sorry!