Skip to content
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

TypeError: SplObjectStorage::contains(): Argument #1 ($object) must be of type object, null given in Clustering/MrdBallTre e.php:58 #740

Closed
SaschaMuehl opened this issue Mar 16, 2023 · 4 comments
Labels

Comments

@SaschaMuehl
Copy link

Which version of recognize are you using?

3.6.3

Enabled Modes

Object recognition, Face recognition, Music recognition

TensorFlow mode

WASM mode

Which Nextcloud version do you have installed?

25.0.3

Which Operating system do you have installed?

Ubuntu 20.04.5 LTS (GNU/Linux 5.4.0-144-generic x86_64)

Which Docker container are you using to run Nextcloud? (if applicable)

no docker

How much RAM does your server have?

16gb

What processor Architecture does your CPU have?

x86_64

Describe the Bug

Triying to "Clustering face detections" after recognize:classify. But it breakes down:

An unhandled exception has been thrown:
TypeError: SplObjectStorage::contains(): Argument #1 ($object) must be of type object, null given in /var/www/nextcloud/apps/recognize/lib/Clustering/MrdBallTree.php:58

relateted issues?
#676
#716

Expected Behavior

"Clustering face detections" after recognize:classify

To Reproduce

  1. "recognize:download-models" -->all
  2. 'recognize:classify` -->session broke up during scanning while scanning audio (it took 3 days)
  3. recognize:cluster-faces

Debug log

Clustering face detections for user
ClusterDebug: Retrieving face detections for user
ClusterDebug: Found 152460 unclustered detections. Calculating clusters.
An unhandled exception has been thrown:
TypeError: SplObjectStorage::contains(): Argument #1 ($object) must be of type object, null given in /var/www/nextcloud/apps/recognize/lib/Clustering/MrdBallTree.php:58
Stack trace:
#0 /var/www/nextcloud/apps/recognize/lib/Clustering/MrdBallTree.php(58): SplObjectStorage->contains()
#1 /var/www/nextcloud/apps/recognize/lib/Clustering/MrdBallTree.php(183): OCA\Recognize\Clustering\MrdBallTree->nodeDistance()
#2 /var/www/nextcloud/apps/recognize/lib/Clustering/MrdBallTree.php(214): OCA\Recognize\Clustering\MrdBallTree->findNearestNeighbors()
#3 /var/www/nextcloud/apps/recognize/lib/Clustering/MrdBallTree.php(214): OCA\Recognize\Clustering\MrdBallTree->findNearestNeighbors()
#4 /var/www/nextcloud/apps/recognize/lib/Clustering/MrdBallTree.php(215): OCA\Recognize\Clustering\MrdBallTree->findNearestNeighbors()
#5 /var/www/nextcloud/apps/recognize/lib/Clustering/MrdBallTree.php(215): OCA\Recognize\Clustering\MrdBallTree->findNearestNeighbors()
#6 /var/www/nextcloud/apps/recognize/lib/Clustering/MrdBallTree.php(215): OCA\Recognize\Clustering\MrdBallTree->findNearestNeighbors()
#7 /var/www/nextcloud/apps/recognize/lib/Clustering/MrdBallTree.php(215): OCA\Recognize\Clustering\MrdBallTree->findNearestNeighbors()
#8 /var/www/nextcloud/apps/recognize/lib/Clustering/MrdBallTree.php(214): OCA\Recognize\Clustering\MrdBallTree->findNearestNeighbors()
#9 /var/www/nextcloud/apps/recognize/lib/Clustering/MrdBallTree.php(215): OCA\Recognize\Clustering\MrdBallTree->findNearestNeighbors()
#10 /var/www/nextcloud/apps/recognize/lib/Clustering/MrdBallTree.php(215): OCA\Recognize\Clustering\MrdBallTree->findNearestNeighbors()
#11 /var/www/nextcloud/apps/recognize/lib/Clustering/MrdBallTree.php(215): OCA\Recognize\Clustering\MrdBallTree->findNearestNeighbors()
#12 /var/www/nextcloud/apps/recognize/lib/Clustering/MrdBallTree.php(215): OCA\Recognize\Clustering\MrdBallTree->findNearestNeighbors()
#13 /var/www/nextcloud/apps/recognize/lib/Clustering/MrdBallTree.php(215): OCA\Recognize\Clustering\MrdBallTree->findNearestNeighbors()
#14 /var/www/nextcloud/apps/recognize/lib/Clustering/MrdBallTree.php(215): OCA\Recognize\Clustering\MrdBallTree->findNearestNeighbors()
#15 /var/www/nextcloud/apps/recognize/lib/Clustering/MrdBallTree.php(226): OCA\Recognize\Clustering\MrdBallTree->findNearestNeighbors()
#16 /var/www/nextcloud/apps/recognize/lib/Clustering/MrdBallTree.php(226): OCA\Recognize\Clustering\MrdBallTree->findNearestNeighbors()
#17 /var/www/nextcloud/apps/recognize/lib/Clustering/MrdBallTree.php(226): OCA\Recognize\Clustering\MrdBallTree->findNearestNeighbors()
#18 /var/www/nextcloud/apps/recognize/lib/Clustering/MrdBallTree.php(226): OCA\Recognize\Clustering\MrdBallTree->findNearestNeighbors()
#19 /var/www/nextcloud/apps/recognize/lib/Clustering/MrdBallTree.php(224): OCA\Recognize\Clustering\MrdBallTree->findNearestNeighbors()
#20 /var/www/nextcloud/apps/recognize/lib/Clustering/MrdBallTree.php(224): OCA\Recognize\Clustering\MrdBallTree->findNearestNeighbors()
#21 /var/www/nextcloud/apps/recognize/lib/Clustering/MrdBallTree.php(224): OCA\Recognize\Clustering\MrdBallTree->findNearestNeighbors()
#22 /var/www/nextcloud/apps/recognize/lib/Clustering/MrdBallTree.php(269): OCA\Recognize\Clustering\MrdBallTree->findNearestNeighbors()
#23 /var/www/nextcloud/apps/recognize/lib/Clustering/MrdBallTree.php(340): OCA\Recognize\Clustering\MrdBallTree->kNearestAll()
#24 /var/www/nextcloud/apps/recognize/lib/Clustering/MstSolver.php(23): OCA\Recognize\Clustering\MrdBallTree->precalculateCoreDistances()
#25 /var/www/nextcloud/apps/recognize/lib/Clustering/HDBSCAN.php(90): OCA\Recognize\Clustering\MstSolver->__construct()
#26 /var/www/nextcloud/apps/recognize/lib/Service/FaceClusterAnalyzer.php(69): OCA\Recognize\Clustering\HDBSCAN->__construct()
#27 /var/www/nextcloud/apps/recognize/lib/Command/ClusterFaces.php(62): OCA\Recognize\Service\FaceClusterAnalyzer->calculateClusters()
#28 /var/www/nextcloud/apps/recognize/vendor/symfony/console/Command/Command.php(298): OCA\Recognize\Command\ClusterFaces->execute()
#29 /var/www/nextcloud/apps/recognize/vendor/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run()
#30 /var/www/nextcloud/apps/recognize/vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()
#31 /var/www/nextcloud/apps/recognize/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#32 /var/www/nextcloud/lib/private/Console/Application.php(213): Symfony\Component\Console\Application->run()
#33 /var/www/nextcloud/console.php(100): OC\Console\Application->run()
#34 /var/www/nextcloud/occ(11): require_once('...')
#35 {main}root@blackrip:~# ^C

@SaschaMuehl SaschaMuehl added the bug Something isn't working label Mar 16, 2023
@marcelklehr
Copy link
Member

Mh, I haven't seen that yet.

@MB-Finski Not sure what's the appropriate mitigation in the code to handle null pointers in MstSolver#findSetNeighbors

@MB-Finski
Copy link
Contributor

MB-Finski commented Mar 19, 2023

IIRC, I did come across this issue in testing but apparently I forgot to fix this. The root cause is that the underlying Rubix BallTree implementation sporadically splits branches into a null branch and a valid branch, especially when the maxLeafSize is small. As an educated guess, I'd say that this error probably stems from floating point precision issues in Labeled->spatialSplit().

Since we probably don't want to reimplement the Labeled class just due to this bug, I'd say that the next best thing is to handle this in MrdBallTree->grow(). The correct behaviour being that there should never be null nodes.

MB-Finski added a commit to MB-Finski/recognize that referenced this issue Mar 19, 2023
A possible fix for nextcloud#740.

Signed-off-by: MB-Finski <64466176+MB-Finski@users.noreply.github.com>
@Emporea Emporea mentioned this issue Mar 24, 2023
marcelklehr pushed a commit that referenced this issue Mar 31, 2023
A possible fix for #740.

Signed-off-by: MB-Finski <64466176+MB-Finski@users.noreply.github.com>
@marcelklehr
Copy link
Member

@SaschaMuehl Could you please update and check if this is fixed now?

@SaschaMuehl
Copy link
Author

@SaschaMuehl Could you please update and check if this is fixed now?

for me it works now (the recognition is still in process but there are no errors anymore). thanks for fixing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants