facerecognition
facerecognition copied to clipboard
Maximum memory not configured
Expected behaviour
Maximum memory should be configured so that face recognition can run
Actual behaviour
Maximum memory assigned for image processing: Not configured.
Seems that you still have to configure the assigned memory for image processing.
Steps to reproduce
Configuration was working until I upgraded Nextcloud to 23.0.0, After updating the app I get this message now. I can't adjust any of the sliders as they are all greyed out.
I'm guessing I need to force the settings again through CLI but I can't work out which ones I need!
Server configuration
-
Operating system: Operating System: Ubuntu 20.04.3 LTS Kernel: Linux 5.4.0-91-generic Architecture: x86-64
-
Pdlib version: php7.4-pdlib
-
How is DLib installed: Make sure it is working correctly with this tool Installed as per guide: Welcome to pdlib min test suite for Facerecognition app...
First we try to open the models... Done
Processing file: input/Big Bang Theory.jpg Number of faces detected: 3 Face landmarks... Done Face descriptor... Done Face landmarks... Done Face descriptor... Done Face landmarks... Done Face descriptor... Done Processing file: input/Big Bang Theory.png Number of faces detected: 7 Face landmarks... Done Face descriptor... Done Face landmarks... Done Face descriptor... Done Face landmarks... Done Face descriptor... Done Face landmarks... Done Face descriptor... Done Face landmarks... Done Face descriptor... Done Face landmarks... Done Face descriptor... Done Face landmarks... Done Face descriptor... Done
-
How is PDlib installed: Make sure it is working correctly with this tool
-
PHP version: 7.4
-
Web server: apache2
-
Nextcloud version: 23.0.0
Logs
Background task log with debug.
sudo -u apache php occ -vvv face:background_job
1/10 - Executing task CheckRequirementsTask (Check all requirements)
System: Linux
System memory: 8344412160
PHP Memory Limit: 4294967296
There are inconsistencies between the configured image area (4194000 pixels^2) which is
greater that the maximum allowed by the model (0 pixels^2).
Please check and fix it in the admin panel to continue.
Fill an issue here if that doesn't help: https://github.com/matiasdelellis/facerecognition/issues
Task CheckRequirementsTask signalled we should not continue, bailing out
Hi @BurningTheSky Thanks for the report!. . Among the last changes, I had to add a new configuration, which unfortunately absolutely all users have to do... This new configuration is simply telling the process exactly how much memory you want to assign to the process..
This is annoying, I know, but it avoids many doubts and explanations later.
A big improvement is that now only have to configure the memory_limit
parameter for the php command line, and it is not necessary to change for the php server (Before you had to increase it unnecessarily, just to show it in the admin panel) and you can leave it at a reasonable value like 1GB or just 128M.
[matias@nube nextcloud]$ free -h
total used free shared buff/cache available
Mem: 7,2Gi 1,7Gi 3,2Gi 261Mi 2,3Gi 4,9Gi
Swap: 7,2Gi 258Mi 6,9Gi
[matias@nube nextcloud]$ cat /etc/php.ini | grep memory_limit
memory_limit = -1
[matias@nube nextcloud]$ php -i | grep "memory_limit"
memory_limit => -1 => -1
[matias@nube nextcloud]$ sudo -u apache php occ face:setup --memory 4GB
[sudo] password for matias:
System memory: 7.2 GB (7726276608B)
Memory assigned to PHP: Unlimited
Minimum value to assign to image processing.: 682.7 MB (715827882B)
Maximum value to assign to image processing.: 4.8 GB (5150851072B)
Maximum memory assigned for image processing: 4 GB (4294967296B)
In my case, I have almost 8 GB of ram, I set PHP command line as unlimited, and I assigned 4GB of ram to image processing..
I leave the report open for a while, since other users will find the same problem.. :wink:
Thanks again.
Ah, great, thanks @matiasdelellis! I'll drop the PHP levels down and run the command!
I run command sudo -u www-data php occ face:setup --memory 45GB
return: Segmentation fault
Hi @leonardohlee It's is an bug in Nextcloud Backup application. If you don't use it, just disable it!. See #545 and https://github.com/nextcloud/backup/issues/116
EDIT: haha.. Thank leonardohlee!!! I am commenting on a comment of yours, with another comment of yours!.
sudo -u www-data php occ face:setup --memory 45GB
if I understand right, I'm missing a php module?
sudo -u nextcloud php occ face:setup --memory 10GB
An unhandled exception has been thrown:
OC\HintException: [0]: Memcache \OC\Memcache\APCu not available for local cache (Is the matching PHP module installed and enabled?)
Had the same - missing from documentation how to set to match requirements:
- the model type
- maximum memory Thanks!
Weird thing is happening. I'm trying to increase the memory assign to image processing, but I am unable to do it.
[ftrentini@homerbuntu]$:/usr/share/nginx/nextcloud# sudo -u www-data php occ face:setup -M16GB
System memory: 41.2 GB (44287426560B)
Memory assigned to PHP: Unlimited
Minimum value to assign to image processing.: 682.7 MB (715827882B)
Maximum value to assign to image processing.: 8 GB (8589934592B)
Cannot assign more memory than the maximum...
I am trying to increase the memory because I received this error when clustering:
9/10 - Executing task CreateClustersTask (Create new persons or update existing persons)
Face clustering will be created for the first time.
150122 faces found for clustering
PHP Fatal error: Allowed memory size of 8589934592 bytes exhausted (tried to allocate 1073741832 bytes) in /usr/share/nginx/nextcloud/apps/facerecognition/lib/BackgroundJob/Tasks/CreateClustersTask.php on line 298
I found a workaround. I changed the php.ini variable memory_limit = -1 to 16G. And then, I was able to assign 16GB to image processing.
Minimum value to assign to image processing.: 682.7 MB (715827882B)
There is one more issue when assigning memory: It is not possible to assign less than 682MB, but the recommended value for model 3 is 128MB!
Hi @zimj0 You're right!. I have to review that.. But put 682MB, this is just an allocation suggestion, but the model will never use more than 100MB
Leave it open until see that.. Thanks.
Hi @matiasdelellis, same problem here with the minimum amount of RAM, but the command says the maximum amount of RAM that can be assigned in my case is 646 MB, so I can't configure the memory at all.
$ occ face:setup -M 690M
System memory: 968.9 MB (1016012800B)
Memory assigned to PHP: Unlimited
Minimum value to assign to image processing.: 682.7 MB (715827882B)
Maximum value to assign to image processing.: 646 MB (677341866B)
Cannot assign more memory than the maximum...
$ free -m
total used free shared buff/cache available
Mem: 968 428 127 27 413 369
Swap: 3989 89 3900
I just hacked the MemoryLimits.php
(and also the requirements in the models) to see how it goes. The Recognize app says it needs minimum 4G but the face recognition is working fine with 1G, it swaps a bit from time to time, but it works OK(ish, it's not recognizing a hell lot of faces, not sure if it is because of the low memory, I've read here that using more memory can improve results, or if it's just not that good, this is why I'm trying out this one).
Some extra notes, after hacking the limits in lib/Service/SettingsService.php
too, I was able to run the background_job
with 725M set as memory. As you can see above, I have quite a bit of swap and it is swapping a bit, but it's not that bad and it seems to be working. Measuring just quickly, it seems to be taking 40s per photo aprox (the web interface says: "Analyzing images - 5350 images detected - 5316 images in queue - Ends approximately in 2 days", so about 32s per photo.
I'm running this on a very cheap shared VPS instance, only one vCPU, 1GB RAM total, with good old spinning HDs (but in RAID60), so swapping is not particularly fast.
/proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 62
model name : Intel(R) Xeon(R) CPU E5-2430L v2 @ 2.40GHz
stepping : 4
microcode : 0x1
cpu MHz : 2394.230
cache size : 16384 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm pti ssbd ibrs ibpb stibp fsgsbase tsc_adjust smep erms xsaveopt arat md_clear
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit mmio_unknown
bogomips : 4788.46
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
Having all this in mind, I think it would be good if there were not so many blockers to run this on less than 1G, IMHO this should be something that users should be able to try out and decide for themselves if they want to give it a try and if it works for them. Maybe adding some hidden option like avoid_mem_checks
that will just let the user configure whatever memory they want and ignore minimum memory checks?
I created a separate issue for this (#653), as it is really a separate issue.