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')
# 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]
Todo
coming soon
- add auto-image file tagging/renaming
- direct CLI usage
Acknowledgement
- 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.3.tar.gz
(149.1 kB
view details)
Built Distribution
File details
Details for the file ripple_net-0.1.3.tar.gz
.
File metadata
- Download URL: ripple_net-0.1.3.tar.gz
- Upload date:
- Size: 149.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f84bb1c16246d3402b004d12eda6b1df476bc9bef2f945f35413ca10b87978a8 |
|
MD5 | 134b24be137c283f626ceff46ef3eac8 |
|
BLAKE2b-256 | 55b34aa4235db190059873de28606cd6de4c1f115cd556d2b8b85d8b9bea0506 |
File details
Details for the file ripple_net-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: ripple_net-0.1.3-py3-none-any.whl
- Upload date:
- Size: 14.9 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 | 43064ab794bec3db12dc63fd1cf3746aae52db097ce52a6be2474a791814c761 |
|
MD5 | 8fed401b22f8dad10559c2ff18a1ae73 |
|
BLAKE2b-256 | cc9d3c97d815ec72a693331d55b4636275ff74d4df0a7f3d425096baa8ac82b0 |