Anomaly Detection
Identify outliers and anomalous content using embedding distance from cluster centroids. Flag quality issues, novel content, or items that don't match expected patterns.
"Find images that don't match the expected product catalog style with anomaly score above 0.85"
Why This Matters
Anomalies can be problems (data quality issues) or opportunities (novel content). Either way, you need to find them before they find you.
import csvimport ioimport timeimport requestsfrom mixpeek import Mixpeekclient = Mixpeek(api_key="YOUR_API_KEY", namespace="inspection")API = "https://api.mixpeek.com/v1"HEADERS = {"Authorization": "Bearer YOUR_API_KEY", "X-Namespace": "inspection"}# 1. A collection that embeds every inspection photobucket = client.buckets.create(bucket_name="inspection-photos",bucket_schema={"properties": {"photo": {"type": "image"}}},)collection = client.collections.create(collection_name="inspection-photos",source={"type": "bucket", "bucket_ids": [bucket["bucket_id"]]},feature_extractor={"feature_extractor_name": "multimodal_extractor","version": "v1",},)client.buckets.upload(bucket["bucket_id"],blobs=[{"property": "photo", "type": "image", "data": "s3://your-bucket/inspection/line-4/frame-0001.jpg"}],)client.collections.trigger(collection["collection_id"])# 2. HDBSCAN puts photos that fit no dense group into noise; those are the anomalies.# The SDK has no clusters resource, so this part is REST.cluster = requests.post(API + "/clusters", headers=HEADERS, json={"cluster_name": "inspection-baseline","collection_ids": [collection["collection_id"]],"cluster_type": "vector","vector_config": {"feature_uris": ["mixpeek://multimodal_extractor@v1/vertex_multimodal_embedding"],"clustering_method": "hdbscan","algorithm_params": {"min_cluster_size": 20},},}).json()task = requests.post(API + "/clusters/" + cluster["cluster_id"] + "/execute", headers=HEADERS, json={}).json()while client.tasks.get(task["task_id"])["status"] not in ("COMPLETED", "COMPLETED_WITH_ERRORS", "FAILED"):time.sleep(15)# 3. The latest run reports the noise ratio, and its CSV export lists every memberrun = requests.get(API + "/clusters/" + cluster["cluster_id"] + "/executions", headers=HEADERS).json()print("noise ratio:", (run.get("metrics") or {}).get("noise_ratio"))export = requests.get(API + "/clusters/" + cluster["cluster_id"] + "/executions/" + run["run_id"] + "/export",headers=HEADERS,params={"format": "csv"},)rows = csv.DictReader(io.StringIO(export.text))outliers = [r["document_id"] for r in rows if r["cluster_id"] in ("-1", "cl_-1") and r["is_centroid"] != "True"]print(len(outliers), "anomalous photos:", outliers[:10])
Feature Extractors
Multimodal Extractor
Unified embeddings for video, audio, image, and text: scene/silence chunking, Whisper transcription, thumbnails, and Gemini vision.
Retriever Stages
Documentation
Use Cases Using This Recipe
AI Video Surveillance Analytics
Transform passive camera feeds into actionable security intelligence
85% of events caught live vs. 5% manual baseline
Real-time incident detection rate
Security operations centers, facility managers, and enterprise security teams monitoring 50+ camera feeds across multiple locations
Related Recipes & Resources
Explore these related resources to deepen your understanding and discover more powerful features
Multimodal Extractor
Unified embeddings for video, audio, image, and text: scene/silence chunking, Whisper transcription, thumbnails, and Gemini vision.
Semantic Multimodal Search
Unified semantic search across all content types. Query by natural language and retrieve relevant video clips, images, audio segments, and documents based on meaning-not keywords or manual tags.
Feature Extraction
Multi-tier feature extraction that decomposes content into searchable components: embeddings, transcripts, detected objects, OCR text, scene boundaries, and more. The foundation for all downstream retrieval and analysis.
Clustering & Theme Discovery
Unsupervised clustering that groups content into semantic themes using HDBSCAN. Surfaces hidden patterns, content variants, and outliers without requiring predefined labels.
Multimodal RAG
Retrieval-augmented generation across video, images, and text. Retrieve relevant multimodal context, then pass to your LLM with citations back to source timestamps and frames.
Sports Highlights Pipeline
Automatically identify highlight-worthy moments in sports broadcasts using multimodal analysis, visual action detection, audio spike recognition (crowd noise, commentator excitement), and on-screen graphic parsing. Returns timestamped event manifests ready for clip assembly.