Simple script to re-rank images using OpenAI's CLIP https://github.com/openai/CLIP.
- First you need to install clip https://github.com/openai/CLIP
pip install clize
Here is an example:
clip_rerank "<FOLDER>/*.jpg" --text="a bird with yellow and cream belly , the bill is short and pointed , with a small head compared to its body" --target_folder=target
What will this do?
this will look for all jpg images in <FOLDER>
, apply CLIP similarity with the provided text, then rank the images, then save the ranked
images into the target folder. Filenames on target folder will start from 0, which will be the image with highest CLIP score.