home-gallery icon indicating copy to clipboard operation
home-gallery copied to clipboard

[optimization] Allow to disable face and object recognition altogether

Open asitemade4u opened this issue 2 years ago • 4 comments

In order to optimize the discovery of new photos in the registered folder, is there an environment variable thatg allows to disable face and object recognition? I know I am not using HG the most mainstream way (I only manage monument and cityscape photos with it) but I guess it would also be useful for otherf users. Besides PhotoPrism has such an option.

asitemade4u avatar May 20 '22 15:05 asitemade4u

This is a nice feature, since the image similarity, face detection and object detection consumes some time.

PRs are welcome and if some support for the the implementation is required, please PM me.

xemle avatar May 22 '22 19:05 xemle

BTW if you would like to disable all ML features like image similarity, face detection and object detection, you can set the api service endpoint to a non existing address and the extractor will skip these. E.g. set the env variable to GALLERY_API_SERVER=http://localhost:32109

xemle avatar Jun 27 '22 21:06 xemle

@Gulluth Would you disable the API features partially? E.g. you disable face detection but keep object detection and similarity? Would that help? Or is the motivation to speedup the import process?

xemle avatar Aug 16 '22 20:08 xemle

I have had time to play with these features a little more. To update my earlier reply, I would welcome the ability to toggle the face recognition and object detection functionality. I may keep the object detection enabled, as it does help to have similar images grouped together while scanning the image library.

~~I am interested in speeding up the import, but I am not interested in object detection. I mostly feel like the false-positives will be too high, and the images that I am working with are too weird for the ML to understand. I'll post some examples.~~

edit: comment updated and removed the obnoxiously sized attachments.

Gulluth avatar Aug 16 '22 22:08 Gulluth

Doesn't the face & object detection run on only when manually triggered from gallery run import? In my testing that's the only time I see it running so the load on the server doesn't appear high during "normal" operation.

I kind of wish the processing jobs were separate by function so you could run one job without the others. ie: gallery run import does all functions, but gallery run photos just imports the photos without any other processing and gallery run face just does face detection. This might solve the problem I have with 80% of the images with faces (or objects) not being detected. I'm assuming they're being skipped for some reason during import processing. I could keep re-running the gallery run face until they were.

augmentedagent avatar Feb 13 '23 15:02 augmentedagent

Doesn't the face & object detection run on only when manually triggered from gallery run import? In my testing that's the only time I see it running so the load on the server doesn't appear high during "normal" operation.

Face & object detection is used always. A toggle is not implemented yet. PRs are welcome.

At least the extractor tries to use these detections. Since it uses a remote service (for historical reasons) it expects the results to be within a given time. If the time threshold is exceeded it stops using this extraction in that run. It will try to get the information on the next import job.

I kind of wish the processing jobs were separate by function so you could run one job without the others. ie: gallery run import does all functions, but gallery run photos just imports the photos without any other processing and gallery run face just does face detection. This might solve the problem I have with 80% of the images with faces (or objects) not being detected. I'm assuming they're being skipped for some reason during import processing. I could keep re-running the gallery run face until they were.

Which problem do you try to solve with split command like gallery run photos and gallery run face?

I am asking because I have the problem that video conversion takes a lot of time and I want to see quick import results. Does it target also your problem?

Otherwise as mentioned above, gallery run import will retry to get missing conversions like missing faces. Maybe check the logs for timeouts and increase the timeouts in the config

extractor:
  apiServer:
    timeout: 60
    concurrent: 5

xemle avatar Feb 13 '23 21:02 xemle

Watch out for Too many errors. Skip processing of face detection in gallery.log and check if the timeout happens on your side.

xemle avatar Feb 13 '23 22:02 xemle

Hi @asitemade4u

The new v1.11.0 is released and supports disabling the object and face detection via the gallery.config.yml. See configuration docs:

#extractor:
  #apiServer:
  #  url: https://api.home-gallery.org
  #  timeout: 30
  #  concurrent: 5,
  #  disable:
  #    - similarDetection
  #    - objectDetection
  #    - faceDetection

See further changes on v1.11.0 in the Changelog

xemle avatar Aug 03 '23 17:08 xemle