Skip to main content

Toolset for Vision Agent

Project description

vision_agent

🔍🤖 Vision Agent

ci_status PyPI version version

Vision Agent is a library for that helps you to use multimodal models to organize and structure your image data. Check out our discord for roadmaps and updates!

One of the problems of dealing with image data is it can be difficult to organize and search. For example, you might have a bunch of pictures of houses and want to count how many yellow houses you have, or how many houses with adobe roofs. The vision agent library uses LMMs to help create tags or descriptions of images to allow you to search over them, or use them in a database to carry out other operations.

Getting Started

LMMs

To get started, you can use an LMM to start generating text from images. The following code will use the LLaVA-1.6 34B model to generate a description of the image you pass it.

import vision_agent as va

model = va.lmm.get_lmm("llava")
model.generate("Describe this image", "image.png")
>>> "A yellow house with a green lawn."

WARNING We are hosting the LLaVA-1.6 34B model, if it times out please wait ~3-5 min for the server to warm up as it shuts down when usage is low.

DataStore

You can use the DataStore class to store your images, add new metadata to them such as descriptions, and search over different columns.

import vision_agent as va
import pandas as pd

df = pd.DataFrame({"image_paths": ["image1.png", "image2.png", "image3.png"]})
ds = va.data.DataStore(df)
ds = ds.add_lmm(va.lmm.get_lmm("llava"))
ds = ds.add_embedder(va.emb.get_embedder("sentence-transformer"))

ds = ds.add_column("descriptions", "Describe this image.")

This will use the prompt you passed, "Describe this image.", and the LMM to create a new column of descriptions for your image. Your data will now contain a new column with the descriptions of each image:

image_paths image_id descriptions
image1.png 1 "A yellow house with a green lawn."
image2.png 2 "A white house with a two door garage."
image3.png 3 "A wooden house in the middle of the forest."

You can now create an index on the descriptions column and search over it to find images that match your query.

ds = ds.build_index("descriptions")
ds.search("A yellow house.", top_k=1)
>>> [{'image_paths': 'image1.png', 'image_id': 1, 'descriptions': 'A yellow house with a green lawn.'}]

You can also create other columns for you data such as is_yellow:

ds = ds.add_column("is_yellow", "Is the house in this image yellow? Please answer yes or no.")

which would give you a dataset similar to this:

image_paths image_id descriptions is_yellow
image1.png 1 "A yellow house with a green lawn." "yes"
image2.png 2 "A white house with a two door garage." "no"
image3.png 3 "A wooden house in the middle of the forest." "no"

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vision_agent-0.0.30.tar.gz (24.9 kB view details)

Uploaded Source

Built Distribution

vision_agent-0.0.30-py3-none-any.whl (29.4 kB view details)

Uploaded Python 3

File details

Details for the file vision_agent-0.0.30.tar.gz.

File metadata

  • Download URL: vision_agent-0.0.30.tar.gz
  • Upload date:
  • Size: 24.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.11 Linux/6.5.0-1016-azure

File hashes

Hashes for vision_agent-0.0.30.tar.gz
Algorithm Hash digest
SHA256 c6798a558f75ba8eb37883183fd060522549466cca66d5dffbdbafe5abe825b8
MD5 57f2f061114736008dbcc87b8535483f
BLAKE2b-256 da03781c00a83a193c6c26409a5d79f7e6a7770c6673fab87b39d3c2eee21b3e

See more details on using hashes here.

File details

Details for the file vision_agent-0.0.30-py3-none-any.whl.

File metadata

  • Download URL: vision_agent-0.0.30-py3-none-any.whl
  • Upload date:
  • Size: 29.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.11 Linux/6.5.0-1016-azure

File hashes

Hashes for vision_agent-0.0.30-py3-none-any.whl
Algorithm Hash digest
SHA256 3aa5d5c709c92d8f87749d763db7d0a3f57be98b3caf8efed1de1f32dedea517
MD5 3dfe9421b83b195873cd2653e501a881
BLAKE2b-256 8791aecad841cd5206565fb9516d90be783a771fa6c92b8319274707497c1377

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