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

Feature to assign faces to tags #292

Open
jonno293 opened this issue Jul 10, 2020 · 8 comments
Open

Feature to assign faces to tags #292

jonno293 opened this issue Jul 10, 2020 · 8 comments

Comments

@jonno293
Copy link

jonno293 commented Jul 10, 2020

Hello, I'm sorry if this is the wrong way to request... I'm interested in a feature for specific faces to become tags, maybe by each persons name in setting I could choose to create a corresponding tag or something or if multiple faces are in one photo to give it a tag. I love this feature so far and would love to one day be able to contribute but I'm still quite the coding noob! Thanks for yall's efforts!

jonno293


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@matiasdelellis
Copy link
Owner

Hi @jonno293

It is something that I consider, in fact there were also experiments, but it is unlikely that we use the current tag interface. 😞

At first I dismissed it for performance reasons.

However the biggest problem is that the labels are completely independent of the application. If the user adds a tag to an image, I have no way of knowing if they wanted to add a person, or just say it's personal (The NC tags just reports the raw tag, only the tag text).

On the other hand, suppose that our application labels "Matias" to a photo where I am not. if I remove the tag in the file application.

  • Our application should remove the assignment of this photo or all photos that have this tag?
  • ..and if the tag was originally added, from the same file manager? I don't know, to indicate that the photo was edited by Matias.
  • what if i want to rename the tag rather than delete?

In resume, I have no way to tell if the label refers to a person, or a simple label... and this leads to many problems of inconsistencies, user assumptions that we cannot fix, etc. 😞

@matiasdelellis
Copy link
Owner

p.s: I had forgotten about this. There is also a major problem. The tags are all shared among all users. No one can believe that tagging a person with a name, or nickname, should be shared with other users.

I.e: You label your ex in some photos, and your couple will see that you created the label. 😅 This is a major privacy error!. 😞

@matiasdelellis
Copy link
Owner

Just to make the example clear ...
This is my account with some personal photos tagged..
imagen

...and this is another account where I do some development tests (I only have photos of The big bang theory..)
imagen

@wronny
Copy link
Contributor

wronny commented Nov 10, 2020

I understand and share @matiasdelellis objections regarding "faces to tags" for large nextcloud instances with many users due to tags are defined globally. However in a small family internal nextcloud instance like I'm using where most of the photos are shared within the family "face to tag" provides very comfortable benefit of face recognition.
Therefore I will share the SQL commands I'm using to create "face to tags" capability created via sql.

Assuming you assigned the label "Max" to a face and want to create a tag "Max photos" to all photos of person "Max" identified by face recogintion. To do so you need two sql statements in your nextcloud sql db:
(NOTE:
tested on NC20. In my config.php dbtableprefix is defined as "oc_". If that is different the SQL statements needed to be adapted.
maybe you first need to select your data base instance e.g. if the data base instance is called "nextcloud":
use nextcloud;
)

  1. create a read only tag "Max photos" using:
    insert into oc_systemtag(name, visibility, editable) values('Max photos', 1, 0);
  2. assing this tag to all photos identified as person "Max" but not jet tagged with "Max photos" using:
insert into oc_systemtag_object_mapping (objectid, objecttype, systemtagid)
select distinct i.file, 'files' as 'objecttype', t.id from oc_facerecog_persons p 
join oc_facerecog_faces f on f.person = p.id 
join oc_facerecog_images i on i.id = f.image 
join oc_systemtag t on t.name = 'Max photos'
where p.name = 'Max'
and i.file not in (
  select m.objectid from oc_systemtag_object_mapping m 
  join oc_systemtag t on t.id = m.systemtagid
  where t.name = 'Max photos'
  and objecttype = 'files'
);

You can run the 2nd command as often you like to assign the tag "Max photos" to new added photos idenified as person "Max".

@marcoboers
Copy link

marcoboers commented Mar 16, 2021

The queries from @wronny worked, however I had to adjust the second query a bit to be compatible with PostgreSQL:

insert into oc_systemtag_object_mapping (objectid, objecttype, systemtagid)
select distinct i.file, 'files' as objecttype, t.id from oc_facerecog_persons p 
join oc_facerecog_faces f on f.person = p.id 
join oc_facerecog_images i on i.id = f.image 
join oc_systemtag t on t.name = 'Max photos'
where p.name = 'Max'
and i.file::varchar not in (
  select m.objectid from oc_systemtag_object_mapping m 
  join oc_systemtag t on t.id = m.systemtagid
  where t.name = 'Max photos'
  and objecttype = 'files'
);

@storm1er
Copy link

storm1er commented May 25, 2021

@storm1er
Copy link

I think this could be done using tags, even if there is a privacy issue.

It could be an option "Add tags to my people" from the settings menu.

Using the option above, it should be feasible without too much hassle, right?

matiasdelellis added a commit that referenced this issue Sep 20, 2022
Now that NC25 adds photos albums, it's a better solution than tags. Issue #292
It is still a partial solution, which I have my doubts, but it works well, and
fundamentally respects certain privacy.
@matiasdelellis
Copy link
Owner

matiasdelellis commented Sep 20, 2022

Hi all,
It's probably late, I still have some qualms about it, but since NC25 adds albums, add a command to create the albums of persons, since I think it is a better solution than the tags.

[matias@nube nextcloud]$ sudo -u apache php occ face:sync-albums -u user
[sudo] password for matias: 
Synchronizing albums for the user <user>. Done.

imagen

imagen

Edit:
p.s: The "People" tab of photos app, It has nothing to do with this application.. 😞
That's why I say it's probably late 😥 , but I'm still working on this app. 😉

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

No branches or pull requests

5 participants