Git Product home page Git Product logo

otam-video-via-temporal-alignment's Introduction

OTAM-Video via Temporal Alignment

This code is implemented based on Soft DTW for PyTorch in CUDA depending on PyTorch and Numba. It includes three choice:

  1. update2_down: down or along the main diagonal.

  2. update2_right: right or along the main diagonal.

  3. update3: down or right or along the main diagonal.

Example Usage

You can also run the included profiler/test (tested with Python v3.6), and see the speedups you'd get:

git clone https://github.com/wangzehui20/OTAM-Video-via-Temporal-Alignment
cd OTAM-Video-via-Temporal-Alignment
python softerdtw_padquery_update2_right.py

A sample code is already provided in the script. Here's a quick example:

from softerdtw_padquery_update2_right import SoftDTW

# Create the sequences
batch_size, len_x, len_y, dims = 8, 15, 12, 5
x = torch.rand((batch_size, len_x, dims), requires_grad=True)
y = torch.rand((batch_size, len_y, dims))

# Create the "criterion" object
sdtw = SoftDTW(use_cuda=True, gamma=0.1)

# Compute the loss value
loss = sdtw(x, y)  # Just like any torch.nn.xyzLoss()

# Aggregate and call backward()
loss.mean().backward()

Learn More

you can learn about algorithm in Few-Shot Video Classification via Temporal Alignment.

If you want to see alignment path between two features, you can run ...path.py in save path file.

otam-video-via-temporal-alignment's People

Contributors

wangzehui20 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

otam-video-via-temporal-alignment's Issues

CPU and GPU versions have different results

Hi, I follow the Example Usage but an error occurred:
Profiling forward() + backward() times for batch_size=128, seq_len_a=17, seq_len_b=15, dims=2... Traceback (most recent call last): File "softerdtw_padquery_update2_right.py", line 530, in <module> profile(128, 17, 15, 2, tol_backward=1e-6) File "softerdtw_padquery_update2_right.py", line 506, in profile assert torch.allclose(forward_cpu, forward_gpu.cpu()) AssertionError
It seems that CPU and GPU versions have different results?

Full code

Hello, when are you planning to release the full code?

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.