roflcoopter / viseron

Self-hosted, local only NVR and AI Computer Vision software. With features such as object detection, motion detection, face recognition and more, it gives you the power to keep an eye on your home, office or any other place you want to monitor.
MIT License
1.51k stars 155 forks source link

Container fails when adding codeprojectai: #674

Open jokerigno opened 9 months ago

jokerigno commented 9 months ago

Hi!

I just started testing this container to replace my Frigate instance.

I managed to add my first 2 (of 4) cameras but then I cannot add codeprojectai to the config. No issue if i leave default object detector.

Below the config file:

ffmpeg:
  camera:
    soggiorno:  # This value has to be unique across all cameras
      name: Soggiorno
      host: 192.168.2.115
      port: 8554
      path: /unicast

    cameretta:  # This value has to be unique across all cameras
      name: Cameretta
      host: 192.168.2.114
      port: 88
      path: /videoMain
      username: xxx
      password: xxx
      width: 1920 
      height: 1080
      fps: 1
      codec: h264

codeprojectai:
  host: codeprojectai
  port: 32168
  object_detector:
    cameras:
      soggiorno:
        fps: 1
        log_all_objects: true
        labels:
          - label: person
            confidence: 0.8
            trigger_recorder: true
      cameretta:
        fps: 1
        labels:
          - label: person
            confidence: 0.7
            trigger_recorder: true
  face_recognition:
    save_unknown_faces: true
    cameras:
      soggiorno:
    labels:
      - person

## You can also use motion detection
mog2:
  motion_detector:
    cameras:
      soggiorno:  # Attach detector to the configured cameretta above
        fps: 1

## To tie everything together we need to configure one more component.
nvr:
  soggiorno:  # Run NVR for soggiorno
  cameretta:  # Run NVR for cameretta

# Now you can restart Viseron and you should be good to go!

This is the log seen in Portainer:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.

[s6-init] ensuring user provided files have correct perms...exited 0.

[fix-attrs.d] applying ownership & permissions fixes...

[fix-attrs.d] done.

[cont-init.d] executing container initialization scripts...

[cont-init.d] 10-adduser: executing...

usermod: no changes

**** UID/GID *****

User uid: 0

User gid: 0

** Done **

[cont-init.d] 10-adduser: exited 0.

[cont-init.d] 20-gid-video-device: executing...

[cont-init.d] 20-gid-video-device: exited 0.

[cont-init.d] 30-edgetpu-permission: executing...

** Setting EdgeTPU permissions ***

Coral Vendor IDs:

"1a6e"

"18d1"

Matching USB devices:

Bus 002 Device 002: ID 18d1:9302

No EdgeTPU PCI device was found

** Done **

[cont-init.d] 30-edgetpu-permission: exited 0.

[cont-init.d] 40-set-env-vars: executing...

** Checking for hardware acceleration platforms **

OpenCL is available!

VA-API is available!

CUDA cannot be used

* Done ***

[cont-init.d] 40-set-env-vars: exited 0.

[cont-init.d] 50-check-if-rpi: executing...

** Checking if we are running on an RPi **

Not running on any supported RPi

* Done ***

[cont-init.d] 50-check-if-rpi: exited 0.

[cont-init.d] 55-check-if-jetson: executing...

** Checking if we are running on a Jetson Board **

Not running on any supported Jetson board

* Done ***

[cont-init.d] 55-check-if-jetson: exited 0.

[cont-init.d] 60-ffmpeg-path: executing...

** Getting FFmpeg path ***

FFmpeg path: /home/abc/bin/ffmpeg

* Done ***

[cont-init.d] 60-ffmpeg-path: exited 0.

[cont-init.d] 70-gstreamer-path: executing...

Getting GStreamer path

GStreamer path: /usr/bin/gst-launch-1.0

* Done ***

[cont-init.d] 70-gstreamer-path: exited 0.

[cont-init.d] done.

[services.d] starting services

[services.d] done.

[2023-09-20 13:43:15] [INFO ] [viseron.core] - -------------------------------------------

[2023-09-20 13:43:15] [INFO ] [viseron.core] - Initializing Viseron

[2023-09-20 13:43:15] [INFO ] [viseron.components] - Setting up component data_stream

[2023-09-20 13:43:15] [INFO ] [viseron.components] - Setup of component data_stream took 0.0 seconds

[2023-09-20 13:43:15] [INFO ] [viseron.components] - Setting up component webserver

[2023-09-20 13:43:15] [INFO ] [viseron.components] - Setup of component webserver took 0.0 seconds

[2023-09-20 13:43:15] [INFO ] [viseron.components] - Setting up component mog2

[2023-09-20 13:43:15] [INFO ] [viseron.components] - Setting up component nvr

[2023-09-20 13:43:15] [INFO ] [viseron.components] - Setup of component mog2 took 0.0 seconds

[2023-09-20 13:43:15] [INFO ] [viseron.components] - Setting up component ffmpeg

[2023-09-20 13:43:15] [INFO ] [viseron.components] - Setup of component nvr took 0.0 seconds

[2023-09-20 13:43:15] [INFO ] [viseron.components] - Setting up component codeprojectai

[2023-09-20 13:43:15] [INFO ] [viseron.components] - Setup of component ffmpeg took 0.0 seconds

[viseron-finish] Viseron exit code 256

[viseron-finish] Viseron received signal 4

[cont-finish.d] executing container finish scripts...

[cont-finish.d] done.

[s6-finish] waiting for services.

[s6-finish] sending all processes the TERM signal.

[s6-finish] sending all processes the KILL signal and exiting.

roflcoopter commented 9 months ago

Interesting, what are the specs of your host?

jokerigno commented 9 months ago

It's a Asus PN41: https://www.asus.com/us/displays-desktops/mini-pcs/pn-series/mini-pc-pn41/

In the meantime I played a bit with codeproject.ai docker and now logs are different:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0. [s6-init] ensuring user provided files have correct perms...exited 0. [fix-attrs.d] applying ownership & permissions fixes... [fix-attrs.d] done. [cont-init.d] executing container initialization scripts... [cont-init.d] 10-adduser: executing... usermod: no changes **** UID/GID *** User uid: 0 User gid: 0 ** Done ** [cont-init.d] 10-adduser: exited 0. [cont-init.d] 20-gid-video-device: executing... [cont-init.d] 20-gid-video-device: exited 0. [cont-init.d] 30-edgetpu-permission: executing... ** Setting EdgeTPU permissions * Coral Vendor IDs: "1a6e" "18d1" Matching USB devices: Bus 002 Device 002: ID 18d1:9302
No EdgeTPU PCI device was found ** Done ** [cont-init.d] 30-edgetpu-permission: exited 0. [cont-init.d] 40-set-env-vars: executing... ** Checking for hardware acceleration platforms ** OpenCL is available! VA-API is available! CUDA cannot be used * Done *** [cont-init.d] 40-set-env-vars: exited 0. [cont-init.d] 50-check-if-rpi: executing... ** Checking if we are running on an RPi ** Not running on any supported RPi * Done *** [cont-init.d] 50-check-if-rpi: exited 0. [cont-init.d] 55-check-if-jetson: executing... ** Checking if we are running on a Jetson Board ** Not running on any supported Jetson board * Done *** [cont-init.d] 55-check-if-jetson: exited 0. [cont-init.d] 60-ffmpeg-path: executing... ** Getting FFmpeg path * FFmpeg path: /home/abc/bin/ffmpeg ***** Done ***** [cont-init.d] 60-ffmpeg-path: exited 0. [cont-init.d] 70-gstreamer-path: executing... * Getting GStreamer path * GStreamer path: /usr/bin/gst-launch-1.0 *** Done ***** [cont-init.d] 70-gstreamer-path: exited 0. [cont-init.d] done. [services.d] starting services [services.d] done. [2023-09-20 18:12:00] [INFO ] [viseron.core] - ------------------------------------------- [2023-09-20 18:12:00] [INFO ] [viseron.core] - Initializing Viseron [2023-09-20 18:12:00] [INFO ] [viseron.components] - Setting up component data_stream [2023-09-20 18:12:00] [INFO ] [viseron.components] - Setup of component data_stream took 0.0 seconds [2023-09-20 18:12:00] [INFO ] [viseron.components] - Setting up component webserver [2023-09-20 18:12:00] [INFO ] [viseron.components] - Setup of component webserver took 0.0 seconds [2023-09-20 18:12:00] [INFO ] [viseron.components] - Setting up component ffmpeg [2023-09-20 18:12:00] [INFO ] [viseron.components] - Setting up component codeprojectai [2023-09-20 18:12:00] [INFO ] [viseron.components] - Setting up component nvr [2023-09-20 18:12:01] [INFO ] [viseron.components] - Setting up component mog2 [2023-09-20 18:12:01] [INFO ] [viseron.components] - Setup of component nvr took 0.0 seconds [2023-09-20 18:12:01] [INFO ] [viseron.components] - Setup of component ffmpeg took 0.0 seconds [2023-09-20 18:12:01] [INFO ] [viseron.components] - Setup of component mog2 took 0.0 seconds [viseron-finish] Viseron exit code 256 [viseron-finish] Viseron received signal 4 [cont-finish.d] executing container finish scripts... [cont-finish.d] done. [s6-finish] waiting for services. [s6-finish] sending all processes the TERM signal. [s6-finish] sending all processes the KILL signal and exiting.

roflcoopter commented 9 months ago

Hmm strange, how much RAM does it have? Codeproject AI component is using the REST API so i am not sure how that could fail like this

roflcoopter commented 9 months ago

Did you perhaps set a memory limit on the Docker container?

bsyomov commented 6 months ago

Try to use dmesg command after viseron exited.

I have similliar problem, and in dmesg output: traps: python3[13462] trap invalid opcode ... in _dlib_pybind11.cpython-38-x86_64-linux-gnu.so[...]

I rebuid dlib as workarond.

orlandozeta commented 4 months ago

Try to use dmesg command after viseron exited.

I have similliar problem, and in dmesg output: traps: python3[13462] trap invalid opcode ... in _dlib_pybind11.cpython-38-x86_64-linux-gnu.so[...]

I rebuid dlib as workarond.

how did you rebuild dlib?

bsyomov commented 4 months ago

how did you rebuild dlib?

I'm using a Dockerfile like this:

FROM roflcoopter/amd64-cuda-viseron:dev
RUN apt-get -y update && apt-get install -y build-essential cmake python3-dev
RUN pip install --force-reinstall dlib

And in my docker-compose.yml:

services:
  viseron:
#    image: roflcoopter/amd64-cuda-viseron:dev   # < this line commented
    build: . # < this line added to use Dockerfile insted image.
luisiam commented 2 months ago

Looks very similar to the issue I had before. Not sure if something is missing from those Intel N series CPU.

https://github.com/roflcoopter/viseron/discussions/573