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.55k stars 158 forks source link

Using Viseron 3.0.0b8 with CodeProject.AI but unable to train as no images get saved to the unknown folder... #780

Closed sgoldtho closed 3 weeks ago

sgoldtho commented 4 weeks ago

Using Viseron 3.0.0b8 with CodeProject.AI but unable to train as no images get saved to the unknown folder.

Folder structure: face_recognition/faces/unknown

Face recognition config for codeprojectai:

face_recognition:
  save_unknown_faces: true
  expire_after: 10
  cameras:
    front_porch:
  labels:
    - person

The DEBUG logs for vireson.components.codeprojectai.face_recognition.front_porch show...

[2024-07-07 15:10:19] [DEBUG ] [viseron.components.codeprojectai.face_recognition.front_porch] - Face recognition result: {'message': 'No known faces', 'count': 1, 'predictions': [{'confidence': 0, 'userid': 'unknown', 'x_min': 64, 'y_min': 19, 'x_max': 116, 'y_max': 108}], 'success': True, 'inferenceMs': 129, 'processMs': 131, 'moduleId': 'FaceProcessing', 'moduleName': 'Face Processing', 'code': 200, 'command': 'recognize', 'requestId': '13f42a44-c558-416a-9c4a-c91a31e19cd6', 'inferenceDevice': 'CPU', 'analysisRoundTripMs': 135, 'processedBy': 'localhost', 'timestampUTC': 'Sun, 07 Jul 2024 05:10:19 GMT'}

Have I missed something?

roflcoopter commented 4 weeks ago

They should be stored along with the other detections, by default that is in /snapshots/face_recognition/<CAMERA IDENTIFIER>/unknown

sgoldtho commented 4 weeks ago

Ah ha, at least I can see my camera has a folder under face_recognition, but no subfolders under the camera.

I might have some 'serious' configuration issues as I went from version 2 to version 3 of Viseron using the same config file and Docker settings.

Have the Docker Recording Path and Config Path changed between the two versions?

Update... Re-configure my docker run to align with what you have here: https://dev--viseron.netlify.app/docs/documentation/installation#running-viseron

Will see what happens...

sgoldtho commented 4 weeks ago

With the corrected docker settings I can see images being saved in /snapshots/face_recognition/front_porch/unknown and can move them to thier repective subfolders.

Some observations:

If I restart Veseron to get the faces to train the default seems to be '/config/face_recognition/faces/' so I added 'face_recognition_path: /snapshots/face_recognition' but that returned 'No images were found for face front_porch in folder /snapshots/face_recognition/front_porch. Please provide some images of this person'.

I changed to 'face_recognition_path: /snapshots/face_recognition/front_porch' and then the training could find the images in the sub-folders.

codeprojectai
  face_recognition:
    face_recognition_path: /snapshots/face_recognition/front_porch
    save_unknown_faces: true
    expire_after: 10
    cameras:
      front_porch:
    labels:
      - person

Question:

Is that how it is supposed to be configured or is there something not quite right?

roflcoopter commented 3 weeks ago

You should not have to change face_recognition_path. Did you use face recognition before v3? The only thing that has changed is where detected faces are stored (in snapshots) so it should not affect your training data

sgoldtho commented 3 weeks ago

Yes I have used face recognition before v3.

I'll remove face_recognition_path from my config then tomorrow will double check where things go...

First thing I've noticed is that without face_recognition_path being set Viseron reads from '/config/face_recognition/faces/' not from '/snapshots/face_recognition/'

sgoldtho commented 3 weeks ago

I've remapped '/config' to a new directory on my host system and restarted Viseron and everything seems to be working now (I think).

Images get saved to snapshots/face_recognition/<camera name>/unknown for unrecognised, or snapshots/face_recognition/<camera name>/<person name> for recognised.

Then for the training, copy images to config/face_recognition/faces/<person name> and restart Viseron to pickup any new images.

roflcoopter commented 3 weeks ago

Yes that is how it is intended to work! In the future i hope to make it managable through the frontend instead of having to manually copy files.

Gonna close this if you dont mind, feel free to reopen if you encounter issues