The Challenge Every Product Team Faces

Published: 2025-11-06

URL: https://theagenticstack.substack.com/p/users-cant-find-products-oracle-23ai


The Challenge Every Product Team Faces Your e-commerce platform has thousands of products. A customer uploads a photo saying “I want something like this.” How do you find it? Traditional text-based search fails. Manual tagging doesn’t scale. Color filters are too simplistic. Thanks for reading Ashu Kumar! Subscribe for free to receive new posts and support my work. Enter image embeddings and vector search.

What Are Image Embeddings? Think of image embeddings as a universal language for visual similarity. Just as word embeddings (like Word2Vec) capture semantic meaning in text, image embeddings transform visual content into high-dimensional vectors that capture what makes images similar.

The magic: A pre-trained Vision Transformer (ViT) model converts any image into a 768-dimensional vector. Images that look similar have vectors that are close together in this high-dimensional space. The Model: Vision Transformer in ONNX Format We used an ONNX-optimized Vision Transformer model specifically designed for production deployment: Technical Specs: Model Architecture: Vision Transformer (ViT) with patch-based processing Format: ONNX (Open Neural Network Exchange) Model Size: ~327 MB Output Dimensions: 768-dimensional FLOAT32 vectors Supported Formats: JPEG, PNG, GIF, BMP, TIFF Preprocessing: Built-in image normalization and resizing Why ONNX?

ONNX (Open Neural Network Exchange) is an open format that enables AI models to be portable across different frameworks and hardware: Framework Agnostic: Train in PyTorch or TensorFlow, deploy anywhere Optimized Inference: Hardware acceleration on CPUs, GPUs, and specialized AI chips Production Ready: Battle-tested by Microsoft, Meta, AWS, and Oracle Smaller Memory Footprint: Optimized model weights and operators Deterministic Output: Consistent embeddings across different environments Model Integration:

The Vision Transformer ONNX model is loaded directly into the database

Using Oracle’s VECTOR_EMBEDDING() function with built-in ONNX runtime

embedding = VECTOREMBEDDING( docvisionmodel USING imageblob AS data )This approach eliminates the need for: Separate Python services for inference Model serialization/deserialization overhead Network latency between app and ML service Complex microservice orchestration The result? Embedding generation happens in-database, reducing latency from hundreds of milliseconds to tens of milliseconds. Real-World Impact: A Retail Use Case Here’s what we built with Oracle 23ai’s native vector capabilities: The Setup 24 clothing items with real product images 768-dimensional embeddings generated using Vision Transformer Sub-second similarity search using cosine distance Personalized recommendations combining visual similarity + user behavior The Results When a user uploaded a white athletic tank top, our system: Generated an embedding in real-time Performed vector similarity search across the catalog Returned the top 10 visually similar items Query time: <100ms The recommendations included similar activewear, matching colors, and complementary styles — all based purely on visual similarity.

Why This Matters for Your Team For Data Scientists: No manual feature engineering: Pre-trained models handle visual feature extraction Composable AI: Combine image embeddings with user behavior, text embeddings, and business rules Scalable: Vector indexes enable billion-scale image search For Developers: Native database support: Store vectors alongside structured data — no separate vector DB needed SQL-based queries: VECTORDISTANCE(embedding1, embedding2, COSINE) is all you need Production-ready: Foreign keys, transactions, and ACID compliance out of the box For Product Managers: New UX possibilities: Visual search, “shop the look,” duplicate detection Higher conversion: Customers find what they want faster Competitive moat: Visual AI is harder to replicate than keyword search For VPs & Engineering Leaders: Simplified architecture: Consolidate your data stack (one less vector DB to manage) Faster time-to-market: Pre-trained models mean weeks, not months ROI clarity: Measurable impact on search quality and conversion rates The Technical Foundation Loading the ONNX Model -- Step 1: Load the Vision Transformer ONNX model into the database -- Model URL: Oracle Cloud Object Storage -- Size: ~327 MB BEGIN DBMSVECTOR.LOADONNXMODEL( modelname => ‘docvisionmodel’, modelsource => ‘https://objectstorage.../vitppvitimage.onnx’, modelformat => ‘ONNX’ ); END; /What happens under the hood: Database downloads the ONNX model (~327 MB) Model is stored in Oracle’s model repository ONNX Runtime is initialized for inference Built-in preprocessing pipeline is configured Model becomes available for VECTOREMBEDDING() function Generating Embeddings -- Step 2: Generate embedding for a product image stored as BLOB UPDATE products SET embeddingvector = VECTOREMBEDDING( docvisionmodel USING imageblob AS data ) WHERE itemid = ‘PROD_001’; -- The function automatically: -- 1.

Reads the BLOB (image bytes) -- 2. Validates format (JPEG/PNG/GIF/BMP/TIFF) -- 3. Preprocesses (resize, normalize) -- 4. Runs ViT forward pass -- 5. Returns 768-dim FLOAT32 vectorVector Similarity Search -- Step 3: Find visually similar products using cosine distance SELECT productname, category, price, imageurl, VECTORDISTANCE( embeddingvector, :queryembedding, COSINE ) AS similarityscore FROM products ORDER BY similarity_score -- Lower distance = more similar FETCH FIRST 10 ROWS ONLY;Performance Optimization: Vector indexes (HNSW or IVF) enable billion-scale search Cosine distance computed using SIMD instructions Query execution in <100ms even with thousands of products Key insight: Modern databases now handle vectors as a native data type, with purpose-built indexes for fast similarity search at scale.

The ONNX format ensures that the same model can run consistently across development, staging, and production environments without framework dependencies. Beyond Product Search How Vision Transformers Work Unlike traditional CNNs (Convolutional Neural Networks), Vision Transformers process images as sequences of patches: Image Patching: Divide image into fixed-size patches (e.g., 16x16 pixels) Linear Embedding: Flatten each patch and project to embedding dimension Positional Encoding: Add position information to maintain spatial relationships Transformer Layers: Apply self-attention to learn relationships between patches Classification Token: Extract final embedding from special [CLS] token Why ViT outperforms CNNs for embeddings: Better captures global context (not just local features) More transferable across domains Superior performance on similarity tasks Pre-trained on massive datasets (ImageNet-21k, JFT-300M) The ONNX Advantage: The same ViT model can be: Trained in PyTorch on GPU clusters Optimized with ONNX Runtime Deployed in Oracle Database (CPU) Run on edge devices (mobile/IoT) Executed on specialized hardware (NPU/TPU) All producing identical 768-dimensional embeddings, ensuring consistency across your entire data pipeline.

Industry Applications Image embeddings unlock possibilities across industries: Healthcare: Find similar radiology images for diagnostic support Manufacturing: Visual defect detection and quality control Security: Facial recognition and threat detection Media: Content moderation and copyright detection Real Estate: Find properties with similar aesthetics Logistics: Package verification and tracking Getting Started: Three Approaches

  1. Cloud-Native with ONNX (Fastest)

Use managed services like Oracle Autonomous Database with built-in ONNX Runtime and vector support. Setup:

1. Upload ONNX model to object storage

oci os object put --bucket-name models --file vit_model.onnx

2. Load in database

BEGIN DBMSVECTOR.LOADONNXMODEL( modelname => ‘visionmodel’, modelsource => ‘OCI://models/vit_model.onnx’ ); END;

3. Start generating embeddings

UPDATE products SET embedding = VECTOREMBEDDING(visionmodel USING image_data AS data);Pros: No infrastructure to manage, built-in ONNX Runtime optimization, automatic scaling Cons: Vendor lock-in considerations

  1. Open Source (Most Flexible)

Combine Hugging Face models + PostgreSQL with pgvector + Python. Setup: from transformers import ViTModel import torch

Export PyTorch model to ONNX

model = ViTModel.frompretrained(’google/vit-base-patch16-224’) torch.onnx.export(model, dummyinput, “vit_model.onnx”)

Use ONNX Runtime for inference

import onnxruntime as ort session = ort.InferenceSession(”vitmodel.onnx”) embeddings = session.run(None, {”pixelvalues”: image_tensor})[0]Pros: Full control, no licensing costs, community support Cons: More setup, infrastructure management, scaling complexity

  1. Hybrid (Best of Both)

Pre-trained ONNX models for embeddings, enterprise database for storage and search. Architecture: Model Layer: ONNX models in database or model registry Storage Layer: Native vector columns with indexes Query Layer: SQL-based similarity search App Layer: REST APIs for real-time inference Pros: Production-grade performance, enterprise support, flexibility Cons: Requires database with vector + ONNX support Our recommendation: Start with approach #3 for production systems.

The ONNX format ensures you can swap databases or deployment targets later without retraining. The Future Is Multi-Modal The next frontier? Combining image embeddings with: Text embeddings: Search products by natural language descriptions Audio embeddings: Find similar music or voice patterns Video embeddings: Temporal similarity and scene matching The vision: A single vector space where text, images, audio, and video are all searchable through a unified interface. Key Takeaways Image embeddings convert visual similarity into math — enabling search, recommendations, and anomaly detection Modern databases now support vectors natively — simplifying architecture and reducing operational complexity Pre-trained models are production-ready — no need to train from scratch ROI is measurable — improved search quality directly impacts conversion rates The technology is accessible — you can start experimenting today with open-source tools Start Your Vector Journey The hardest part isn’t the technology — it’s identifying the right use case.

Ask yourself: Where do users struggle to find what they’re looking for? Where does manual categorization break down at scale? Where would “show me something similar” add value? The answer is your first vector search use case. Let’s Connect I’m exploring the intersection of AI, databases, and product experiences. If you’re building with vector search or image embeddings, I’d love to hear about your use cases.

What visual search challenges are you tackling? Drop a comment below.

MachineLearning #VectorSearch #ImageEmbeddings #AI #DataScience #ProductDevelopment #Oracle23ai #ComputerVision #SemanticSearch #DatabaseEngineering

Built with Oracle 23ai’s native vector capabilities, ONNX Runtime, and Vision Transformer models. The ONNX model (~327 MB) generates 768-dimensional embeddings with built-in preprocessing. All query times and metrics from actual implementation with real image data. Technical Resources: ONNX Format Specification: https://onnx.ai Vision Transformer Paper: “An Image is Worth 16x16 Words” (Dosovitskiy et al., 2020) Oracle Vector Search Documentation: https://docs.oracle.com/en/database/oracle/oracle-database/23/vecse/ Hugging Face Vision Transformers: https://huggingface.co/models?pipeline_tag=image-feature-extraction Thanks for reading Ashu Kumar!

Subscribe for free to receive new posts and support my work.