Bug 416018

Summary: Face detection: specified list of albums not taken into account
Product: [Applications] digikam Reporter: Nicofo <nicofo>
Component: Faces-DetectionAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: metzpinguin
Priority: NOR    
Version: 7.0.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 7.0.0
Sentry Crash Report:

Description Nicofo 2020-01-08 20:25:04 UTC
SUMMARY
When I make a Face Detection with following settings:
- in "Worklow" tab, select "Scan again and merge results" or "Clear unconfirmed results and rescan"
- in "Worklow" tab, select "Detect faces"
- in "Search in" tab, select only a few Albums (of course "Whole albums collection" is not selected)

Result:
a lot more albums (maybe the entire collection?) are actually scanned.

Notes:
1) No problem if I select "Skip images already scanned"
2) The bug is still more visible if in "Search in" I select no Album at all. Obviously the scan process should do nothing, but it's not what happens: a lot of Albums are still scanned.
3) Maybe I don't understand well what the option "Clear unconfirmed and rescan" is supposed to do, but I expected that the "Unconfirmed" people tags are cleared to be face-recognised again. This is not the case (items in "Unconfirmed" people tag are still there, unmodified)
Also this is for me confusing: when "Detect faces" is selected, I expect that the scan will only... detect faces (seems obvious). So this is not related with "Unconfirmed" people tag, related to the face recognition process.
-> is it normal ? If not I should probably open a new bug report ?
4) For a better comprehension, please use the same wording for "rescan"/"scan again" in:
- "Scan again and merge results"
- "Clear unconfirmed result and rescan"  --> replace "rescan" by "scan again" as above


SOFTWARE/OS VERSIONS
digikam-7.0.0-beta2-20200108T085258-x86-64.appimage
Comment 1 Maik Qualmann 2020-01-08 20:37:57 UTC
Check the Tag tab, you have probably also selected something there, these will be added to the search. Definitely only the albums that are selected will be scanned.

Maik
Comment 2 Nicofo 2020-01-08 20:43:59 UTC
No: same result if no tags are selected
Comment 3 Maik Qualmann 2020-01-08 21:08:02 UTC
Git commit b904cf973b004d0f483efa63c4e8f6676068e7db by Maik Qualmann.
Committed on 08/01/2020 at 21:06.
Pushed by mqualmann into branch 'master'.

disable "Clear unconfirmed results and rescan" option
Because face detection and recognition are currently deactivated

M  +10   -1    core/utilities/facemanagement/widgets/facescanwidget.cpp

https://invent.kde.org/kde/digikam/commit/b904cf973b004d0f483efa63c4e8f6676068e7db
Comment 4 Maik Qualmann 2020-01-08 21:17:37 UTC
(In reply to Nicofo from comment #2)
> No: same result if no tags are selected

We have this reported as an error several times. I have never been able to reproduce it here. Only the selected albums are scanned. I've debugged the code many times, I can't imagine digiKam making a mistake here.

Maik
Comment 5 Nicofo 2020-01-08 22:00:05 UTC
(In reply to Maik Qualmann from comment #4)
> We have this reported as an error several times. I have never been able to
> reproduce it here. Only the selected albums are scanned. I've debugged the
> code many times, I can't imagine digiKam making a mistake here.

Where is the mistake then ? ... How can I help ?

I made new tests: in "Search in":

1) No Album selected, No Tag selected -> as said before, the entire collection seems to be scanned (this is NOT as expected: I expect nothing is scanned).

2) No Album selected, One Tag selected -> only pictures tagged with that people are scanned (don't know if it is as expected, because for me Tags should not be related to face detection)
Note that I don't understand why it is possible to restrict the face detection to some face Tags ? Face detection should be made possible for specified Albums ("Search in" > "Albums" tab) but NOT for specified people ("Search in" > "Tags" tab) because this is only face detection, not face recognition. In the detection phase, you obviously do not know if it corresponds to some Tag people.

Sorry but for me the UI for face detection/recognition is very confusing (or buggy?).
Comment 6 Maik Qualmann 2020-01-09 06:58:49 UTC
1) Is an intended behavior that applies everywhere in digiKam, there is no selection, the whole collection is used. This behavior also exists in the Icon View, if no selection is made, the entire items is taken over when called up by a tool.

2) The tags are not only limited to person tags. For example, by selecting the "France" tag from a trip. This will only scan these images.

Maik
Comment 7 Maik Qualmann 2020-01-09 07:06:50 UTC
When choosing just one tag, the entire collection seems to be scanned, so I look at it.

Maik
Comment 8 Maik Qualmann 2020-01-09 17:48:50 UTC
Git commit 9d60f152e77b5201ce6bf23473684a32444bf586 by Maik Qualmann.
Committed on 09/01/2020 at 17:48.
Pushed by mqualmann into branch 'master'.

fix wrong item selection for face recognition
Related: bug 416028, bug 415782, bug 415867, bug 415895

M  +3    -1    NEWS
M  +0    -29   core/utilities/facemanagement/widgets/facescanwidget.cpp
M  +15   -0    core/utilities/maintenance/facesdetector.cpp

https://invent.kde.org/kde/digikam/commit/9d60f152e77b5201ce6bf23473684a32444bf586
Comment 9 Nicofo 2020-01-09 20:08:30 UTC
Thank you for your quick reaction and look in the code ;)
I'll test when new appimage available.

Still can you explain exactly what I need to do to scan for faces (face detection) a specific Album (and only that album) ?
- In "Search in" > Albums: I need to select the desired Album (obviously !)
- In "Search in" > Tags: what do I need to select ?
  - If I select nothing ==> (1) what will be scanned ??
(in comment #6 you say: "there is no selection, the whole collection is used"  ==> not what I want)
  - If I select everything ==> (2) what will be scanned ??
(I suppose e.g. pictures with "France" tag will be scanned, even if not part of the selected Album ? ==> not what I want)

In other words, how does digikam manage the selections in "Albums" and in "Tags" tabs ? ==> (3) Does it use an AND or an OR (pictures to be scanned must match ALL or ANY criteria) ??

Last question: is the selection made in "Search in" > "Tags" used the same way by digikam for face detection and face recognition ?
- for face detection, according to your comment #6, it is used to scan e.g. all pictures with the tag "France" (so independently of the Albums selection). ==> (4) is it correct ??
- for face recognition: I think that it will rather try to recognize only people whose people tag is selected. So different behavior as for face detection. ==> (5) is it correct ??

Can you please answer to the 5 questions above "==> (x) xx ??"
Sorry if this may be obvious for you, but I'm still a bit confused ;)
Thanks in advance
Comment 10 Maik Qualmann 2020-01-10 12:07:10 UTC
Don't make it too complicated. ((:-)) If you only want to scan an album, select it in the Album tab. You don't select anything in the Tag tab.

You can also use the right context menu in the Album view to scan just one album or image.

Maik
Comment 11 Nicofo 2020-01-12 17:18:37 UTC
Thank you, I have tested with appimage digikam-7.0.0-beta2-20200112T071518-x86-64 and no more problem.

I'll answer to myself for my questions in comment #9:
(3) If Albums AND Tags are selected in "Search in", the search is done in both Albums and Tags matching the selection (so it's an "OR").
    If ONLY Albums or Tags are selected, the search is done on the selected Albums or Tags (normal ! And no bug anymore for me)
(5) "Search in" is now disabled for face recognition. Good, less confusing if not used. Anyway could be some improvement done here: allow to select faces so that the face recognition will only recognize specific people (this just an idea, not related to this bug).

Finally, my last source of confusion is that when nothing is selected in Albums AND Tags, digikam makes the detection on the entire collection. But this is not too annoying as no one should click on "Scan collection for faces" and expect that nothing happens ;-)