Git Product home page Git Product logo

xmp-to-clustered-folders's Introduction

Take Image XMP Keywords and Get Clustered Folders of Similar Images

This notebook takes images that have had keywords embedded into each file's XMP tags (see this precursor notebook to first get keywords into XMP), runs those keywords through a k-means clustering algo, and then copies the images into subfolders that correspond to the clustering output.

This is useful to be able to split a large corpus of images into groups that can then be trained to match a given theme (think Stable Diffusion LoRAs).

Dependencies

CLI

Python Libraries (pip install)

Howto

  1. Make sure your folder of images have keywords (images that don't won't block progress)
  2. Add the folder path to the top block
  3. Optionally adjust the number of clusters. It defaults to 20, but don't be afraid to run it for a lower number, then run it again inside folders if you need more fidelity with less horsepower.
  4. Image folders go brrrt inside the main folder with the naming convention Cluster_[n].
  5. These top ten keywords found in each cluster are saved into a text file that is added to the top folder named cluster_top_keywords.txt. The list will help define if you want to tweak the number of clusters. Don't be alarmed if the same keyword is used in multiple clusters—it just means it is "popular" in your image set.

99% made by AI

I simply interrogated the JupyterLab OpenAI plug-in until it worked, then moved the folder path to an easier place to change. I'm a dumb-but-tenacious designer. Enjoy!

xmp-to-clustered-folders's People

Contributors

munsonbh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.