---
title: "Implementing semantic image search with Amazon Titan and Supabase Vector"
description: "Semantic image search can be built in Python by generating 1024-dimensional embeddings for images with the Amazon Titan multimodal embedding model (amazon.titan-embed-image-v1) via Amazon Bedrock, then storing and querying them in Supabase Vector (Postgres with pgvector) using the vecs client."
url: "https://swe.quest/articles/implementing-semantic-image-search-with-amazon-titan-and-supabase-vector-07c13eba94b53a82"
canonical: "https://supabase.com/blog/semantic-image-search-amazon-bedrock"
source: "Supabase"
published: "2024-03-26"
difficulty: "medium"
kind: "How-to"
reading_minutes: 5
tags: ["vector-search","postgres","python","computer-vision","cloud"]
---

# Implementing semantic image search with Amazon Titan and Supabase Vector

A post on [Supabase](https://swe.quest/sources/supabase.md), published 2024-03-26, 5 min read, How-to. Original: [https://supabase.com/blog/semantic-image-search-amazon-bedrock](https://supabase.com/blog/semantic-image-search-amazon-bedrock)

## Summary

Semantic image search can be built in Python by generating 1024-dimensional embeddings for images with the Amazon Titan multimodal embedding model (amazon.titan-embed-image-v1) via Amazon Bedrock, then storing and querying them in Supabase Vector (Postgres with pgvector) using the vecs client. The walkthrough covers Poetry project setup, base64-encoding images for the Bedrock API, upserting embeddings with metadata into a vecs collection and creating an index. A text query is embedded with the same model and matched against image vectors with a metadata filter, and the top result is displayed with matplotlib. The same approach supports reverse image search.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Vector search](https://swe.quest/tags/vector-search.md) (Data & databases)
- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Python](https://swe.quest/tags/python.md) (Languages)
- [Computer vision](https://swe.quest/tags/computer-vision.md) (AI & ML)
- [Cloud platforms](https://swe.quest/tags/cloud.md) (Infrastructure)

## Prerequisites

- Python basics ([easy posts on Python](https://swe.quest/tags/python.md?difficulty=easy))
- vector embeddings ([easy posts on RAG & retrieval](https://swe.quest/tags/rag.md?difficulty=easy))
- AWS credentials setup ([easy posts on Cloud platforms](https://swe.quest/tags/cloud.md?difficulty=easy))

## Keywords

Amazon Bedrock, Amazon Titan, Supabase Vector, pgvector, vecs, boto3, Poetry

## Related posts

- [Image Similarity with Hugging Face Datasets and Transformers](https://swe.quest/articles/image-similarity-with-hugging-face-datasets-and-transformers-cfa579cfca74f44c.md): Hugging Face · 2023-01-16 · Medium · 7 min read · Computer vision, Vector search, Search, Python
  An image similarity system can be built by embedding images with a fine-tuned Vision Transformer (CLS token from the last hidden state) and ranking candidates by cosine similarity against a query embedding.
- [Image search with 🤗 datasets](https://swe.quest/articles/image-search-with-datasets-7a6fd7ae6c6c63ce.md): Hugging Face · 2022-03-16 · Medium · 12 min read · Vector search, Computer vision, Python, Search
  A text-to-image search over 10,000 British Library book embellishments can be built by loading the images with the 🤗 datasets ImageFolder loader and embedding them with the CLIP ViT-B/32 model via sentence\_transformers.
- [Storing OpenAI embeddings in Postgres with pgvector](https://swe.quest/articles/storing-openai-embeddings-in-postgres-with-pgvector-19a5d03614f86fc6.md): Supabase · 2023-02-06 · Medium · 11 min read · Vector search, PostgreSQL, RAG & retrieval, LLMs
  pgvector adds a vector data type and distance operators (Euclidean \<-\>, negative inner product \<#\>, cosine \<=\>) to Postgres, so OpenAI text-embedding-ada-002 embeddings (1536 dimensions) can be stored and queried for similarity directly in the database.
- [Hugging Face is now supported in Supabase](https://swe.quest/articles/hugging-face-is-now-supported-in-supabase-b922ce506c4fa31d.md): Supabase · 2023-08-07 · Medium · 7 min read · Vector search, PostgreSQL, Serverless, Python, JavaScript
  Supabase adds first-class Hugging Face support for generating embeddings stored in pgvector, as an open-source, self-hostable alternative to OpenAI's text-embedding-ada-002.
- [The infrastructure behind AI search in Figma](https://swe.quest/articles/the-infrastructure-behind-ai-search-in-figma-b7fada64ae683a10.md): Figma · 2024-10-15 · Medium · 10 min read · Vector search, Search, Cost optimization, Inference & serving, Scaling
  Figma's AI search embeds frames and published components with a CLIP-based multimodal model, so screenshots, layer selections and text all query one vector space.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
