VigilCV
The Microsecond Data Sentinel
for Production Computer Vision.
Intercept optical corruption, lens blur, dynamic range clipping, and distribution drift before inference hits expensive GPUs. Pure NumPy · CPU-first · 223µs pre-flight checks.
pip install vigilcvWhy VigilCV
Built for the demands of production ML
223µs Pre-flight
Pure NumPy Laplacian variance and Shannon entropy computed in microseconds on CPU. Zero GPU warmup.
Zero Silent Failures
Hard raises on corrupt JPEG headers, truncated files, and extreme exposure clipping before any model call.
54D Drift Detection
Wasserstein-1 (EMD) and unbiased MMD (RBF kernel) over spatial color moments — no CNN backbone needed.
CPU-First Design
Vectorized NumPy and SciPy operations. Works on serverless, edge inference, and CI runners with no CUDA.
Stream-Ready
audit_stream() generator wraps any OpenCV or GStreamer frame loop with sub-millisecond overhead.
Typed & Tested
Full mypy strict typing, 95% test coverage, ruff-formatted. Production-grade from day one.
Drop any image. See it analyzed in milliseconds.
This playground runs the exact same heuristics as VisionSentinel — pure client-side, zero server round-trips.
Results will appear here
Drop an image to start analysis
Performance
223µs. The fastest gate in the pipeline.
Single-image pre-flight latency on a standard 4-core CPU (512×512 px, NumPy backend). No GPU, no ONNX runtime, no batching required.
Measured on Apple M2 equivalent / AMD Ryzen 7 5800H · Python 3.11 · NumPy 1.26 · Single thread
Integrations
Drop-in guard for any Python stack.
VigilCV integrates in under 5 lines with FastAPI, PyTorch DataLoaders, and OpenCV streams.
"""Zero-copy pre-flight sentinel interceptor for sub-millisecond inference gateways."""
from contextlib import asynccontextmanager
from fastapi import FastAPI, File, HTTPException, UploadFile, status
import numpy as np
from PIL import Image
from vigilcv import VisionSentinel
from vigilcv.exceptions import OpticalCorruptionError, SpecularClippingError
# Thread-safe, pre-allocated heuristic sentinel (AVX2/AVX-512 SIMD accelerated)
sentinel = VisionSentinel(
blur_threshold=110.0,
entropy_min=3.85,
specular_clip_limit=0.35,
enable_fast_spectral=True,
)
@app.post("/v1/predict", status_code=status.HTTP_200_OK)
async def predict_frame(file: UploadFile = File(...)) -> dict[str, float | str]:
if file.content_type not in {"image/jpeg", "image/png", "image/webp"}:
raise HTTPException(
status_code=status.HTTP_415_UNSUPPORTED_MEDIA_TYPE,
detail="Unsupported payload format.",
)
# Read binary stream directly into contiguous uint8 buffer
payload: bytes = await file.read()
raw_array = np.frombuffer(payload, dtype=np.uint8)
try:
# Microsecond quality telemetry audit (< 1.8ms on bare-metal CPU)
metrics = sentinel.audit_stream(raw_array)
if metrics.is_degraded:
return {
"status": "REJECTED_AT_GATEWAY",
"reason": metrics.failure_reason,
"blur_score": round(metrics.laplacian_variance, 2),
"shannon_entropy": round(metrics.entropy, 3),
}
except (OpticalCorruptionError, SpecularClippingError) as exc:
raise HTTPException(
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY, detail=str(exc)
)
# Hand off validated frame to Triton / TensorRT GPU workers
return {"status": "PASSED_TO_INFERENCE_ENGINE", "latency_us": metrics.duration_us}Stop silent model degradation.
Your GPU is expensive. Your data quality shouldn't be a mystery.
pip install vigilcv