Skip to main content

A lightweight Python library for generating image embeddings with semantic search

Project description

imgemb: Efficient Image Embeddings and Similarity Search

PyPI version License: MIT Python 3.8+

imgemb is a powerful Python library for generating image embeddings and performing similarity search. It offers multiple embedding methods, semantic search capabilities, and interactive visualizations.

Features

  • 🎨 Multiple Embedding Methods:

    • Average Color: Fast color-based similarity
    • Grid: Spatial color distribution analysis
    • Edge: Shape and structure detection
    • Semantic: CLIP-based content understanding
  • 🔍 Similarity Search:

    • Fast nearest neighbor search
    • Multiple distance metrics (cosine, euclidean)
    • Batch processing support
    • Interactive result visualization
  • 🖼️ Interactive Visualization:

    • Plot similar images with scores
    • Save interactive HTML plots
    • Customizable layouts and titles
  • 🛠️ Command Line Interface:

    • Generate embeddings
    • Compare images
    • Find similar images
    • Semantic search
  • 🚀 Performance:

    • Efficient numpy-based computations
    • GPU support for semantic search
    • Optimized for large image collections

Installation

pip install imgemb

Quick Start

from imgemb import ImageEmbedder, plot_similar_images

# Initialize embedder
embedder = ImageEmbedder(method="grid")

# Find similar images
similar_images = embedder.find_similar_images(
    "query.jpg",
    "images/",
    top_k=5
)

# Visualize results
fig = plot_similar_images("query.jpg", similar_images)
fig.show()

Command Line Usage

# Generate embeddings
imgemb generate images/ --output embeddings.json --method grid

# Find similar images
imgemb find-similar query.jpg images/ -k 5 --method edge

# Semantic search
imgemb search "a photo of a dog" images/ -k 5

Documentation

Contributing

We welcome contributions! Please see our Contributing Guide for details.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Citation

If you use imgemb in your research, please cite:

@software{imgemb2024,
  author = {Aryan Raj},
  title = {imgemb: Efficient Image Embeddings and Similarity Search},
  year = {2024},
  publisher = {GitHub},
  url = {https://github.com/aryanraj2713/imgemb}
}

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

imgemb-0.2.5.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

imgemb-0.2.5-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file imgemb-0.2.5.tar.gz.

File metadata

  • Download URL: imgemb-0.2.5.tar.gz
  • Upload date:
  • Size: 18.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for imgemb-0.2.5.tar.gz
Algorithm Hash digest
SHA256 b8fa69ed4ae24be3c71b824f8b989473d8ceece9bc51b2b0249a9c80ae37cf69
MD5 5cc865a91e7b72b28425e46dfab18869
BLAKE2b-256 2aebe66de7942b925e7c41a01b22ee1c516e167bf7c4ad3962a57793a3f1b8b6

See more details on using hashes here.

File details

Details for the file imgemb-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: imgemb-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for imgemb-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d63b31639b83a54188dd685b4d1b08d47235bfa80af82125d28d534213c92876
MD5 bb3f2445933c8bcf8efd1c89e58fd551
BLAKE2b-256 6b89142a92bde8319571868ac2dc2ce60c48278a9c2d7616c17b90bb114d4b0f

See more details on using hashes here.

Supported by

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