-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crashes with TypeError: OCA\FaceRecognition\Helper\Euclidean::distance(): Argument #1 ($vector1) must be of type array, string given, called in #780
Comments
Hello, I get the same behaviour When launching :
but when launching again
The first time I had installed Face recognation it has worked, but after changing the setting on the face detection in NC interface and perform a reset it does not works anymore? Any idea why? |
PS : I initialy test it with a higher number of picture (more than 20 000 picture) but for the last test I perform it on a small number :-) |
hi, the same (i tried it maybe a year ago and it was working) tried external model installed on wsl2 and through Nextcloud AIO (Computing container for facerecognition container) too. Nextcloud AIO v9.7.0
|
I can confirm this Bug also. It is a WorkArround to manuel convert the json_string to an array. I don´t know if this is a Problem with PHP. I use PHP8.2 and run it on a RPI4 with ARM64-CPU. for me it work to edit the CreateClusterTaks.php on Line 311
I hope this help temporaly... |
If related to php I am using php8.3 |
@Oski19831 thanks your workaroud seem's to works for me ! |
Heck yes! Maybe submit a Pull Request for this? |
I never wrote Code for NC. So i think it is better Solution to change Code in DB-Object. But i don´t know the relation between NC and Entity - Class in NC. I think this Code is better in /lib/Db/Face.php. Or a function there... and call the function in CreateClusterTask.php ... But if it is helfull for you i will change the code... |
Same issue here. Noticed Face Recognition was hung at Analyzing images - 31779 images detected - 339 images in queue - Ends approximately in 26 minutes. went to CLI and executed the following:
|
Same here. $faces returns a String instead of an array. So for WorkArround add a function in /lib/Db/Face.php and change each $face1['descriptor'] and $face2['descriptor'] to $face1->getDescriptorArray() and $face2->getDescriptorArray() in /lib/BackgroundJob/Tasks/CreateClusterTask.php Or change my Solution above to your Code in CreateClusterTask.php This is my Solutiion for this Issue. This schould work as WorkArround or Wait until the Issue is fixed... I hope i could help you. |
Probably related I've got this error:
|
Hi sorry but I not know what to do ... I add function to lib/Db/Face.php
But not know what do you mean change each $face1['descriptor'] and $face2['descriptor'] to $face1->getDescriptorArray() as I don't see $face1['descriptor'] in file:
Can you attach corrected files ? |
hello @mrmipo . change $face1->descriptor to $face1->getDescriptorArray(). that should call the function in Class Face.php and returned an array and not the String from the DB. Try it. EDIT: And you don´t proof again in CreateTaskCluster.php if $facex->descriptor is an array. you proof it also in the function getDescriptorArray() in Face.php. For you the WorkArround ist like the Same. You get the TimeString instead a DateTime-Object. So it must be converted before call getTimestamp(). |
I did it this way: #781 (comment) |
Hi Oski19831 Ok I finally fix this issue and it's look like no it's working fine (manage new image/face and creating clustering) but without getDescriptorArray() as I was not able to understand how it's should be done. But I use your solution from beginning and from issue that I create. So I only modify one file CreateClustersTask.php . Output from diff:
Really thanks for your help |
Top no thanks. I test a modification which is easyer... i post an update if it pass the test.... |
it is also enough to change /lib/Db/face.php and add two Lines in function __construct() public function __construct() {
$this->addType('id', 'integer');
$this->addType('image', 'integer');
$this->addType('person', 'integer');
$this->addType('isGroupable', 'bool');
//This Lines fix the Isue
$this->addType('descriptor', 'json');
$this->addType('creationTime', 'datetime');
} Then nothing else is to do. Testet on NC HUB 8 (29.0.8) |
I had the same issue and can confirm that this solution by @Oski19831 works for me as well - thanks :) |
Hi everyone, As I said, I couldn't reproduce this problem in my installations or in testing. However, I am trying the fix suggested by Oski19831, and in my case it does not cause any problems. Here I leave you a tarball with all the changes introduced for nexctloud 30 and still compatible with nc29 plus this patch. If you test it and confirm that it works, I will add it and release the update this week.. 😉 |
I already had the change #780 (comment) on nc29 but installing the tar.gz did not seem to have broken anything. |
I can confirm that this Version run on NC 29. After installation i reseted all Photos in my Instance and rescan and all runs fine. |
Here is an error with the updated release in this attachment that showed up in my instance this morning:
|
Hi @priyankub. This error is not related to this App it think. Nextcloud cannot load the Data of one of your pictures and it retrunted null. you can proof against null and return null. But i don´t know what does it with the response. But you can try it with a Line in 129 in /var/www/html/custom_apps/facerecognition/lib/Controller/FaceController.php |
I rewrote that entire function to:
|
Hey, Thanks for reporting issues back to Nextcloud Face Recognition. Please, try to complete this report in detail so we can help you easier. 😄
Make sure you read all the documentation, and the FAQ, and that the issue has not been reported before. 😉
Expected behaviour
when running:
php occ face:background_job --cluster-mode
It starts clustering and then crashes:
1/3 - Executing task CheckRequirementsTask (Check all requirements)
2/3 - Executing task CheckCronTask (Check that service is started from either cron or from command)
3/3 - Executing task CreateClustersTask (Create new persons or update existing persons)
Face clustering will be created for the first time.
There are 47 faces for clustering
An unhandled exception has been thrown:
Actual behaviour
Crashes with error:
42b5095134e3:/var/www/html$ php occ face:background_job --cluster-mode
1/3 - Executing task CheckRequirementsTask (Check all requirements)
2/3 - Executing task CheckCronTask (Check that service is started from either cron or from command)
3/3 - Executing task CreateClustersTask (Create new persons or update existing persons)
Face clustering will be created for the first time.
There are 47 faces for clustering
An unhandled exception has been thrown:
TypeError: OCA\FaceRecognition\Helper\Euclidean::distance(): Argument #1 ($vector1) must be of type array, string given, called in /var/www/html/custom_apps/facerecognition/lib/BackgroundJob/Tasks/CreateClustersTask.php on line 336 and defined in /var/www/html/custom_apps/facerecognition/lib/Helper/Euclidean.php:24
Stack trace:
#0 /var/www/html/custom_apps/facerecognition/lib/BackgroundJob/Tasks/CreateClustersTask.php(336): OCA\FaceRecognition\Helper\Euclidean::distance('[-0.08935702592...', '[-0.08935702592...')
#1 /var/www/html/custom_apps/facerecognition/lib/BackgroundJob/Tasks/CreateClustersTask.php(177): OCA\FaceRecognition\BackgroundJob\Tasks\CreateClustersTask->getNewClusters(Array)
#2 /var/www/html/custom_apps/facerecognition/lib/BackgroundJob/Tasks/CreateClustersTask.php(90): OCA\FaceRecognition\BackgroundJob\Tasks\CreateClustersTask->createClusterIfNeeded('admin')
#3 /var/www/html/custom_apps/facerecognition/lib/BackgroundJob/BackgroundService.php(150): OCA\FaceRecognition\BackgroundJob\Tasks\CreateClustersTask->execute(Object(OCA\FaceRecognition\BackgroundJob\FaceRecognitionContext))
#4 /var/www/html/custom_apps/facerecognition/lib/Command/BackgroundCommand.php(192): OCA\FaceRecognition\BackgroundJob\BackgroundService->execute(0, false, NULL, NULL, 'cluster-mode')
#5 /var/www/html/3rdparty/symfony/console/Command/Command.php(298): OCA\FaceRecognition\Command\BackgroundCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /var/www/html/3rdparty/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /var/www/html/3rdparty/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand(Object(OCA\FaceRecognition\Command\BackgroundCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /var/www/html/3rdparty/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /var/www/html/lib/private/Console/Application.php(213): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /var/www/html/console.php(102): OC\Console\Application->run()
#11 /var/www/html/occ(11): require_once('/var/www/html/c...')
#12 {main}42b5095134e3:/var/www/html$
Server configuration
docker setup with external container
Pdlib version:
How is DLib installed: Make sure it is working correctly with this tool
docker setup with external container
How is PDlib installed: Make sure it is working correctly with this tool
PHP version:
Web server:
Database:
Nextcloud version:
29.0.8
Client configuration
Chrome
Docker under Proxmox
Logs
Background task log with debug.
sudo -u apache php occ -vvv face:background_job
Web server error log
Web server error log
Nextcloud log (data/nextcloud.log)
Nextcloud log
Browser log
Browser log
The text was updated successfully, but these errors were encountered: