Open JuanFMontesinos opened 5 years ago
Thanks for opening the issue!
Adding support for video data is in the plans, and will be integrated in the next major release of torchvision. This also involves the transforms.
Hi! Could you tell me which branch contains those changes? pretty sure it will be better than what I'm suggesting.
It's currently in a private branch, I'm working on some other things now and I'll get back to video once I've finished those next tasks, hopefully by the end of the week
@fmassa Are there news on this already? Using these transforms in video clips would be very useful for us right now.
@kateiyas You can download a pip package called flerken (under development), which contains a framework for pytorch but also torchvision adapted for video You can import these submodules and they act as a drop-in wrt torchvision transforms if you input a list of frames instead of a single frame it will apply the same transformation to all of them and then reset with new random parameters from flerken.dataloaders import transforms as T from flerken.dataloaders.transforms import Compose
You have all the torchvision transforms there (only main compose class has been rewritten)
@JuanFMontesinos Thanks, but a few small adaptations to this package fulfilled my needs: https://github.com/hassony2/torch_videovision Good luck with your project though!
I hope all of this will be integrated into pytorch soon.
We got a bit late with the work on video. It won't be present in the 0.3 release, but in the next one.
@fmassa What is the rough timeline that you have in mind for releasing the major changes in the torchvision.transform
?
@ekagra-ranjan
Next release with video is planned for end of July.
First PR adding video reading is already merged in https://github.com/pytorch/vision/pull/1039
@JuanFMontesinos you might also be interested in https://torchvideo.readthedocs.io/en/latest/
@willprice thanks! It looks really nice
TorchVision 0.4 with support for video has been released, see https://github.com/pytorch/vision/releases/tag/v0.4.0
We still need to adapt the default transforms to support video data, but that might be a breaking change so we currently have them in the references/video_classification
folder
Initial set of transforms for video have been added in https://github.com/pytorch/vision/pull/1353 There will still be some refactoring happening, so it shouldn't be considered to be used in its current state, but it will soon be ready for consumption.
@fmassa I believe these have been closed by @vfdev-5 s tensor transform PRs.
Do you think it's safe to close this?
What is a current state with video transformation?
What I've understood so far is that there was a plan to add transformation. Currently _transforms_video.py and _functional_video.py remain private. From this I can assume that these files won't live long and will be discarded soon.
@Greeser with the upcoming release, almost all torchvision transformations will work on tensors of shape (B, C, H, W)
which should cover the scope of _transforms_video.py
. See https://github.com/pytorch/vision/tree/master/examples/python and please keep in mind that these examples are subject to a minor changes before the official release.
Motivation
I've realized that the way torchvision is coded it's not possible to store a transformation to be applied several times. Video requires the same transformation to be applied to the whole sequence.
Proposed changes
I propose to restructure the code with minor changes such that:
A base transformation class (template) were created, providing get_params and reset_params method:
get_params would provide needed parameters if necessary meanwhile reset_params would act as param initilizer + reseter.
To modify compose class to deal with list/tuples of frames such that when the list were exhausted, paramters would be reset:
To set random parameters and image parameters as object attributes. As some parameters requires image features to be computed, parameters would be initialized as None and computed/stored with the 1st frame:
Example 1:
Example 2: