- β‘οΈ 10-100x faster AI pipelines using SQL-like queries
- π° Save money spent on GPU-driven inference
- π¦ Built-in caching to avoid re-running deep learning models across queries
- π Over 20 AI-centric query optimization rules
- β¨οΈ First-party integrations for PyTorch and HuggingFace models
- π Installable via pip
- π€ Fully implemented in Python
EVA is an open-source AI-relational database with first-class support for deep learning models. It supports next-generation AI-powered database applications that operate on structured (tables) and unstructured data (videos, text, podcasts, PDFs, etc.) with deep learning models.
EVA accelerates AI pipelines by 10-100x using a collection of optimizations inspired by relational database systems, including function caching, sampling, and cost-based predicate reordering. It comes with a wide range of models for analyzing unstructured data, including models for image classification, object detection, OCR, text sentiment classification, face detection, etc. It is fully implemented in Python and licensed under the Apache license.
EVA supports an AI-oriented query language tailored for analyzing unstructured data. Here are some illustrative applications:
- Examining the emotion palette of actors in a movie
- Analysing traffic flow at an intersection
- Classifying images based on their content
- Recognizing license plates
- Analysing toxicity of social media memes
If you are wondering why you might need an AI-relational database system, start with the page on Video Database Systems. It describes how EVA lets you easily use deep learning models and save money spent on GPU-driven inference on large image or video datasets.
The Getting Started page shows how you can use EVA for different computer vision tasks: image classification, object detection, action recognition, and how you can easily extend EVA to support your custom deep learning model in the form of user-defined functions.
The User Guides section contains Jupyter Notebooks that demonstrate how to use various features of EVA. Each notebook includes a link to Google Colab to run the code.
Easily combine SQL and Deep Learning to build next-generation database applications
Easily query videos in user-facing applications with a SQL-like interface for commonly used computer vision models.Speed up queries and save money spent on model inference
EVA has built-in sampling, caching, and filtering optimizations inspired by time-tested relational database systems.Extensible by design to support custom deep learning models
EVA has first-class support for user-defined functions that wrap around your deep learning models in PyTorch and HuggingFace.- Install EVA using the pip package manager. EVA supports Python versions 3.7+.
pip install evadb
- To start and connect to an EVA server in a Jupyter notebook, check out this illustrative emotion analysis notebook:
cursor = connect_to_server()
- Load a video onto the EVA server (we use ua_detrac.mp4 for illustration):
LOAD VIDEO "data/ua_detrac/ua_detrac.mp4" INTO UADETRAC;
- That's it! You can now run queries over the loaded video:
SELECT id, data FROM UADETRAC WHERE id < 5;
- Search for frames in the video that contain a car
SELECT id, data FROM UADETRAC WHERE ['car'] <@ YoloV5(data).labels;
Source Video | Query Result |
---|---|
- Search for frames in the video that contain a pedestrian and a car
SELECT id, data FROM UADETRAC WHERE ['pedestrian', 'car'] <@ YoloV5(data).labels;
- Search for frames with more than three cars
SELECT id, data FROM UADETRAC WHERE ArrayCount(YoloV5(data).labels, 'car') > 3;
- You can create a custom user-defined function (UDF) that wraps around a fine-tuned or off-the-shelf deep learning model:
CREATE UDF IF NOT EXISTS MyUDF
INPUT (frame NDARRAY UINT8(3, ANYDIM, ANYDIM))
OUTPUT (labels NDARRAY STR(ANYDIM), bboxes NDARRAY FLOAT32(ANYDIM, 4),
scores NDARRAY FLOAT32(ANYDIM))
TYPE Classification
IMPL 'eva/udfs/fastrcnn_object_detector.py';
- Compose multiple user-defined functions in a single query to accomplish complicated AI pipelines.
-- Analyse emotions of faces in a video
SELECT id, bbox, EmotionDetector(Crop(data, bbox))
FROM MyVideo JOIN LATERAL UNNEST(FaceDetector(data)) AS Face(bbox, conf)
WHERE id < 15;
-
Besides making it easy to write queries for complex AI pipelines, EVA speeds up query execution using its AI-centric query optimizer. Two illustrative optimizations are:
πΎ Caching: EVA automatically caches and reuses previous query results (especially model inference results), eliminating redundant computation and reducing query processing time.
π― Predicate Reordering: EVA optimizes the order in which the query predicates are evaluated (e.g., runs the faster, more selective model first), leading to faster queries and lower inference costs.
Consider these two exploratory queries on a dataset of dog images:
-- Query 1: Find all images of black-colored dogs
SELECT id, bbox FROM dogs
JOIN LATERAL UNNEST(YoloV5(data)) AS Obj(label, bbox, score)
WHERE Obj.label = 'dog'
AND Color(Crop(data, bbox)) = 'black';
-- Query 2: Find all Great Danes that are black-colored
SELECT id, bbox FROM dogs
JOIN LATERAL UNNEST(YoloV5(data)) AS Obj(label, bbox, score)
WHERE Obj.label = 'dog'
AND DogBreedClassifier(Crop(data, bbox)) = 'great dane'
AND Color(Crop(data, bbox)) = 'black';
By reusing the results of the first query and reordering the predicates based on available cached results, EVA runs up the second query 10x faster!
Source Video | Query Result |
---|---|
Source Video | Query Result |
---|---|
Source Video | Query Result |
---|---|
License Plate Recognition (Plate Detection + OCR Extraction Models)
Query Result |
---|
Meme Toxicity Classification (OCR Extraction + Toxicity Classification Models)
Query Result |
---|
Join the EVA community on Slack to ask questions and to share your ideas for improving EVA.
EVA is the beneficiary of many contributors. All kinds of contributions to EVA are appreciated. To file a bug or to request a feature, please use GitHub issues. Pull requests are welcome.
For more information, see our contribution guide.
Copyright (c) 2018-2023 Georgia Tech Database Group. Licensed under Apache License.