Giter VIP home page Giter VIP logo

dtw-sofar's Introduction

dtw-sofar

PyPI License GitHub issues Build Status codecov

Overview

This library implements the "Dynamic Time Warping Algorithm" for multimodal research in a way it can warp the time series received "so far." In other words, it modifies the dynamic time warping algorithm to be compatible with 'iterative stimuli' (when future points in the time series are received one by one).

One motivating application is aligning natural language annotations and video frames for research on Visual Language Models (e.g. CLIP by OpenAI), when the latter's embeddings are received frame by frame (e.g. we're making observations and don't have access to future frames). With "dtw-sofar," we can predict optimally matching annotations to new video frames on the fly - by relying on temporal information available "so far."

Development and Contributions

For development details and contribution instructions, please refer to the contribution guidelines.

Installation:

First, install Python 3.7 (or later) and numpy, and then install this repo as a Python package.

$ pip install numpy
$ pip install dtw-sofar

Quick Start Examples:

Below is a sample use-case for quick start:

import importlib
import numpy as np
dtwsofar = importlib.import_module('dtw-sofar.dtw_sofar')

video_features = np.load('CLIP_video_embeddings_path')
text_features = np.load('CLIP_text_embeddings_path')

# iterates over each RGB frame's CLIP embeddings and classifies matching text embeddings on-the-fly:
final_path, dtw_matrix, onthefly_predictions, onthefly_path = dtwsofar.dtw_onthefly_classification(video_features, text_features)

This use case demonstrates performing dynamic time warping so-far on image and natural language embeddings from Open AI's CLIP Model, so as to align them. See the overview for relevance.

This library can also be used for simpler time-series:

# time-series to be aligned with dynamic time warping "so far":
time_series_a = np.random.rand(100, 1)
time_series_b = np.random.rand(35,1)

final_path, dtw_matrix, onthefly_alignment, onthefly_path = dtwsofar.dtw_onthefly_classification(time_series_a, time_series_b)

dtw-sofar's People

Contributors

egeozguroglu avatar

Forkers

columbiamancera

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.