TL;DR
Querying massive image and video databases using deep learning is computationally expensive. This paper introduces TAHOMA, a system that accelerates visual queries by using cascades of small, specialized neural networks that optimize not just the model architecture, but also the physical representation of the input images (like resolution and color depth). By factoring in real-world data handling costs, TAHOMA achieves up to a 98x speedup over standard models like ResNet50 with zero loss in accuracy.
What Problem Does This Paper Address?
Deep Convolutional Neural Networks (CNNs) have revolutionized computer vision, but they are incredibly slow and computationally heavy. Running a state-of-the-art object detector over millions of video frames for a simple database query (e.g., "find all frames with a semitruck") is practically prohibitive.
Prior work has tried to speed this up using "cascades"—where fast, simple models filter out obvious negative examples before passing the hard cases to a heavy CNN. However, these approaches have a critical blind spot: they only optimize for inference compute time. They completely ignore data-handling costs, such as loading images from disk, decoding video, or resizing frames. Depending on the deployment architecture (e.g., an edge camera vs. a cloud archive), these data-handling bottlenecks can easily dominate the overall query time.
Methods
The authors propose TAHOMA, a system that generates and evaluates millions of potential classifier cascades to find the Pareto-optimal balance between accuracy and throughput for a specific hardware deployment.
- Input Transformations: Instead of just tweaking CNN hyperparameters (layers, nodes), TAHOMA aggressively alters the physical representation of the input data. It trains hundreds of small CNNs on heavily downsampled images (e.g., 30x30 pixels) and reduced color depths (e.g., single-channel grayscale or just the red channel).
- Deployment-Aware Cost Profiling: TAHOMA profiles the end-to-end throughput of these models based on specific deployment scenarios: Archive (loading from SSD + resizing), Ongoing (resizing on ingest), Camera (in-memory resizing from an edge sensor), and Infer Only (the traditional, compute-only metric).
- Cascade Building: It combines these diverse models into multi-level cascades. An image is passed to a tiny, fast model (e.g., operating on a 30x30 grayscale input); if the model is confident, it outputs the label. If uncertain, the image is passed to a slightly larger model, and so on, only hitting a heavy model like ResNet50 as a last resort.
Datasets
- ImageNet: Used a subset of 10 randomly chosen categories (e.g., acorn, amphibian, fence) to train and test binary "contains-object" predicates.
- Web Scraped Data: Gathered additional validation and evaluation images via Google and Bing image search to prevent overfitting to ImageNet's specific distribution.
- NoScope Datasets (Coral, Jackson): Used for direct benchmarking against Stanford's NoScope, a state-of-the-art video query system.
Key Insights and Ideas
- Pixels cost more than parameters: Reducing the physical size of the input (e.g., from 224x224 RGB to 30x30 grayscale) reduces the input tensor size by orders of magnitude. This yields a massive speedup that more than pays for the CPU cost of resizing the image.
- Context is everything for query optimization: The "fastest" cascade in a vacuum is rarely the fastest in production. If a cascade requires three different image resolutions, the cost to generate those representations might outweigh the inference savings if the system is bottlenecked by disk I/O.
- Scenario-awareness unlocks hidden throughput: By explicitly modeling the deployment environment (e.g., edge camera vs. archival storage), the optimizer can choose a cascade that avoids specific hardware bottlenecks, increasing throughput by up to 60% compared to a scenario-oblivious optimizer.
Key Results
- Massive Speedups: TAHOMA achieved up to a 98x average speedup over a fine-tuned ResNet50 baseline with no loss in accuracy.
- Extreme Throughput: If a user is willing to sacrifice ~12% accuracy, TAHOMA can process over 20,000 frames per second (a 280x speedup over ResNet50).
- Beating the State-of-the-Art: When compared directly to NoScope (and simulating NoScope's frame-differencing trick for fairness), TAHOMA was 3.1x faster on the coral dataset and 27.5x faster on the jackson dataset.
- Impact of Input Transforms: Cascades utilizing image resizing were roughly 10x faster than cascades that only relied on architecture tweaking without resizing.
Limitations and Future Work
- Combinatorial Explosion: Evaluating cascades deeper than three levels becomes computationally intractable (e.g., 4 levels means evaluating ~45 million combinations). The paper restricts cascades to 2 levels plus a final ResNet50 layer.
- Single Predicates Only: The current system optimizes for a single binary predicate at a time (e.g., "contains bicycle"). Future work will look at optimizing complex queries with multiple predicates simultaneously.
- Standalone Implementation: TAHOMA is currently a prototype standalone system. The authors note that for real-world use, these optimized cascades should be embedded as User-Defined Functions (UDFs) within a standard Relational Database Management System (RDBMS).
- Temporal Locality: While they simulated frame-differencing to compare with NoScope, natively exploiting the spatio-temporal locality of adjacent video frames (where frame $t$ is highly similar to frame $t+1$) is left for future work.
Summary updated