An open API service indexing awesome lists of open source software.

https://github.com/torresflo/Tag-Machine

A little Python application to auto tag your photos with the power of machine learning.
https://github.com/torresflo/Tag-Machine

auto-tagging computer-vision image-classification image-tagger image-tagging image-to-text machine-learning photo-tag photo-tagging pretrained-models python pytorch pytorch-transformers

Last synced: 2 months ago
JSON representation

A little Python application to auto tag your photos with the power of machine learning.

Awesome Lists containing this project

README

        

![GitHub license](https://img.shields.io/github/license/torresflo/Tag-Machine.svg)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](http://makeapullrequest.com)
![GitHub contributors](https://img.shields.io/github/contributors/torresflo/Tag-Machine.svg)
![GitHub issues](https://img.shields.io/github/issues/torresflo/Tag-Machine.svg)


Tag Machine


A little Python application to auto tag your photos with the power of machine learning.


Report a bug or request a feature

## Table of Contents

* [Getting Started](#getting-started)
* [Prerequisites and dependencies](#prerequisites-and-dependencies)
* [Installation](#installation)
* [Usage](#usage)
* [Examples](#examples)
* [Contributing](#contributing)
* [License](#license)

## Getting Started

### Prerequisites and dependencies

This repository is tested on Python 3.7+ and PyTorch LTS 1.8.2.

You should install Tag Machine in a [virtual environment](https://docs.python.org/3/library/venv.html). If you're unfamiliar with Python virtual environments, check out the [user guide](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/).
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](https://pytorch.org/get-started/locally/#start-locally) regarding the specific install command for your platform.

When PyTorch is installed, 🤗 Transformers can be installed using pip as follows:

```bash
pip install transformers
```

You can refer to the repository of [🤗 Transformers](https://github.com/huggingface/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:

```bash
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:

```bash
pip install iptcinfo3
```

### Installation

Follow the instructions above then clone the repo (`git clone https:://github.com/torresflo/Tag-Machine.git`). You can now run `main.py`.

## Usage

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.

![Example image](https://github.com/torresflo/Tag-Machine/blob/main/Photos/Example1.png)

## Examples

Here are some examples with results. You can find these images in the folder `Photos`. All images come from the [Wikimedia Commons](https://commons.wikimedia.org/) website.

Note that the detection uses the labels computed by the [PhotoPrism](https://github.com/photoprism/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.

| Image | Tags found | Probability |
| ------------------------------------------------------------------------------------------ | ------------------------------ | ----------- |
| | tower, architecture | 97,98% |
| | Nothing | --,--% |
| | dining | 87,52% |
| | alpine, landscape, mountain | 66,37% |
| | Nothing | --,--% |
| | shark, water, fish, animal | 76,77% |
| | Nothing | --,--% |
| | castle, historic, architecture | 99,64% |
| | castle, historic, architecture | 98,44% |

## Contributing

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**.

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

## License

Distributed under the GNU General Public License v3.0. See `LICENSE` for more information.