Video Classification using PytorchVideo

Now classify any video in a few lines of code

Parth Chokhra
Nerd For Tech
1 min readMay 22, 2021

--

A PyTorchVideo-based SlowFast model performing video action detection.

Facebook recently released a library named Pytorch Video. Usually, till now video-based framework never excited me due to high computational cost and memory requirements. But with Pytorchvideo both problem is handled quite efficiently. Not only it’s superfast it also doesn’t have much in-memory requirement with the support of mobile hardware.

So in this blog, I will give you a quick 5-minute demo of the library.

About PytorchVideo

PyTorchVideo is a deep learning library for research and applications in video understanding. It provides easy-to-use, efficient, and reproducible implementations of state-of-the-art video models, data sets, transforms, and tools in PyTorch.

Along with this, it can also take into account other modalities like audio and text. Furthermore, it also supports mobile devices using the Accelerator package.

Now let's see the PyTorch video in action. First, let's take a youtube video.

Let's classify the above video.

First, install the pytorchvideo library package

pip install pytorchvideo

Also, import JSON file containing classes

!wget https://dl.fbaipublicfiles.com/pyslowfast/dataset/class_names/kinetics_classnames.json

Final Code

So that’s all for classifying a video using PytorchVideo. Hope you like it!

--

--