Extension - ai_image_search: Image Search Inside PostgreSQL - Mailing list pgsql-general

From lakshmi
Subject Extension - ai_image_search: Image Search Inside PostgreSQL
Date
Msg-id CAEvyyTg52hG77qviWMHipCE1dE=jQ_F+DYhxed7QgrTrs4YF-A@mail.gmail.com
Whole thread
List pgsql-general
Hello PostgreSQL Community,

I would like to share a PostgreSQL extension I have been working on, called
ai_image_search.

It lets you search images stored in your database by meaning rather than by
filename or tags. You can search using a text description, such as "a girl
wearing a tshirt", or by giving another image and finding the ones most
similar to it. The results are then reranked using a second model to improve
the ordering.

Everything runs inside PostgreSQL using plpython3u and pgvector. The
embeddings are stored in a normal column in your own table, so searching is
just a regular SQL query.

The main benefit is that you do not need a separate vector database or an
external service to do this. The images and their embeddings stay in the
same place, there is no extra infrastructure to maintain, and it works with
tables you already have.

I am attaching the code as a patch, along with a screenshot of the output.
from a sample run.

I would be glad to hear the community's thoughts on the approach and on
anything that could be improved.


Thank you
Regards,
Lakshmi
Attachment

pgsql-general by date:

Previous
From: Färber, Franz-Josef (StMUK)
Date:
Subject: Extract text from XML, pay attention to XML Entities
Next
From: Mark Hill
Date:
Subject: Error Creating pgcrypto Extension