In this example, we will recognize faces in images and build embedding index.
We appreciate a star ⭐ at CocoIndex Github if this is helpful.
- We will ingest a list of images.
- For each image, we:
- Extract faces from the image.
- Compute embeddings for each face.
- We will export to the following tables in Postgres with PGVector:
- Filename, rect, embedding for each face.
-
Install Postgres if you don't have one.
-
Install Qdrant
docker run -d -p 6334:6334 -p 6333:6333 qdrant/qdrant
-
Install dependencies:
pip install -e .
Update index, which will also setup the tables at the first time:
cocoindex update mainYou can also run the command with -L, which will watch for file changes and update the index automatically.
cocoindex update -L mainI used CocoInsight (Free beta now) to troubleshoot the index generation and understand the data lineage of the pipeline. It just connects to your local CocoIndex server, with zero pipeline data retention. Run following command to start CocoInsight:
cocoindex server -ci main
Then open the CocoInsight UI at https://cocoindex.io/cocoinsight.