Bug 405980 - The area of a "face rectangle" in the picture is different than the face thumbnail.
Summary: The area of a "face rectangle" in the picture is different than the face thum...
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Faces-Workflow (other bugs)
Version First Reported In: 7.0.0
Platform: Appimage Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-29 05:14 UTC by MarcP
Modified: 2020-04-28 21:07 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 7.0.0
Sentry Crash Report:


Attachments
Thumbnail does not correspond to face rectangle (469.39 KB, image/jpeg)
2019-03-29 16:44 UTC, MarcP
Details
Screen capture, no bug seen. (862.34 KB, image/png)
2020-01-02 11:10 UTC, Alexandre Belz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description MarcP 2019-03-29 05:14:17 UTC
SUMMARY

I thought it was the same as Bug #372340, but I think it's a related issue, or maybe a remnant. In this case, the face rectangle in the picture is correctly positioned and frames the person's face correctly. However, the "face thumbnail" shown in the list is from another area of the picture (e.g. a piece of sky). It's likely the same area that was previously framed as a face rectangle in that bug.

They all seem to be vertical pictures, so the problem is likely related to how the image is rotated. It only happens in some cases though, and I've narrowed it down to pictures taken with an Iphone SE and a Sony ILCE-5000. These are likely the same pictures which had a problem with the previous bug.

I have experienced this issue in digikam-6.1.0-git-20190325T162715 appimage under Ubuntu 18.04 with the default Gnome desktop environment.
Comment 1 Maik Qualmann 2019-03-29 05:34:29 UTC
Were the wrong-posed facial rectangles detected by the facial engine or were they set manually? The facial engine times clouds or other objects in the image as a face recognizes is quite normal, these must be rejected only. I can not reproduce other problems. Otherwise upload a image with which the problem occurs.

Maik
Comment 2 Maik Qualmann 2019-03-29 05:39:00 UTC
It could also be related to this problem:

https://cgit.kde.org/digikam.git/commit/?id=fa288e9e281e28e52eff1b0f77a9bf3b42f598d6

Please use a current digiKam version.

Maik
Comment 3 Maik Qualmann 2019-03-29 06:46:45 UTC
Confirmed, the thumbnails may be from the wrong place in the image, if image only rotated by metadata flag. I fix it.

Maik
Comment 4 MarcP 2019-03-29 16:44:39 UTC
Created attachment 119118 [details]
Thumbnail does not correspond to face rectangle
Comment 5 MarcP 2019-03-29 16:46:25 UTC
You see what I mean, right? I attached a sample. Basically the thumbnail is not of the face rectangle, but from another area of the picture.

By the way, these rectangles were automatically created by a picture software, either Picasa or Digikam (I don't know for sure).
Comment 6 Maik Qualmann 2019-03-29 19:16:03 UTC
Git commit 6c0c23149dbf84d3ff9d23da8f33d3d80d13f3b0 by Maik Qualmann.
Committed on 29/03/2019 at 19:15.
Pushed by mqualmann into branch 'master'.

first step -> fix manual face thumbs and fix DImg reverse rotation

M  +33   -0    core/libs/database/tags/tagregion.cpp
M  +6    -0    core/libs/database/tags/tagregion.h
M  +2    -2    core/libs/dimg/dimg.cpp
M  +21   -44   core/utilities/facemanagement/facegroup.cpp
M  +0    -1    core/utilities/facemanagement/facegroup.h

https://commits.kde.org/digikam/6c0c23149dbf84d3ff9d23da8f33d3d80d13f3b0
Comment 7 Alexandre Belz 2019-11-06 20:46:24 UTC
I still see the issue with latest weekly build 6.4.0 when I browse my picture, with people correctly detected by Picasa but then wrongly positionned by Digikam.
Comment 8 caulier.gilles 2019-12-23 15:07:06 UTC
7.0.0-beta1 is out with new Face Recognition algorithm based on Deep
Learning/Neural Network API from OpenCV

https://download.kde.org/unstable/digikam/

Please test and give us a feedback

Thanks in advance
Gilles Caulier
Comment 9 Daniel 2020-01-02 01:20:20 UTC
(In reply to caulier.gilles from comment #8)
> 7.0.0-beta1 is out with new Face Recognition algorithm based on Deep
> Learning/Neural Network API from OpenCV
> 
> https://download.kde.org/unstable/digikam/
> 
> Please test and give us a feedback
> 
> Thanks in advance
> Gilles Caulier

With the new detection, the face thumbnail shows a bit more than the face rectangle, which is confusing if there are multiple people close to each other or a person is in one corner of the face thumbnail. Please note, that this is not exactly  the original problem by MarcP, but the title still applies.
Comment 10 Alexandre Belz 2020-01-02 11:10:42 UTC
Created attachment 124848 [details]
Screen capture, no bug seen.

Hello,

I tested the latest comment of Daniel, but I was not able to reproduce it with 7.0 Beta.

To the contrary, I get -very- close framing (the hair and the ears are excluded for instance). See attached screen capture.
Comment 11 MarcP 2020-01-02 11:13:45 UTC
I think we should keep these two issues separately. The original report deals with an incorrect face region due to the picture rotation, and now we are commenting about the zoom level in the face regions (I have personally not had a problem with that). Should we create a new bug report for the latter?
Comment 12 Alexandre Belz 2020-01-02 11:54:14 UTC
I agree, let's separate the topics.
Comment 13 Daniel 2020-01-02 12:21:45 UTC
(In reply to Alexandre Belz from comment #12)
> I agree, let's separate the topics.

I opened 415796
Comment 14 swizzly 2020-02-01 00:17:04 UTC
I can confirm the problem. I noticed that by moving or resizing the frame even only with 1 pixel in the whole image mode, and closing the image, the thumbnail in People view gets updated and shows the expected view (face is filling the thumbnail and it is centered).

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Ubuntu 18.04.3 LTS 
I use it with Gnome.

I tried followin Appimage versions and both had the issue: 
digikam-7.0.0-beta2-20200124T055125-x86-64_e936c5ff33a3bfdec899ddeafdd679c2.appimage
digikam-7.0.0-beta3-20200130T131235-x86-64_5172dc1340a9b0a9739737a600d1abad.appimage
Comment 15 swizzly 2020-02-01 09:09:57 UTC
(In reply to swizzly from comment #14)
> I can confirm the problem. I noticed that by moving or resizing the frame
> even only with 1 pixel in the whole image mode, and closing the image, the
> thumbnail in People view gets updated and shows the expected view (face is
> filling the thumbnail and it is centered).
> 
> SOFTWARE/OS VERSIONS
> Linux/KDE Plasma: Ubuntu 18.04.3 LTS 
> I use it with Gnome.
> 
> I tried followin Appimage versions and both had the issue: 
> digikam-7.0.0-beta2-20200124T055125-x86-64_e936c5ff33a3bfdec899ddeafdd679c2.
> appimage
> digikam-7.0.0-beta3-20200130T131235-x86-64_5172dc1340a9b0a9739737a600d1abad.
> appimage

BTW. I forgot to mention, I also use Sony Alpha camera, mine is A6500, and it seems that the problem only occurs with Sony's proprietary RAW image format .arw, the jpg versions of these files does not have the problem.
Comment 16 MarcP 2020-02-01 09:14:39 UTC
I think this problem has already been solved. If you re-read the metadata for the affected files, the face rectangle is positioned correctly again.

I believe this bug can be closed now.
Comment 17 swizzly 2020-02-01 09:37:39 UTC
(In reply to MarcP from comment #16)
> I think this problem has already been solved. If you re-read the metadata
> for the affected files, the face rectangle is positioned correctly again.
> 
> I believe this bug can be closed now.

Hi
Thanks, I tried it: I clicked on Menu/Item/Reread Metadata from file, it did refresh the thumbnail - it flickered - but with the exact same content, no change at all, the face is still offset.
Comment 18 MarcP 2020-02-01 09:41:47 UTC
Ah, ok. In my case, the issue was solved when Bug #372340 was closed.

Maybe you could upload a sample picture, so the devs can test it?
Comment 19 Maik Qualmann 2020-02-01 10:10:15 UTC
@swizzly, Marc has permanently activated the option to clean up the database, so it works for him with a reread of the metadata. Because this creates the face tags in the DB and a new thumbnail is created. You can temporarily activate this option to clean up the database for testing. In fact, the bug for new images should be fixed.

Maik
Comment 20 swizzly 2020-02-01 10:20:37 UTC
(In reply to MarcP from comment #18)
> Ah, ok. In my case, the issue was solved when Bug #372340 was closed.
> 
> Maybe you could upload a sample picture, so the devs can test it?

Hi
I uploaded an a sample image and a screenshot of the thumbnails here - it was too large to upload directly to the forum: https://we.tl/t-cl1vFua89U 
The download link is alive for 7 days.
The sample photo was taken with Sony A6500 in Sony's proprietary RAW .arw format. Shot in 90 degrees rotated camera position. The two faces are detected and framed correctly in the full view, but the thumbnails under People view are with an offset - it shows not even part of the faces but the shoulder and the arm.
Comment 21 swizzly 2020-02-01 10:24:52 UTC
(In reply to Maik Qualmann from comment #19)
> @swizzly, Marc has permanently activated the option to clean up the
> database, so it works for him with a reread of the metadata. Because this
> creates the face tags in the DB and a new thumbnail is created. You can
> temporarily activate this option to clean up the database for testing. In
> fact, the bug for new images should be fixed.
> 
> Maik

@Maik
How can I temporarily activate this option. Is it under Menu/Tools/Maintenance/Perform database cleaning/Also cleanup the faces database?
Comment 22 swizzly 2020-02-01 10:36:14 UTC
(In reply to swizzly from comment #21)
> (In reply to Maik Qualmann from comment #19)
> > @swizzly, Marc has permanently activated the option to clean up the
> > database, so it works for him with a reread of the metadata. Because this
> > creates the face tags in the DB and a new thumbnail is created. You can
> > temporarily activate this option to clean up the database for testing. In
> > fact, the bug for new images should be fixed.
> > 
> > Maik
> 
> @Maik
> How can I temporarily activate this option. Is it under
> Menu/Tools/Maintenance/Perform database cleaning/Also cleanup the faces
> database?

this one helped, but not immediately. I removed all faces from the specific folder, cleaned up the DB, regenarated the thumbs. Then I let face detection run on the specific folder. The face thumbnails were still false, then I clicked on the reread metadata and only after this were the faces thumbnails corrected.
Comment 23 Maik Qualmann 2020-02-01 18:23:04 UTC
Git commit 6d307ee597c33823b5831acbdb237f9e55bcd41b by Maik Qualmann.
Committed on 01/02/2020 at 18:22.
Pushed by mqualmann into branch 'master'.

view of half a RAW preview is always rotated

M  +4    -1    core/utilities/facemanagement/items/facegroup.cpp

https://invent.kde.org/kde/digikam/commit/6d307ee597c33823b5831acbdb237f9e55bcd41b