skip to the main content
2023-03-14

Local Image Search

I think there is a fair amount of legitimate use cases for local image search applications. Mine is a bit frivolous, but I could see myself rebuilding this project from scratch to fill the need of a more serious application.

I like to paint, is my hobby. So I started using google/DDG image search to find motives, because that should be easy. Turns out, these results are not great for this.

For example most landscape photos on google look like postcards that were edited within an inch of their lives with the saturation blown up the absolute minimum and often HDR applied. What I am looking for is scenes that are somewhat unremarkable, so that I can find my own way to project contrast and mood into the greyness of an average street, because that is what makes paintings good.

Anyway…

Goal: Build a collection of useful, well-organized reference images for my painting hobby

Steps:

  1. Manually download useful images.
    For example, if i go trough the trouble to build a search query that gives decent results once, I want to download a bunch of pictures once.
  2. Manually put them in a folder structure that makes some amount of sense
  3. Run a program to index the files and classify them properly
  4. Have a UI that queries the index to find pictures I am looking for right now.

I got it to run well enough to be useful.

  • Used a very mediocre pretrained python image classification model to come up with a list of words that describe the image, which will be used as tags
  • Rewrote some of the output with words that make more sense.
  • Used the folder and filename to create additional tags (entered by me).
  • Stored the tags inside the image as some weird EXIF thing that only exiftool seems to be able to r/w, but at least they are safe to sync into my cloud.
  • Indexed the files and their metadata contents into an SQLite DB, whipped up a web ui that runs the search. Spaces act as an AND operator between the search terms.

I recently tested using ChatGPT to classify. That works really well but is an expensive operation in token count.

Future Ideas:

  • Test how small I can scale the image for some sort of state-of-the-art ai to still recognize the contents reasonably, check the cost
  • Native UI? Consider making this into a full-fledged tag based file system of some kind.
  • Fuzzy search