← 开源

Effective Video Augmentation Techniques for Training Convolutional Neural Networks

Python
增长势头
+024 小时新增 Star0.0%
416
Star
77
Fork
4
贡献者
创建于 2018-06-11 · 更新于 2026-05-14 · 今日第 25886 名
主要开发者
okankopahmetgunduzdevksingh4
README

Video Augmentation Techniques for Deep Learning

This python library helps you with augmenting videos for your deep learning architectures. It converts input videos into a new, much larger set of slightly altered videos.

Original Video

Requirements and installation

Required packages:

  • numpy
  • PIL
  • scipy
  • skimage
  • OpenCV (i.e. cv2)

For installation, simply use sudo pip install git+https://github.com/okankop/vidaug. Alternatively, the repository can be download via git clone https://github.com/okankop/vidaug and installed by using python setup.py sdist && pip install dist/vidaug-0.1.tar.gz.

Examples

A classical video classification with CNN using augmentations on videos. Train on batches of images and augment each batch via random crop, random crop and horizontal flip:

from vidaug import augmentors as va

sometimes = lambda aug: va.Sometimes(0.5, aug) # Used to apply augmentor with 50% probability
seq = va.Sequential([
    va.RandomCrop(size=(240, 180)), # randomly crop video with a size of (240 x 180)
    va.RandomRotate(degrees=10), # randomly rotates the video with a degree randomly choosen from [-10, 10]  
    sometimes(va.HorizontalFlip()) # horizontally flip the video with 50% probability
])

for batch_idx in range(1000):
    # 'video' should be either a list of images from type of numpy array or PIL images
    video = load_batch(batch_idx)
    video_aug = seq(video)
    train_on_video(video)

The videos below show examples for most augmentation techniques:

Augmentation Type Augmented Video
Piecewise Affine Transform
Superpixel
Gausian Blur
Invert Color
Rondom Rotate
Random Resize
Translate
Center Crop
Horizontal Flip
Vertical Flip
Add
Multiply
Downsample
Upsample
Elastic Transformation
Salt
Pepper
Shear
排名相邻

AI Rank iPhone 版

随时追踪 AI 模型榜单

在 App Store 下载