Pre-processing the video for training

UCF101 contains 13,320 video clips with a fixed frame rate and resolution of 25 FPS and 320 x 240 respectively. All video clips are stored in AVI format, so it is not convenient to use them in TensorFlow. Therefore, in this section, we will extract video frames from all the videos into JPEG files. We will only extract video frames at the fixed frame rate of 4 FPS so that we can reduce the input size of the network.

Before we start implementing the code, we need to install the av library from https://mikeboers.github.io/PyAV/installation.html.

First, create a Python package named scripts in the root folder. Then, create a new Python file at scripts/convert_ucf101.py. In the newly created file, add the ...

Get Machine Learning with TensorFlow 1.x now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.