• Stars
    star
    263
  • Rank 155,624 (Top 4 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created almost 7 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Transforms for video datasets in pytorch

torch_videovision - Basic Video transforms for Pytorch

This repository implements several basic data-augmentation transforms for pytorch video inputs

transform_image

The idea was to produce the equivalent of torchvision transforms for video inputs. (The code is therefore widely based on the code from this repository :) )

The basic paradigm is that dataloading should produce videoclips as a list of PIL Images or numpy.ndarrays (in format as read by opencv).

Several transforms are then provided in video_transforms.

Each transform iterates on all the images in the list and applies the wanted augmentation.

We then have to convert those inputs to torch tensors. This can be produced by the volume_transform.ClipToTensor class, which produces a video volume in format (n_channels, n_images, height, width) where n_channels = 3 in case of images.

When randomness is involved, the same random parameters (crop size, scale size, rotation angle,...) are applied to all the frames.

Transforms can be composed just as in torchvision with video_transforms.Compose.

To quickly see a demo of the transformations, run python testtransforms.py

This should produce something like the top image (this is a dummy clip for now, so the same image is repeated several times)

Advancement

video_transforms.py

  • Compose
  • Resize
  • CenterCrop
  • RandomCrop
  • RandomHorizontalFlip
  • RandomResize
  • RandomRotation
  • ColorJitter (acts on brightness, saturation, contrast and hue, only on PIL Images for now)
  • RandomResizedCrop

volume_transforms.py

  • ClipToTensor

  • Add profiling utilites

How to use

Install torch_videovision

pip install git+https://github.com/hassony2/torch_videovision

Thanks to bachsh !

In your python script

from torchvideotransforms import video_transforms, volume_transforms

video_transform_list = [video_transforms.RandomRotation(30),
			video_transforms.RandomCrop((200, 200))
			volume_transforms.ClipToTensor()]
transforms = video_transforms.Compose(video_transform_list)

More Repositories

1

manopth

MANO layer for PyTorch, generating hand meshes as a differentiable layer
Python
590
star
2

kinetics_i3d_pytorch

Inflated i3d network with inception backbone, weights transfered from tensorflow
Python
511
star
3

useful-computer-vision-phd-resources

Lists of resources useful for my PhD in computer vision
495
star
4

obman_train

[cvpr19] Demo, training and evaluation code for generating dense hand+object reconstructions from single rgb images
Python
186
star
5

obman

[cvpr19] Hands+Objects synthetic dataset, instructions to download and code to load the dataset
Python
144
star
6

inflated_convnets_pytorch

Inflate DenseNet and ResNet as per I3D with ImageNet weight transfer
Python
129
star
7

handobjectconsist

[cvpr 20] Demo, training and evaluation code for joint hand-object pose estimation in sparsely annotated videos
Python
121
star
8

homan

[3dv 2021] Joint fitting of hands and object from short RGB video clips
Python
87
star
9

obman_render

[cvpr19] Code to generate images from the ObMan dataset, synthetic renderings of hands holding objects (or hands in isolation)
Python
77
star
10

interview-prep

Notes on preparing for coding interviews during my PhD
Python
61
star
11

inria-research-wiki

Wiki for my research notes
52
star
12

shape_sdf

Python
44
star
13

libyana

Utility functions that I reuse across different projects
Python
14
star
14

synthetic-hands

Python
12
star
15

pyrender_sdf

Minimal rendering in python for shapes defined implicitely through signed distance functions
Python
11
star
16

conda_colmap

CMake
8
star
17

multiperson

pytorch 1.6-compatible NMR
Python
6
star
18

hourglass-hands

Jupyter Notebook
3
star
19

flow-toolbox

C++
3
star
20

mva

Homeworks and project for the MVA (Mathematics, Vision, Learning) master
Jupyter Notebook
2
star