Ranking Photos With Python

Spread the love

Photo Ranking With Python

screenshot.jpg

What is this?

This is a tool that uses the Elo Ranking System written in Python using:

  1. Matplotlib
  2. Numpy
  3. exifread

Features:

  • Auto image rotation that the camera recored in the EXIF meta data
  • Persistent state from execution to execution so you can pickup where you left off
  • New photos that are added to the photo dir after initial ranking are picked up

Install dependencies

Use your system’s package manager to install Matplotlib & Numpy if you don’t already have them installed.

Next, you can use pip to install the EXIF image reader package exifread:

How to rank photos

Once you have to dependencies installed, run rank_photos.py on the command line passing it the directory of photos.

For example, iterate over all photos three times:

After the number of rounds complete, ranked.txt is written into the photo dir.

Ranking work is cached

After completing N rounds of ranking, a file called ranking_table.json is written into the photo dir. The next timerank_photos.py is executed with the photo dir, this table is read in and ranking can continue where you left off.

You can also add new photos the the directory and they will get added to the ranked list even though they weren’t included previously.

Example

Suppose there is a dir containing some photos:

These photos haven’t been ranked yet, so lets rank them, in this example, 1 round:

Once the number of rounds complete, the ranked list is dumped to the console:

The ranked list is also written to the file ranked.txt. The raw data is cached to the file ranking_table.json:

If you run the program again, the cached data is loaded and new match ups can be continued using the cached data. If new photos were added, they also get added to the table data and are included in match ups.

The code has been posted to github.

This entry was posted in computing, programming. Bookmark the permalink.