Advanced AI-powered furniture similarity search system using CLIP, DINOv2, and OpenAI embeddings with FAISS indexing.
- Multi-modal embeddings: CLIP (visual) + DINOv2 (features) + OpenAI (text)
- Large model support: ViT-L/14@336px + DINOv2 giant
- Concatenation strategy: 5376-dimensional combined embeddings
- Two-stage search: Coarse retrieval β re-ranking β top results
- Background removal: Automated with Rembg
- Async processing: Background tasks for large datasets
- RunPod ready: One-click deployment on GPU cloud
- Git LFS: Efficient storage for FAISS indexes
curl -sSL https://raw.githubusercontent.com/matthiaskaminski/embeddings/main/setup.sh | bash
- CLIP ViT-L/14@336px: 768-dim visual embeddings
- DINOv2 Giant: 1536-dim advanced visual features
- OpenAI text-embedding-3-large: 3072-dim text features
- Combined: 5376-dim concatenated embeddings
- Image preprocessing β Background removal
- Multi-scale processing β 224px, 336px, 448px
- Feature extraction β Visual + text embeddings
- FAISS indexing β Fast similarity search
- Two-stage search β 1750 β 300 β 6-8 results
# Build new indexes
POST /faiss/build-async
{
"products": [
{
"id": 1,
"image_url": "https://...",
"features": {
"kolor": "szary",
"material": "tkanina",
"typ": "sofa"
}
}
]
}
# Add products to existing indexes
POST /faiss/add-async
{
"products": [...],
"append": true
}
# Two-stage similarity search
POST /faiss/search/two-stage
{
"image_url": "https://...",
"features": {
"kolor": "beΕΌowy",
"material": "tkanina"
},
"k": 6,
"remove_background": true,
"use_multiscale": true
}
# System health
GET /health
# Index statistics
GET /faiss/stats
# Task status
GET /task/{task_id}
- Python 3.10+
- CUDA 11.8+
- 12GB+ GPU memory
- Git LFS
git clone https://github.com/matthiaskaminski/embeddings.git
cd embeddings
git lfs pull
pip install -r requirements.txt
python app.py
- Create template from
runpod-template.md
- Deploy:
curl setup.sh | bash
- Access: ngrok tunnel or public IP
- Scale: Start/stop on demand
docker-compose up -d
- Development: ~$0.60/hour (RTX 4090)
- Production: On-demand processing only
- Storage: Free with Git LFS (under 2GB)
- RTX 3060: 3-5 sec/embedding
- RTX 4090: 1-2 sec/embedding
- A100: 0.5-1 sec/embedding
- Index size: 1750 products
- Search time: <100ms
- Memory usage: 5GB GPU + 8GB RAM
All endpoints require:
X-API-Key: szuk_ai_embeddings_2024_secure_key
- 100 requests/minute per IP
- Configurable limits
# Large models (production)
POST /admin/switch-model-size
{"model_size": "large"}
# Small models (development)
POST /admin/switch-model-size
{"model_size": "small"}
GET /admin/model-config
- Deployment Guide - Complete setup instructions
- RunPod Template - Template creation guide
- Project Details - Technical specifications
- Security Info - Security guidelines
- Memory errors: Use smaller batch sizes or small models
- CUDA errors: Restart pod and check GPU status
- LFS timeouts: Increase git timeout settings
# Check logs
tail -f logs/app.log
# Monitor GPU
nvidia-smi
# Test health
curl http://localhost:5000/health
Product Image β Background Removal β Multi-scale Processing
β β β
CLIP Embedding β DINOv2 Embedding β Text Embedding
β β β
Concatenation (5376 dims)
β
FAISS Indexing
β
Similarity Search
β
Top 6-8 Results
- E-commerce: Product recommendation
- Interior Design: Style matching
- Inventory: Similar product search
- Content: Visual similarity detection
- Vector database integration (Pinecone, Weaviate)
- Real-time reindexing
- Multi-language support
- Advanced filtering options
- A/B testing framework
MIT License - See LICENSE file for details
- Fork repository
- Create feature branch
- Commit changes
- Push to branch
- Create Pull Request
Powered by: PyTorch β’ CLIP β’ DINOv2 β’ FAISS β’ Flask β’ RunPod