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

"compreface_setup did not finish in time" when training faces (minor issue) #600

Open hessijames79 opened 1 year ago

hessijames79 commented 1 year ago

When using CompreFace to train several images via Viseron, the static timeout of 30s in viseron/components/init.py:692 is exceeded.

[2023-05-11 18:58:27] [INFO    ] [viseron.components] - Setting up component compreface
[2023-05-11 18:58:30] [DEBUG   ] [viseron.components.compreface.face_recognition] - Training face REDACTED 1
[2023-05-11 18:58:31] [DEBUG   ] [viseron.components.compreface.face_recognition] - CompreFace response: {'image_id': '35e302ce-3845-41cc-b9b7-615275523dfc', 'subject': 'REDACTED 1'}
[2023-05-11 18:58:32] [DEBUG   ] [viseron.components.compreface.face_recognition] - CompreFace response: {'image_id': '4dbef6af-b151-412a-b8cb-b6f382cb4009', 'subject': 'REDACTED 1'}
[2023-05-11 18:58:33] [DEBUG   ] [viseron.components.compreface.face_recognition] - CompreFace response: {'image_id': '639c6ef1-a127-49ec-aa54-2a70c400064c', 'subject': 'REDACTED 1'}
[2023-05-11 18:58:34] [DEBUG   ] [viseron.components.compreface.face_recognition] - CompreFace response: {'image_id': '48b289b4-e7b2-4920-9cc5-6f0ee2b0f090', 'subject': 'REDACTED 1'}
[2023-05-11 18:58:35] [DEBUG   ] [viseron.components.compreface.face_recognition] - CompreFace response: {'image_id': '3d9afb31-5430-4f22-af6f-ad5e74dff296', 'subject': 'REDACTED 1'}
[2023-05-11 18:58:36] [DEBUG   ] [viseron.components.compreface.face_recognition] - CompreFace response: {'image_id': 'c19095e4-5296-4953-99b6-9dc121a1231b', 'subject': 'REDACTED 1'}
[2023-05-11 18:58:37] [DEBUG   ] [viseron.components.compreface.face_recognition] - CompreFace response: {'image_id': '0289e695-4a71-4f1c-86c2-f143240d4835', 'subject': 'REDACTED 1'}
[2023-05-11 18:58:38] [DEBUG   ] [viseron.components.compreface.face_recognition] - CompreFace response: {'image_id': '98cd054a-8437-44fe-b6d6-8067797bde55', 'subject': 'REDACTED 1'}
[2023-05-11 18:58:38] [DEBUG   ] [viseron.components.compreface.face_recognition] - CompreFace response: {'image_id': '536051ef-fff7-4bdf-8b94-9e9111a5fa68', 'subject': 'REDACTED 1'}
[2023-05-11 18:58:39] [DEBUG   ] [viseron.components.compreface.face_recognition] - CompreFace response: {'image_id': '6d66234b-b6e9-4f18-8d85-e4d0dd84ca21', 'subject': 'REDACTED 1'}
[2023-05-11 18:58:39] [DEBUG   ] [viseron.components.compreface.face_recognition] - Training face REDACTED 2
[2023-05-11 18:58:42] [DEBUG   ] [viseron.components.compreface.face_recognition] - CompreFace response: {'image_id': '315dee4c-bbad-4abb-b356-b3195e9d5fa2', 'subject': 'REDACTED 2'}
[2023-05-11 18:58:43] [DEBUG   ] [viseron.components.compreface.face_recognition] - CompreFace response: {'image_id': '88faa691-eedd-46b1-b7df-ba1f0b3b7178', 'subject': 'REDACTED 2'}
[2023-05-11 18:58:44] [DEBUG   ] [viseron.components.compreface.face_recognition] - CompreFace response: {'image_id': 'be75a1a7-1d34-4ea3-bc4a-fee53cf36534', 'subject': 'REDACTED 2'}
[2023-05-11 18:58:45] [DEBUG   ] [viseron.components.compreface.face_recognition] - CompreFace response: {'image_id': 'f2500e64-ef13-4e7a-8ffe-c41c72fddffa', 'subject': 'REDACTED 2'}
[2023-05-11 18:58:46] [DEBUG   ] [viseron.components.compreface.face_recognition] - CompreFace response: {'image_id': 'ad5ec0ed-ae3f-436f-8791-d82fb9625fc6', 'subject': 'REDACTED 2'}
[2023-05-11 18:58:46] [DEBUG   ] [viseron.components.compreface.face_recognition] - CompreFace response: {'image_id': '79aff69d-ebc4-458d-badb-dc5a1e968339', 'subject': 'REDACTED 2'}
[2023-05-11 18:58:50] [DEBUG   ] [viseron.components.compreface.face_recognition] - CompreFace response: {'image_id': '6b6330da-635b-4a8a-906f-b842ee2e4138', 'subject': 'REDACTED 2'}
[2023-05-11 18:58:50] [WARNING ] [viseron.components] - Setup of component compreface is taking longer than 20 seconds
[2023-05-11 18:58:53] [DEBUG   ] [viseron.components.compreface.face_recognition] - CompreFace response: {'image_id': '6779c078-6b51-47d4-9c81-e7c585d97b9a', 'subject': 'REDACTED 2'}
[2023-05-11 18:58:53] [DEBUG   ] [viseron.components.compreface.face_recognition] - CompreFace response: {'image_id': '473bbc8d-0710-4782-82a2-bc140c4bf9ba', 'subject': 'REDACTED 2'}
[2023-05-11 18:58:54] [DEBUG   ] [viseron.components.compreface.face_recognition] - CompreFace response: {'image_id': '30de44ca-2a1d-4b31-b766-4f7b486d1115', 'subject': 'REDACTED 2'}
[2023-05-11 18:58:55] [DEBUG   ] [viseron.components.compreface.face_recognition] - CompreFace response: {'image_id': '3fc8ad77-8094-4fa8-97ae-bccf07c4843d', 'subject': 'REDACTED 2'}
[2023-05-11 18:58:57] [DEBUG   ] [viseron.components.compreface.face_recognition] - CompreFace response: {'image_id': '3c5d194b-aec9-4065-a229-1166456248be', 'subject': 'REDACTED 2'}
[2023-05-11 18:58:57] [DEBUG   ] [viseron.components.compreface.face_recognition] - CompreFace response: {'message': 'No face is found in the given image', 'code': 28}
[2023-05-11 18:58:57] [WARNING ] [viseron.components.compreface.face_recognition] - Image /config/face_recognition/faces/REDACTED 2/2023-05-11-12:58:16-08f5760f-0fa0-4594-82b8-53aea560bdb6.jpg not suitable for training: {'message': 'No face is found in the given image', 'code': 28}
[2023-05-11 18:58:58] [DEBUG   ] [viseron.components.compreface.face_recognition] - CompreFace response: {'image_id': 'e35c77c5-ae26-494c-aaee-83416eb0a1ef', 'subject': 'REDACTED 2'}
[2023-05-11 18:58:58] [ERROR   ] [viseron.components] - compreface_setup did not finish in time
compreface:
  face_recognition:
    host: compreface.DOMAIN
    port: 5001
    recognition_api_key: 39322fb6-d4fd-495d-976a-8480be0b6842
    train: true
    face_plugins: age,gender
    save_unknown_faces: true
    status: true
    similarity_threshold: 0.9   # default: 0.5
    cameras:
      cam_01_stellplatz:
      cam_02_haustuer:
      cam_03_seite:
      cam_04_gartenhaus:
      cam_05_arbeitszimmer:
      cam_06_garage:
      cam_07_dachvorn:
    labels:
      - person

As there are workarounds such as training smaller batches of faces or using the CompreFace UI I think this is a minor bug.

A quick (and slightly dirty) fix might be to make the timeout configurable, if necessary globally for all components.

Patrick

roflcoopter commented 1 year ago

Ahh this is a case that I totally didn't think about! Will see if I can find a good solution, thanks for bringing it up