Skip to main content

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]
  • 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

coming soon

  • [] add auto-image file tagging/renaming
  • direct CLI usage

Acknowledgement

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.4.tar.gz (149.3 kB view details)

Uploaded Source

Built Distribution

ripple_net-0.1.4-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file ripple_net-0.1.4.tar.gz.

File metadata

  • Download URL: ripple_net-0.1.4.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

Hashes for ripple_net-0.1.4.tar.gz
Algorithm Hash digest
SHA256 10ec799889a3e21e6d3823377a1e5b9be1e787a07c4bd43281c993224f0616ff
MD5 f95c2127c228e6881bb5913dc271bd30
BLAKE2b-256 2b8c2704739136ad6ed31ed1ed4f141a55231806f4f0af35e3c64a55d3cb04d5

See more details on using hashes here.

File details

Details for the file ripple_net-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: ripple_net-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for ripple_net-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 799bc674144b3438cce6684559cd2a132528e9f30467e94737acc355f91ce81a
MD5 0e82ad08396cd34734c011daff0987b8
BLAKE2b-256 ac8fb9156b1e29063456832042187ba88706680631793ec05d717028d8bf8efa

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page