A little Python application to auto tag your photos with the power of machine learning.
Report a bug or request a feature
This repository is tested on Python 3.7+ and PyTorch LTS 1.8.2.
You should install Tag Machine in a virtual environment. If you're unfamiliar with Python virtual environments, check out the user guide. First, create a virtual environment with the version of Python you're going to use and activate it.
Then, you will need to install PyTorch. Please refer to PyTorch installation page regarding the specific install command for your platform.
When PyTorch is installed, 🤗 Transformers can be installed using pip as follows:
pip install transformers
You can refer to the repository of 🤗 Transformers for more information.
Then you will need to install PySide6, a port of QT for Python used for the graphic interface. It can be installed using pip as follows:
pip install pyside6
Finally you will need to install IPTCInfo3 to allow Tag Machine to write tags in your images. It can be installed using pip as follows:
pip install iptcinfo3
Follow the instructions above then clone the repo (git clone https:://github.com/torresflo/Tag-Machine.git
). You can now run main.py
.
Press the button Load files...
to load your images then press the button Classify images
to start the classifier. Depending on your machine hardware and the number of images this can take some (and eventually a lot of) time.
The results are loaded in a table below so you can see which tags are detected for each image.
If you are satisfied with the results, you can then press the button Write tags in images
to write the found tags in the metadata of the image (IPTC, IIM Application 2, Keywords). Each tag is appended to the existing ones and will not be written if it already exists.
Here are some examples with results. You can find these images in the folder Photos
. All images come from the Wikimedia Commons website.
Note that the detection uses the labels computed by the PhotoPrism project. It allows to regroup similar tags in more generic categories and discard non useful ones. Also, a threshold is also calculated to avoid wrong tagging.
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the GNU General Public License v3.0. See LICENSE
for more information.