Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Latest commit

 

History

History
47 lines (36 loc) · 1.26 KB

README.md

File metadata and controls

47 lines (36 loc) · 1.26 KB

tf-video-preprocessing

TensorFlow video preprocessing layers

While working on a video classification model, I was in need of a video augmentation layers, however TensorFlow only provided image processing functions and layers. This led me to the creation of layers for a video processing pipeline.

Most of the implemented functions are analogous to their image counterparts from TensorFlow and Keras.

So far, these are implemeted:

  • Random zoom (VideoRandomZoom)
  • Random rotation (videoRandomRotation)
  • Random crop (VideoRandomCrop)
  • Random contrast (VideoRandomContrast)
  • Random flip (VideoRandomFlip)
  • Resizing
  • Center crop
  • Rescaling
  • Random translation
  • Random height
  • Random width

Install

pip install tf-video

Usage

Use both using Sequential and Functional TF API, as you would normally do with image preprocessing layers

import tensorflow as tf
from tf_video import VideoRandomFlip, VideoRandomContrast

input_video = ...
model = tf.keras.models.Sequential([
    VideoRandomFlip('horizontal_and_vertical'),
    VideoRandomContrast(0.3)
])

aug = model(input_video)