Automatically Tagging Wallpapers with CLIP
Lately, I’ve been organising the images I use as wallpapers on my computer, most of which I source from r/wallpapers.
A recurring problem was that many filenames were completely non-descriptive things like 2r3tpqp15vt41.jpg
, making it tricky to sort or browse through them.
To attempt at sorting them, I used CLIP, an image-text model, to automatically generate descriptive tags and append them to filenames. Not perfect, but gets the job done.
The script is simple: provide a directory of images, and the script adds the top k
predicted tags (default 1) to each filename. You can find the code here.
For example, with a folder ./figs
containing several images, you can run:
python tag_wallpapers.py ./figs/ --top-k 1
After running the script, an image of Budapest that was previously named Budapest.jpg
is now renamed to Budapest_city.jpg
:
Simple, but maybe useful.