Text-image search and image tagging library
Project description
ripple_net (wip)
A library for text/image based search/retrieval for image datasets and files. Uses multimodal AI techniques/models like vector embeddings and CLIP.
Install
$ pip install ripple_net
Usage
- For text description-based search
from ripple import ImageEmbedder, TextSearch # import classes
# load from a huggingface image dataset or load from a local image directory
embedder = ImageEmbedder('huggan/wikiart', retrieval_type='text-image', dataset_type='huggingface')
# could also use 'cpu' if CUDA-enabled GPU isn't available
embedded_images = embedder.create_embeddings(device="cuda", batch_size=32)
# initialize text - image search class
text_search = TextSearch(embedded_images, embedder.embed_model)
# specify text/search query for image, and number of results to return
scores, images = text_search.get_similar_images(query='painting of a river', k_images=10)
images['image'][0].show()
- For image-based retrieval(image-image search)
from ripple import ImageEmbedder, ImageSearch, image_loader
# load dataset and initialize embedding class
embedder = ImageEmbedder('lambdalabs/naruto-blip-captions', retrieval_type='image-image', dataset_type='huggingface', device='cuda',
)
# generate embeddings
embedded_images = embedder.create_embeddings(device="cuda", batch_size=32)
# init image search class
image_search = ImageSearch(embedded_images, embedder.embed_model)
# retrieve similar images with image input
input_image = image_loader('katara.png') # use library function to load image in PIL format
scores, images = image_search.image_search(input_img=input_image, k_images=5) # specify input image, and number of results to return
# dislay one of retrieved images
images['image'][0].show()
# or using notebooks => images['image'][0]
- For auto image tagging/renaming
from ripple import ImageTagger
# initialize the class with folder of choice
folder = '/kaggle/working/images/drawings'
tagger = ImageTagger(folder)
# captions to label with
captions = ['humans', 'animals', 'plants','land']
tagger.auto_tagger(captions) # rename all images and move to folders
Todo
- direct CLI usage
Acknowledgement
- Sentence transformers library by UKPLabs and Huggingface transformers.
- Image search engine: article by not-lain
- CLIP (Contrastive Language–Image Pre-training) research by OpenAI.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ripple_net-0.1.5.tar.gz
(149.3 kB
view details)
Built Distribution
File details
Details for the file ripple_net-0.1.5.tar.gz
.
File metadata
- Download URL: ripple_net-0.1.5.tar.gz
- Upload date:
- Size: 149.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c68a32929a6cba69c00817119e2f22463a66851ae39c092e64ba6b627b303519 |
|
MD5 | c77905ba7856868790820086653c0d99 |
|
BLAKE2b-256 | d56aa53b120adea3cab25d28b8dce9474068fe8d7959cf35199f48739482207a |
File details
Details for the file ripple_net-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: ripple_net-0.1.5-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a99b845d1c7fcd7b96064aa6da43f79e9ba6d0ab02a520d0e7d4760af492d5f |
|
MD5 | 7bfbd76f5bbb80a335df0cc0d1a6802b |
|
BLAKE2b-256 | a721abd41a6dfbaa3b1bc00f4b399579e008fdc5855d3db24ab1c2de19f159d1 |