Viseron v3.0.0b1 - Self-hosted, local only NVR and AI Computer Vision software

trying to start the container with below basic config.

mqtt:
  broker: 192.168.99.100
  port: 1883
  username: !secret mqtt_user
  password: !secret mqtt_pass

ffmpeg:
  camera:
    camera_one:
      name: office
      host: 192.168.10.124
      port: 554
      path: /H.264
      username: !secret camera_one_username
      password: !secret camera_one_password

and exits

*********************** Done *****************************
[cont-init.d] 60-ffmpeg-path: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/src/viseron/__main__.py", line 16, in <module>
    init()
  File "/src/viseron/__main__.py", line 13, in init
    main()
  File "/src/viseron/__main__.py", line 7, in main
    Viseron()
  File "/src/viseron/__init__.py", line 31, in __init__
    config = ViseronConfig(load_config())
  File "/src/viseron/config/__init__.py", line 269, in load_config
    return VISERON_CONFIG_SCHEMA(raw_config)
  File "/usr/local/lib/python3.8/dist-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
  File "/usr/local/lib/python3.8/dist-packages/voluptuous/validators.py", line 205, in _run
    return self._exec(self._compiled, value, path)
  File "/usr/local/lib/python3.8/dist-packages/voluptuous/validators.py", line 287, in _exec
    raise e if self.msg is None else AllInvalid(self.msg, path=path)
  File "/usr/local/lib/python3.8/dist-packages/voluptuous/validators.py", line 285, in _exec
    v = func(path, v)
  File "/usr/local/lib/python3.8/dist-packages/voluptuous/schema_builder.py", line 594, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/usr/local/lib/python3.8/dist-packages/voluptuous/schema_builder.py", line 432, in validate_mapping
    raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: extra keys not allowed @ data['ffmpeg']
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.

Any guidance is appreciated.

What tag are you using in your docker run command? Seems you have an old version

I’m using compose:

  viseron:
    container_name: viseron
    image: roflcoopter/amd64-cuda-viseron
    restart: unless-stopped
    privileged: true
    hostname: UNRAID
    network_mode: appdata_mynet 
    volumes:
    - /mnt/cache/appdata/cctv/viseron/data:/recordings
    - /mnt/cache/appdata/cctv/viseron/config:/config
    - /etc/localtime:/etc/localtime:ro
    - /dev/bus/usb:/dev/bus/usb
    env_file: secrets/.env
    ports:
    - 8878:8888
    # labels:
    # - "com.centurylinklabs.watchtower.enable=true"  
    runtime: nvidia    
    deploy:
      resources:
        reservations:
          devices:
          - capabilities: ["gpu"]
            device_ids: ["GPU-xxxxxxxxxxxxx]  

Got it running now. Cameras need to be defined first :joy:

You should not need to specify the cameras first.

You should use image: roflcoopter/amd64-cuda-viseron:2.0.0b1, the way you have it setup now would pull the latest tage which is still v1.

Ok thank you. I’ve pulled that one.
no errors; gui comes up.
But the camera keeps showing the spinning (loading) simbol

You also need to use the nvr component for them to fully load.

nvr:
  camera_one:

Working on the docs issue btw, its related to this: reactjs - Netlify renders 404 on page refresh (using React and react-router) - Stack Overflow

Thank you. And also needs to have at least one motion detector for the camera…that’s what the error said, so I added it and i can now see the camera.

The 404 error on the documentation site is now fixed!

Also made the search function index the individual component pages for better searchability

2 Likes

Good day. I’ve set up dlib per the example and getting this error:

[2022-10-30 13:12:45] [ERROR   ] [viseron.components.ffmpeg.camera.camera_one] - Did not receive a frame
[2022-10-30 13:12:50] [ERROR   ] [viseron.components.ffmpeg.camera.camera_one] - Restarting frame pipe
[2022-10-30 13:13:00] [ERROR   ] [root] - Uncaught thread exception
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/src/viseron/domains/post_processor/__init__.py", line 121, in post_process
    self.process(
  File "/src/viseron/components/dlib/face_recognition.py", line 96, in process
    self.face_recognition(decoded_frame, detected_object)
  File "/src/viseron/components/dlib/face_recognition.py", line 77, in face_recognition
    faces = predict(
  File "/src/viseron/components/dlib/predict.py", line 24, in predict
    face_locations = face_recognition.face_locations(frame, model=model)
  File "/usr/local/lib/python3.8/dist-packages/face_recognition/api.py", line 119, in face_locations
    return [_trim_css_to_bounds(_rect_to_css(face.rect), img.shape) for face in _raw_face_locations(img, number_of_times_to_upsample, "cnn")]
  File "/usr/local/lib/python3.8/dist-packages/face_recognition/api.py", line 103, in _raw_face_locations
    return cnn_face_detector(img, number_of_times_to_upsample)
RuntimeError: Error while calling cudnnGetConvolution2dForwardOutputDim( (const cudnnConvolutionDescriptor_t)conv_handle, descriptor(data), (const cudnnFilterDescriptor_t)filter_handle, &out_num_samples, &out_k, &out_nr, &out_nc) in file /tmp/dlib/dlib/cuda/cudnn_dlibapi.cpp:1005. code: 3, reason: CUDNN_STATUS_BAD_PARAM

edit: also the detection bounding box is always offset. see below

What GPU do you have? Could be a compatibility issue.

What does your config look like? I have had reports of similar issues before but i have not founda solution. It does not happen for me on my GTX 1660.
You could switch to deepstack object detection until i find a fix.

Good day Im using a GTX1050 Ti.

This is my config

mqtt:
  broker: 192.168.99.100
  port: 1883
  username: !secret mqtt_user
  password: !secret mqtt_pass
  client_id: viseron

nvr:
  camera_one:

ffmpeg:
  camera:
    camera_one:
      name: office
      host: 192.168.10.124
      port: 554
      path: /H.264
      username: !secret camera_one_username
      password: !secret camera_one_password
      mjpeg_streams:
        my_stream:
          # width: 100
          # height: 100
          draw_objects: true
          rotate: 45
          mirror: true
        objects:
          draw_objects: true
          draw_zones: true
          draw_motion: true
          draw_motion_mask: true
          draw_object_mask: true
      recorder:
        idle_timeout: 5
      frame_timeout: 10

background_subtractor:
  motion_detector:
    cameras:
      camera_one:
        fps: 5

darknet:
  object_detector:
    model_path: /detectors/models/darknet/yolov4.weights
    model_config: /detectors/models/darknet/yolov4.cfg
    cameras:
      camera_one:
        fps: 5
        scan_on_motion_only: true
        log_all_objects: false
        labels:
          - label: person
            confidence: 0.7
            trigger_recorder: true

dlib:
  face_recognition:
    model: hog
    expire_after: 10
    cameras:
      camera_one:
        labels:
          - person
    save_unknown_faces: true

Regarding the bounding box issue, I recall seeing the same issue with the zmevent machine used by zoneminder. At the time I recall an option was added to the config file and that resolved it.

See this thread.

It may shed some light.

Deepstack is an option, but in general I’ve had much better results with Compreface for face detection.

I’m not a developer so I have no understading of the work involved in offering Comprefaces as well, but worth keeping in mind. Morever there’s already an app that pulls data from compreface and used in home assistant. Doubletake

I found the issue, writing tests for it atm so will push it soon!
I am resizing images using a technique called letterboxing which pads the image to keep the aspect ratio. There was an issue with the algorithm i used when converting back to the original frames resolution which affected the x-coordinate.

Will look into Compreface!

v2.0.0b2 is now out with the fix to Darknet bounding boxes being shifted.
I also compiled dlib with extra parameters which i hope will let it work on your GPU

Good day. Thank you.
So the bounding box is fixed.
dlib is not throwing errors but I doesnt recognize.
How do I find out if face is recognised? would the snapshot include the recognised face name?
Or do I need a sensor?

You should see detections in the log if you enable debug logging, and also MQTT topics for it along with Home Assistant entities.

dlib is not very great at detecting to be honest.
I spent some time implementing Compreface (it was very easy) so you can give that a go if you like!

I have not created a new release for it yet tho so if you want to try it you need to swap to the dev docker tag.

Thank you. I’ll try compreface. What would be the config snipet?

something like this?

  compreface:
    url: http://192.168.99.100:8001
    key: mykey
    timeout: 15
    det_prob_threshold: 0.8
    face_recognition:
      save_unknown_faces: false
      cameras:
        camera_one:
      labels:
        - person


Its available in the docs: Compreface | Viseron

Good day, I tried and it’s throwing an error

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/urllib3/connection.py", line 174, in _new_conn
    conn = connection.create_connection(
  File "/usr/local/lib/python3.8/dist-packages/urllib3/util/connection.py", line 95, in create_connection
    raise err
  File "/usr/local/lib/python3.8/dist-packages/urllib3/util/connection.py", line 85, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.8/dist-packages/urllib3/connectionpool.py", line 398, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/lib/python3.8/dist-packages/urllib3/connection.py", line 239, in request
    super(HTTPConnection, self).request(method, url, body=body, headers=headers)
  File "/usr/lib/python3.8/http/client.py", line 1256, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1302, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1251, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1011, in _send_output
    self.send(msg)
  File "/usr/lib/python3.8/http/client.py", line 951, in send
    self.connect()
  File "/usr/local/lib/python3.8/dist-packages/urllib3/connection.py", line 205, in connect
    conn = self._new_conn()
  File "/usr/local/lib/python3.8/dist-packages/urllib3/connection.py", line 186, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x15245c35b190>: Failed to establish a new connection: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/requests/adapters.py", line 489, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.8/dist-packages/urllib3/connectionpool.py", line 787, in urlopen
    retries = retries.increment(
  File "/usr/local/lib/python3.8/dist-packages/urllib3/util/retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='compreface', port=8001): Max retries exceeded with url: /api/v1/recognition/faces?subject=juan (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x15245c35b190>: Failed to establish a new connection: [Errno 111] Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/src/viseron/components/__init__.py", line 130, in setup_component
    result = component_module.setup(self._vis, config)
  File "/src/viseron/components/compreface/__init__.py", line 115, in setup
    ComprefaceTrain(config)
  File "/src/viseron/components/compreface/face_recognition.py", line 164, in __init__
    self.train()
  File "/src/viseron/components/compreface/face_recognition.py", line 204, in train
    self._face_collection.delete_all(face_dir)
  File "/usr/local/lib/python3.8/dist-packages/compreface/collections/face_collections.py", line 107, in delete_all
    return self.delete_all_examples_of_subject_by_name.execute(request)
  File "/usr/local/lib/python3.8/dist-packages/compreface/use_cases/delete_all_examples_of_subject_by_name.py", line 36, in execute
    result: dict = self.add_example_of_subject.delete(request.subject)
  File "/usr/local/lib/python3.8/dist-packages/compreface/client/add_example_of_subject.py", line 80, in delete
    result = requests.delete(url, headers={'x-api-key': self.api_key})
  File "/usr/local/lib/python3.8/dist-packages/requests/api.py", line 157, in delete
    return request("delete", url, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/requests/sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.8/dist-packages/requests/sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/requests/adapters.py", line 565, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='compreface', port=8001): Max retries exceeded with url: /api/v1/recognition/faces?subject=juan (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x15245c35b190>: Failed to establish a new connection: [Errno 111] Connection refused'))
[2022-11-02 18:35:33] [ERROR   ] [viseron.components] - Uncaught exception setting up component compreface: HTTPConnectionPool(host='compreface', port=8001): Max retries exceeded with url: /api/v1/recognition/faces?subject=juan (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x15245c35b190>: Failed to establish a new connection: [Errno 111] Connection refused'))
None
[2022-11-02 18:35:33] [ERROR   ] [viseron.components] - Setup of component compreface failed
[2022-11-02 18:35:33] [ERROR   ] [viseron.components] - Failed setup of component compreface

Is your compreface instance available on the hostname compreface? Try with the IP instead