From bd3fc82923a236dabb004ae59d446282c6ceb6c3 Mon Sep 17 00:00:00 2001 From: Simon L Date: Thu, 4 Jan 2024 00:39:58 +0100 Subject: [PATCH 1/3] community-containers - add facerecognition Signed-off-by: Simon L --- .../facerecognition/facerecognition.json | 29 +++++++++++++++++++ .../facerecognition/readme.md | 11 +++++++ readme.md | 2 +- 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 community-containers/facerecognition/facerecognition.json create mode 100644 community-containers/facerecognition/readme.md diff --git a/community-containers/facerecognition/facerecognition.json b/community-containers/facerecognition/facerecognition.json new file mode 100644 index 00000000..3ad00fa2 --- /dev/null +++ b/community-containers/facerecognition/facerecognition.json @@ -0,0 +1,29 @@ +{ + "aio_services_v1": [ + { + "container_name": "nextcloud-aio-facerecognition", + "display_name": "Computing container for facerecognition", + "documentation": "https://github.com/nextcloud/all-in-one/tree/main/community-containers/facerecognition", + "image": "matiasdelellis/facerecognition-external-model", + "image_tag": "initial", + "internal_port": "5000", + "restart": "unless-stopped", + "environment": [ + "TZ=%TIMEZONE%", + "API_KEY=some-super-secret-api-key" + ], + "aio_variables": [ + "nextcloud_memory_limit=4096M" + ], + "nextcloud_exec_commands": [ + "php /var/www/html/occ app:install facerecognition", + "php /var/www/html/occ app:enable facerecognition", + "php /var/www/html/occ config:system:set facerecognition.external_model_url --value nextcloud-aio-facerecognition:5000", + "php /var/www/html/occ config:system:set facerecognition.external_model_api_key --value some-super-secret-api-key", + "php /var/www/html/occ face:setup -m 5", + "php /var/www/html/occ face:setup -M 4G", + "php /var/www/html/occ face:background_job &" + ] + } + ] +} diff --git a/community-containers/facerecognition/readme.md b/community-containers/facerecognition/readme.md new file mode 100644 index 00000000..6614be86 --- /dev/null +++ b/community-containers/facerecognition/readme.md @@ -0,0 +1,11 @@ +## Facerecognition +This container bundles the external model of facerecognition and auto-configures it for you. + +### Notes +- See https://github.com/nextcloud/all-in-one/tree/main/community-containers#community-containers how to add it to the AIO stack + +### Repository +https://github.com/matiasdelellis/facerecognition-external-model + +### Maintainer +https://github.com/matiasdelellis diff --git a/readme.md b/readme.md index 57d900f0..60a11027 100644 --- a/readme.md +++ b/readme.md @@ -663,7 +663,7 @@ Some Nextcloud apps require additional php extensions that must be bundled withi You can do so by adding `--env NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS="imagick extension1 extension2"` to the docker run command of the mastercontainer (but before the last line `nextcloud/all-in-one:latest`! If it was started already, you will need to stop the mastercontainer, remove it (no data will be lost) and recreate it using the docker run command that you initially used) and customize the value to your fitting. It must be a string with small letters a-z, digits 0-9, spaces, dots and hyphens or '_'. You can find available extensions here: https://pecl.php.net/packages.php. By default `imagick` is added. If you want to keep it, you need to specify it as well. ### What about the pdlib PHP extension for the facerecognition app? -The [facerecognition app](https://apps.nextcloud.com/apps/facerecognition) requires the pdlib PHP extension to be installed. Unfortunately, it is not available on PECL nor via PHP core, so there is no way to add this into AIO currently. However you can vote up [this issue](https://github.com/goodspb/pdlib/issues/56) to bring it to PECL and there is the [recognize app](https://apps.nextcloud.com/apps/recognize) that also allows to do face-recognition. +The [facerecognition app](https://apps.nextcloud.com/apps/facerecognition) requires the pdlib PHP extension to be installed. Unfortunately, it is not available on PECL nor via PHP core, so there is no way to add this into AIO currently. However you can use [this community container](https://github.com/nextcloud/all-in-one/tree/main/community-containers/facerecognition) in order to run facerecognition. ### How to enable hardware-transcoding for Nextcloud? ⚠️⚠️⚠️ Warning: this only works if the `/dev/dri` device is present on the host! If it does not exists on your host, don't proceed as otherwise the Nextcloud container will fail to start! If you are unsure about this, better do not proceed with the instructions below. From 8fc41130a0d15691574b87c037b223b517e504e0 Mon Sep 17 00:00:00 2001 From: Simon L Date: Fri, 5 Jan 2024 10:52:09 +0100 Subject: [PATCH 2/3] address review Signed-off-by: Simon L --- community-containers/facerecognition/facerecognition.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/community-containers/facerecognition/facerecognition.json b/community-containers/facerecognition/facerecognition.json index 3ad00fa2..1c198fc6 100644 --- a/community-containers/facerecognition/facerecognition.json +++ b/community-containers/facerecognition/facerecognition.json @@ -22,7 +22,8 @@ "php /var/www/html/occ config:system:set facerecognition.external_model_api_key --value some-super-secret-api-key", "php /var/www/html/occ face:setup -m 5", "php /var/www/html/occ face:setup -M 4G", - "php /var/www/html/occ face:background_job &" + "php /var/www/html/occ config:app:set facerecognition analysis_image_area --value 4320000", + "php /var/www/html/occ face:background_job --defer-clustering &" ] } ] From a126cfceaf9055817a2e10cbdd096078ef14108f Mon Sep 17 00:00:00 2001 From: Simon L Date: Fri, 5 Jan 2024 22:34:20 +0100 Subject: [PATCH 3/3] enable previews for modern file formats and add some docs Signed-off-by: Simon L --- community-containers/facerecognition/facerecognition.json | 5 +++++ community-containers/facerecognition/readme.md | 2 ++ 2 files changed, 7 insertions(+) diff --git a/community-containers/facerecognition/facerecognition.json b/community-containers/facerecognition/facerecognition.json index 1c198fc6..6f4511bb 100644 --- a/community-containers/facerecognition/facerecognition.json +++ b/community-containers/facerecognition/facerecognition.json @@ -23,6 +23,11 @@ "php /var/www/html/occ face:setup -m 5", "php /var/www/html/occ face:setup -M 4G", "php /var/www/html/occ config:app:set facerecognition analysis_image_area --value 4320000", + "php /var/www/html/occ config:system:set enabledFaceRecognitionMimetype 0 --value image/jpeg", + "php /var/www/html/occ config:system:set enabledFaceRecognitionMimetype 1 --value image/png", + "php /var/www/html/occ config:system:set enabledFaceRecognitionMimetype 2 --value image/heic", + "php /var/www/html/occ config:system:set enabledFaceRecognitionMimetype 3 --value image/tiff", + "php /var/www/html/occ config:system:set enabledFaceRecognitionMimetype 4 --value image/webp", "php /var/www/html/occ face:background_job --defer-clustering &" ] } diff --git a/community-containers/facerecognition/readme.md b/community-containers/facerecognition/readme.md index 6614be86..9e4cf106 100644 --- a/community-containers/facerecognition/readme.md +++ b/community-containers/facerecognition/readme.md @@ -2,6 +2,8 @@ This container bundles the external model of facerecognition and auto-configures it for you. ### Notes +- This container needs imaginary in order to analyze modern file format images. Make sure to enable imaginary in the AIO interface before adding this container. +- If facerecognition shall analyze shared files & folders (`sudo docker exec --user www-data -it nextcloud-aio-nextcloud php occ config:app:set facerecognition handle_shared_files --value true`), groupfolders (`sudo docker exec --user www-data -it nextcloud-aio-nextcloud php occ config:app:set facerecognition handle_group_files --value true`) and/or external storages (`sudo docker exec --user www-data -it nextcloud-aio-nextcloud php occ config:app:set facerecognition handle_external_files --value true`) in Nextcloud, you need to enable support for it manually first by running the mentioned commands before adding this container. See https://github.com/matiasdelellis/facerecognition/wiki/Settings#hidden-settings for further notes on each of these settings. - See https://github.com/nextcloud/all-in-one/tree/main/community-containers#community-containers how to add it to the AIO stack ### Repository