MotionMatch is built with a modular architecture that separates video processing, feature extraction, and search functionality.
This project implements zero-shot video retrieval using V-JEPA 2 embeddings without any fine-tuning:
Approach:
- Extract embeddings from pre-trained V-JEPA 2 model
- Store embeddings in vector database (Milvus)
- Use cosine similarity for retrieval
- No training, fine-tuning, or metric learning
Implications:
- ✅ Fast to deploy: No training required
- ✅ General purpose: Works on any video domain
- ❌ Limited accuracy: Embeddings not optimized for similarity
- ❌ Domain sensitivity: Performance varies by video source
Future Improvements:
- Fine-tune with triplet/contrastive loss on domain-specific data
- Add metric learning head for better similarity representation
- Train on labeled motion similarity datasets
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ FastAPI │ │ V-JEPA 2 │ │ Milvus │
│ Web Server │───▶│ Encoder │───▶│ Vector DB │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │ │
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Search │ │ Indexing │ │ PostgreSQL │
│ Service │ │ Service │ │ Metadata │
└─────────────────┘ └─────────────────┘ └─────────────────┘
- REST API endpoints
- File upload handling
- Request validation
- Response formatting
- Video feature extraction
- GPU acceleration (CUDA)
- Batch processing support
- Caching for performance
- High-dimensional vector storage
- Similarity search
- Indexing and retrieval
- Scalable to millions of videos
- Query processing
- Result ranking
- Similarity scoring
- Response formatting
- Batch video processing
- Feature extraction pipeline
- Database updates
- Progress tracking
- Video metadata storage
- Search analytics
- User data (if applicable)
- System configuration
- Video uploaded or path provided
- Video processed by V-JEPA 2 encoder
- Features extracted and normalized
- Features stored in Milvus vector database
- Metadata stored in PostgreSQL
- Query video uploaded
- Features extracted from query video
- Vector similarity search in Milvus
- Results ranked and filtered
- Response returned with similarity scores
- Docker Compose for local development
- All services run on single machine
- SQLite for lightweight metadata storage
- Kubernetes for orchestration
- Separate GPU nodes for encoding
- Distributed Milvus cluster
- PostgreSQL with replication
- API servers: Multiple FastAPI instances behind load balancer
- Encoding: GPU worker pool with job queue
- Database: Milvus sharding and PostgreSQL read replicas
- Feature caching for repeated queries
- Batch processing for bulk indexing
- GPU memory management
- Connection pooling
- No Fine-Tuning: Uses pre-trained V-JEPA 2 embeddings as-is
- Suboptimal Similarity: Embeddings not trained for retrieval tasks
- High Similarity Scores: Most results cluster around 95-98% similarity
- Domain Dependency: Works best within consistent video sources
- Metric Learning: Fine-tune with triplet/contrastive loss
- Domain Adaptation: Train on specific use cases (sports, surveillance, etc.)
- Hybrid Approach: Combine motion embeddings with visual features
- Re-ranking: Add learned re-ranking model for better precision