Skip to content

A python program that uses Amazon Rekognition (with boto3) to get labels for pictures and recognizes faces.

Notifications You must be signed in to change notification settings

lazee486/tag-my-picture

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

tag-my-picture

A python program that uses Amazon Rekognition and Amazon Translate (with boto3) to get labels for pictures and recognizes faces.
Explore the docs »

· Report Bug · Request Feature

Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgements

About The Project

I used to store my photos at Google Photos. But recently I switched to PhotoPrism. It is under heavy development, but I missed two things at the moment:

  • PhotoPrism adds labels to every picture like "sunset" or "tree", but they are only in English.
  • PhotoPrism has no face recognition like Google Photos. But when i.e. I add a picture of my kids I want to get it automatically tagged with their names, so I can search for it.

Until PhotoPrism will add the features to the core program, I wrote a little program to add that functionality. It will of course work without PhotoPrism and with every picture library which reads exif date. The information I add to my pictures is stored in the keywords of the exif data.

Tag-my-picture integrates in my workflow:

  • Pictures I take are synchronized to a folder in my dropbox.
  • A small bash script on my home server watches this folder for changes.
  • When a new picture arrives, tag-my-picture is started.
  • Afterwards it is moved to PhotoPrism using the WebDav access.

This is my first contribution to the Open Source Community and on GitHub, so probably I did some things wrong or could do better. Please feel free to contact me and give me some advice.

Please take care! You should always keep a copy of your original pictures, because tag-my-picture changes the exif data. If something weird happens, you don't want to lose your pictures.

At the moment, tag-my-pictures is probably only useful to people, who can code in Python. It is not user friendly or working from the shell.

Built With

Getting Started

To get a local copy up and running follow these steps.

Prerequisites

Installation

  1. Clone the repo
    git clone https://github.com/streiman/tag-my-picture.git
  2. Change the variables in tag-my-pictures.py according to your paths.

Usage

You need to create two folders:

  1. One to store the faces of the people you know and want to recognize. You could for example use the folder /home/me/faces. In this folder you create subfolders for every person, for example
  • Peter
  • Paul
  • Mary
  1. A folder where faces of unknown persons are copied, like /home/me/_unknown. You can use them to create new persons in your /home/me/faces-folder or you can delete them, if they are not important to you.

And you have to tell tag-my-pictures where the pictures are stored you want to process. If you run tag-my-pictures, all files in this folder will be read, one by one. If it is a picture like jpg, it will be processed.

First AWS Rekognition will be asked for labels for this picutre. The retrieved labels are then translated to German (you could change the language in the code). Because labels are recurring in many pictures, the translation is also saved in a local file. If an English label is found there, it will be used. Otherwise Amazon Translate is asked for the translation. You can also edit this file to get better translations.

If the picture has a label "person" or "human", the picture is afterwards sent to face detection. First all faces on the picture are cropped and saved in temporary files. Then they are queried against all the faces you stored in your /home/me/faces-folder, which is stored as a so called collection at AWS Rekognition and updated at the start of the program. So you can add new people by just creating subfolders and adding pictures, everything else happens in the background.

If a face is recognized, the name of the person (the name of the subfolder where the picture is stored) is saved in the exif keywords.

Roadmap

See the open issues for a list of proposed features (and known issues).

I will try to make tag-my-picture more userfriendly.

I will also try to use different services for

  • labelling
  • translation
  • face recognition

Contributing

Feel free to make tag-my-picture better and useful for you.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Contact

Andreas - @astreim - webmail@streim.de

Project Link: https://github.com/streiman/tag-my-picture

About

A python program that uses Amazon Rekognition (with boto3) to get labels for pictures and recognizes faces.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%