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.
Metadata
Release files for ripple-net 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ripple_net-0.1.5.tar.gz | 149.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ripple_net-0.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 164.3 kB
Release files / ripple_net-0.1.5.tar.gz
| Download URL | ripple_net-0.1.5.tar.gz |
|---|---|
| Size | 149.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c68a32929a6cba69c00817119e2f22463a66851ae39c092e64ba6b627b303519
|
|
BLAKE2b-256 checksum How to use checksums |
d56aa53b120adea3cab25d28b8dce9474068fe8d7959cf35199f48739482207a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.4
|
Release files / ripple_net-0.1.5-py3-none-any.whl
| Download URL | ripple_net-0.1.5-py3-none-any.whl |
|---|---|
| Size | 15.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6a99b845d1c7fcd7b96064aa6da43f79e9ba6d0ab02a520d0e7d4760af492d5f
|
|
BLAKE2b-256 checksum How to use checksums |
a721abd41a6dfbaa3b1bc00f4b399579e008fdc5855d3db24ab1c2de19f159d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.4
|