ObjectLens is a multimedia mining and indexing system that enables efficient object-based image retrieval using deep learning and similarity search. The system supports both 2D image search (using ImageNet/YOLO) and 3D model retrieval (using pottery dataset), combining computer vision, feature extraction, and vector similarity search.
ObjectLens allows users to:
- Upload an image and detect objects within it using YOLO
- Search for similar objects across large datasets using FAISS-powered vector similarity
- Filter results by class for more precise retrieval
- Visualize 2D and 3D results through an interactive web interface
- Index and retrieve 3D models based on geometric and visual features
ObjectLens/
βββ backend/ # FastAPI server with ML pipelines
βββ frontend/ # React + Vite web interface
βββ scripts/ # Dataset preparation and indexing scripts
βββ data/ # Datasets (ImageNet, Pottery)
βββ db/ # MongoDB configuration
βββ docker-compose.yml
Backend:
- FastAPI for REST API
- YOLOv8 (Ultralytics) for object detection
- FAISS for fast similarity search
- MongoDB for metadata storage
- OpenCV, scikit-image, and custom descriptors for feature extraction
Frontend:
- React 19 with Vite
- Three.js for 3D model visualization
- Tailwind CSS for styling
- React Router for navigation
Databases:
- MongoDB for storing object metadata and features
- FAISS indices for vector similarity search
- Python 3.8+ with pip (Make sure to create a local python env :
python -m venv .venv) - Node.js 16+ with npm
- Docker & Docker Compose (optional, for containerized deployment)
- Git for cloning the repository
-
Clone the repository:
git clone <repository-url> cd ObjectLens
-
Set up environment variables:
# Copy and configure .env file cp .env.example .env # Edit .env with your configuration
-
Run the setup pipeline:
# This downloads datasets, builds catalogs, and sets up indices bash run_pipeline.shThe pipeline performs:
- Downloads ImageNet Winter21 dataset
- Verifies and builds YOLO dataset
- Precomputes image features
- Downloads pottery 3D models
- Builds and splits pottery catalog
- Sets up MongoDB and FAISS indices
# Start MongoDB
docker-compose up -d mongo
# Start backend (from project root)
cd backend
pip install -r requirements.txt
cd ..; uvicorn backend.main:app --reload --host 0.0.0.0 --port 8000
# Start frontend (in a new terminal)
cd frontend
npm install
npm run devAccess the application at http://localhost:5173
Backend:
cd backend
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -r requirements.txt
cd ..; uvicorn backend.main:app --reload --host 0.0.0.0 --port 8000Frontend:
cd frontend
npm install
npm run devMongoDB:
# Using Docker
docker run -d -p 27017:27017 --name objectlens-mongo mongo:latest
# Or install MongoDB locally- Purpose: Object detection and 2D image retrieval
- Classes: Multiple object categories
- Format: JPEG images with YOLO annotations
- Location:
data/imagenet_4_yolo/
- Purpose: 3D model retrieval and visualization
- Classes: Amphora, Hydria, Krater, Kylix, and more
- Format: OBJ files with textures
- Location:
data/raw/3DModels/
- Upload & Detection: User uploads an image β YOLO detects objects β user selects an object
- Feature Extraction: System crops the object β extracts deep features (weighted, L2-normalized vector)
- Similarity Search: FAISS searches the index β returns top-k nearest neighbors
- Result Retrieval: System looks up metadata in MongoDB β returns images with highlighted matching objects
- Feature Extraction: Extract geometric descriptors (shape, curvature, distribution)
- Indexing: Build FAISS index from 3D feature vectors
- Query: User searches by uploading a 3D model or selecting from catalog
- Visualization: Results displayed with Three.js 3D viewer
GET /health
GET /health/datasetPOST /api/detect
# Upload image, returns detected objects with bounding boxesPOST /api/search/topk?top_k=10&metric=cosine&same_class_only=false
# Parameters:
# - top_k: Number of results to return
# - metric: 'cosine' or 'euclidean'
# - same_class_only: Filter by object classGET /api/samples/random?count=10
# Returns random sample images from datasetSee backend/test_commands.md for detailed API testing examples.
backend/
βββ main.py # FastAPI application entry point
βββ routers/ # API route handlers
β βββ detect.py # Object detection endpoints
β βββ search.py # Similarity search endpoints
β βββ samples.py # Sample data endpoints
βββ services/ # Business logic
β βββ yolo_service.py # YOLO detection service
β βββ feature_extraction.py # Feature extraction
β βββ faiss_service.py # FAISS index management
β βββ compute_similarity.py # Similarity computation
βββ core/ # Configuration and utilities
βββ db/ # Database models and connections
βββ schemas.py # Pydantic models
frontend/
βββ src/
β βββ main.jsx # Application entry point
β βββ App.jsx # Root component with routing
β βββ Home.jsx # Main search interface
β βββ Pr2d.jsx # 2D preview page
β βββ Pr3d.jsx # 3D preview page
β βββ api.js # API client
β βββ components/
β βββ ModelViewer.jsx # 3D model viewer
βββ public/ # Static assets
See frontend/README.md for detailed frontend documentation.
scripts/
βββ dataset/ # Dataset download and preparation
β βββ imagenet_*.py # ImageNet pipeline scripts
β βββ pottery_*.py # Pottery dataset scripts
βββ preprocessing/ # Feature precomputation
βββ indexing/ # Index building and evaluation
# Test feature extraction pipeline
python backend/test_feature_pipeline.py
# Test 3D retrieval
python backend/test_3D_retrieval.py
# Test system flow
python backend/test_system_flow.py# Using curl
curl -X POST "http://localhost:8000/api/search/topk?top_k=10" \
-F "file=@path/to/image.jpg"
# Using Python
python backend/test_search_endpoint.py- β Object detection with YOLOv8
- β FAISS-powered similarity search
- β Class-based filtering
- β 2D image retrieval
- β 3D model retrieval
- β Interactive web interface
- β MongoDB metadata storage
- β Docker support
- π Batch upload and processing
- π Advanced 3D feature descriptors
- π Real-time collaborative search
- π Export and annotation tools
Key configuration files:
.env- Environment variables (database URLs, API keys, dataset paths)backend/core/config.py- Backend settingsfrontend/src/api.js- API base URL configurationdocker-compose.yml- Container orchestration
- Frontend Documentation - Detailed frontend guide
- Backend Flow - System architecture overview
- Test Commands - API testing examples
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is part of the M232 Multimedia Mining & Indexing course at IASD.
- ImageNet for the image dataset
- Ultralytics for YOLOv8
- FAISS by Meta AI for similarity search
- Three.js for 3D visualization
For questions or issues, please open an issue on the repository.
Built for MST.IASD.232 - multimedia mining and indexing course