ChromaDB and OpenCLIP: multimodal search tutorial

Learn how a Python script indexes PNG images and text in ChromaDB, then searches them with text or an image using OpenCLIP embeddings.

Player not loading? Watch on YouTube

This tutorial, uploaded on June 9, 2024, demonstrates a local multimodal retrieval project using ChromaDB and OpenCLIP embeddings. The walkthrough uses Python 3.10; it does not state the installed ChromaDB or open-clip-torch version numbers. Its setup reflects that upload date.

The script scans a documents directory, uses filenames as collection IDs, and adds PNG images and text files to a persistent database on the local machine. Rerunning it adds files with new IDs and removes entries for deleted files. The speaker explains that reopening a collection requires the same embedding function to avoid an embedding dimension mismatch.

Queries return file IDs and distances. The examples search for cats, dogs and technology with text, then use a cat image from a separate query folder. Although the speaker describes support for combined image and text input, he reports poor results when mixing them. The demonstrated script handles one image or one text query at a time and would need changes to accept image formats beyond PNG.

The open source embedding models download on the first run. The coding preview covers environment creation, dependency installation and image conversion with NumPy and Pillow. Despite the RAG title, the demonstrated loop retrieves matching files rather than generating answers with a local LLM. The video includes a coding preview and code review; access to the complete project code is offered through the creator's paid course.