nextcloud / recognize

👁 👂 Smart media tagging for Nextcloud: recognizes faces, objects, landscapes, music genres
https://apps.nextcloud.com/apps/recognize
GNU Affero General Public License v3.0
543 stars 45 forks source link

People list rendering is slow (Also when merging) #523

Open PriceChild opened 1 year ago

PriceChild commented 1 year ago

Describe the bug

Every time I load https://nextcloud/apps/photos/faces the list of people seems to be dynamically loaded.

My full collection hasn't completed scanning but there's at least a thousand detected people so far, many of whom I need to merge.

This is causing two annoying problems:

  1. The list populates slowly, jumping around as it goes.
  2. Huge CPU usage on the client rendering the thing.

I can see a couple of requests for each person, e.g. https://nextcloud/remote.php/dav/recognize/pricey/faces/519/ & https://nextcloud/apps/photos/api/v1/preview/12067?x=512&y=512 but the response times suggest most of the time is not spent waiting for these. e.g. they're sequential & a second apart, but only taking milliseconds for a response, indicating other processing time between?

If you continue to navigate within the same tab and maintain the session, subsequent pages (e.g. navigating in and out of people) don't seem to need the people list to be processed again. Annoyingly I seem to be then hitting a different bug sometimes where the people list just doesn't appear when choosing e.g. "Merge with another person" and I have to hit reload...

To Reproduce Steps to reproduce the behavior:

  1. Go to https://nextcloud/apps/photos/faces or open a person and choose the three dots and "merge with another person".
  2. Wait...

Expected behavior

Recognize (please complete the following information):

Server (please complete the following information):

Additional context Add any other context about the problem here.

marcelklehr commented 1 year ago

This should be fixed in v25.0.2

elpraga commented 1 year ago

I'm afraid there is no noticeable change. I‌'ve just updated to 25.0.2RC2 just to try this feature and I‌ cannot see any improvement.

It takes 9 minutes and 25 sec on my computer to show the faces (and interact, open a person's folder). One of the CPU‌ cores is maxed out the whole time.

Merging does not work at all, it just says "Merge person" on the top, but no bubbles to merge with are shown (not even after an hour of waiting ).

I'm running the server on an RPi 4 with 8GB of RAM, and I‌ do have quite a few photos, but a similar app ("Face Recognition") works like a charm on the same setup. (provided that I‌ had to compile the libs myself first)

I‌s there any chance of a real improvement that would make the app usable? I love the way it is integrated into Photos (in a much more seamless way than Face Recognition).

elpraga commented 1 year ago

BTW, tags within the Photos app are loaded much more quickly, there are also many on the same set of photos. (I have no clue if this detail is useful or not, I‌ added it just in case.)

marcelklehr commented 1 year ago

I‌'ve just updated to 25.0.2RC2 just to try this feature and I‌ cannot see any improvement.

Mmmh. Then maybe the backports didn't happen and the fix is only scheduled for 26 so far. I'll look into it

marcelklehr commented 1 year ago

Indeed, I only just created the backport PR: https://github.com/nextcloud/photos/pull/1523 It will then be in v25.0.3

elpraga commented 1 year ago

Is there a way to update the Photos app manually on 25.0.2 ?

I'm sorry, I'm not an expert, I couldn't understand how to do it by reading the PR.

Having this app working would be great and I could also test if merging works in the updated version.

marcelklehr commented 1 year ago

you can install the photos app manually by running the following steps

  1. install git and node.js and composer
  2. cd nextcloud/apps/
  3. git clone https://github.com/nextcloud/photos
  4. cd photos
  5. git checkout enh/stable25-lazy-load-faces
  6. composer install
  7. npm ci
  8. npm run build
elpraga commented 1 year ago

Thank you @marcelklehr ! I've not been able to try it yet, but I have discovered the "Memories" app that can also work with the data from Recognize (and it is usable ATM).

When I merged many people using Memories, "People" in the Photos app does not take so incredibly long to load.

Nonetheless, the two apps do not share the exact same photos, and when I try to merge using the Photos app, it is not working. (the screen just dims, no people to choose from are shown to merge with)

Is this behaviour also going to be fixed in 25.0.3 or does this behaviour need to be reported separately?

marcelklehr commented 1 year ago

Is this behaviour also going to be fixed in 25.0.3 or does this behaviour need to be reported separately?

Yep, it's fixed :)

pjrobertson commented 1 year ago

This still appears to be a problem for me, running:

Nextcloud: 27.0.2 Photos: 2.3.0 Recognize: 4.3.2

Loading the 'People' section in Photos takes about 10 minutes to load all the images. Happy to give someone access to debug if need be.

danotrampus commented 11 months ago

I have the same issue. When i try to load https://example.com/apps/photos/faces the server takes 3 minutes approximately to respond correctly. I have 57 faces with a total of 30k images associated.

Nextcloud: 27.1.1 Photos: 2.3.0 Recognize: 5.0.1 MySQL: 8.0.34

One thing that i found is that the server used almost 50% of the CPU in those 3 minutes, in order to process the request:

image

What can i do to help resolve this issue?

marcelklehr commented 11 months ago

@pjrobertson I would be happy to debug a little on your instance, feel free to send credentials via email (address is on my gh profile)

MCMic commented 11 months ago

Same here, Nextcloud 27.0.2, Recognize 5.0.1, the list is really slow to load, even the count of pictures for each face, which I’d expect to show immediatly is slow. I’m wondering if it’s not a problem related to having lots of parallel requests at the same time. But what’s weird to me is that when reloading it’s slow again while I’d expect the browser to have the pictures in the cache and not refetch them.

Nairolf76 commented 7 months ago

NC AIO VM v7.12.1 Memories v6.2.2 Preview Generator v5.4.0 Recognize v5.0.3

Very slow to load all the faces, then when I click on a recognized face and want to merge it to an existant one, it takes a long time to generate the list of existant faces (it's reloading the full list every times, it does not seem to cache) and then a long time to show again the list of faces, etc.

PeggyFree commented 5 months ago

Hello, same problem here. 30s to display the people list, then 30s to display any one, then 15s just to display the people list during a merging operation, then 30s again to go back to the people list, and so on. I have 10k photos. Another user have 1k photos, the people feature is pretty responsive for him. The rest of the app is smooth for all users. I installed Recognize with its latest version in february, it is a fresh install of Recognize on Nextcloud V28.

Nextcloud Docker 28.0.5 Recognize 6.1.1 Preview Generator 5.5.0

Ryzen 5600G / SSD / 10Gb dedicated DDR4 for Nextcloud