Skip to main content

EVA Video Database System (Think MySQL for videos).

Project description

EVA

Try It Out!

Logo Open EVA on Colab Slack Discuss on Github! PyPI License Python Versions

EVA AI-Relational Database System

  • ⚡️ 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:

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.

Why EVA?

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.

Links

Quick Start

  • Install EVA using the pip package manager. EVA supports Python versions 3.7+.
pip install evadb
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
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!

Illustrative EVA Applications

Traffic Analysis (Object Detection Model)

Source Video Query Result
Source Video Query Result

MNIST Digit Recognition (Image Classification Model)

Source Video Query Result
Source Video Query Result

Movie Analysis (Face Detection + Emotion Classfication Models)

Source Video Query Result
Source Video Query Result

License Plate Recognition (Plate Detection + OCR Extraction Models)

Query Result
Query Result

Meme Toxicity Classification (OCR Extraction + Toxicity Classification Models)

Query Result
Query Result

Community

Join the EVA community on Slack to ask questions and to share your ideas for improving EVA.

EVA Slack Channel

Architecture Diagram of EVA

EVA Architecture Diagram

Contributing to EVA

PyPI Version CI Status Coverage Status Documentation Status

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.

License

Copyright (c) 2018-2023 Georgia Tech Database Group. Licensed under Apache License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

evadb-0.2.1.tar.gz (306.1 kB view details)

Uploaded Source

Built Distribution

evadb-0.2.1-py3-none-any.whl (561.6 kB view details)

Uploaded Python 3

File details

Details for the file evadb-0.2.1.tar.gz.

File metadata

  • Download URL: evadb-0.2.1.tar.gz
  • Upload date:
  • Size: 306.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.10.1 urllib3/1.26.13 tqdm/4.44.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.3

File hashes

Hashes for evadb-0.2.1.tar.gz
Algorithm Hash digest
SHA256 c2eea61ad5c99c0c6d2e79ecf5c17be36fc08f8a46b26675addf5f16911470ec
MD5 5e034560c8de7deb8a71a127cb89dbe0
BLAKE2b-256 6c098f34de6ed71447a969d9f095b0242273ecc5597b938b358fd98c0c2200c4

See more details on using hashes here.

File details

Details for the file evadb-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: evadb-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 561.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.10.1 urllib3/1.26.13 tqdm/4.44.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.3

File hashes

Hashes for evadb-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2a309453ed30ea6ce6b738e514d1b74568399c6daea31bd69b70b09077d3bbc0
MD5 76f0160a0c23f550a202e661dbd60964
BLAKE2b-256 89129e1c5368a5ec26cc3081ea4b9bffca51fadc568b9cf03f1739fea2f141df

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page