Video classification example from lightning-flash/flash_examples/predict/video_classification.py not works
See original GitHub issue🐛 Bug
To Reproduce
Steps to reproduce the behavior:
install flash using pip install git+https://github.com/PytorchLightning/lightning-flash.git@master
install pytorch video using pip install pytorchvideo
Execute the example for the video classification task:
2. Make a prediction
predictions = model.predict("data/kinetics/predict/")
Get the error:
predictions = model.predict("data/kinetics/predict/")
File "/home/ubuntu/.local/lib/python3.7/site-packages/flash/core/model.py", line 77, in wrapper
result = func(self, *args, **kwargs)
File "/home/ubuntu/.local/lib/python3.7/site-packages/flash/core/model.py", line 213, in predict
x = [x for x in data_pipeline.data_source.generate_dataset(x, running_stage)]
File "/home/ubuntu/.local/lib/python3.7/site-packages/flash/core/model.py", line 213, in <listcomp>
x = [x for x in data_pipeline.data_source.generate_dataset(x, running_stage)]
File "/home/ubuntu/.local/lib/python3.7/site-packages/flash/core/data/auto_dataset.py", line 96, in __getitem__
return self._call_load_sample(self.data[index])
File "/home/ubuntu/.local/lib/python3.7/site-packages/flash/core/data/auto_dataset.py", line 87, in _call_load_sample
sample = self.load_sample(sample)
File "/home/ubuntu/.local/lib/python3.7/site-packages/flash/video/classification/data.py", line 85, in predict_load_sample
sample.update(self._encoded_video_to_dict(EncodedVideo.from_path(video_path)))
File "/home/ubuntu/.local/lib/python3.7/site-packages/flash/video/classification/data.py", line 96, in _encoded_video_to_dict
) = self.clip_sampler(0.0, video.duration)
TypeError: __call__() missing 1 required positional argument: 'annotation'
Environment
- PyTorch Version: 1.9.0+cu111
- OS :Ubuntu 18.04
- How you installed PyTorch (
conda,pip, source): pip - Build command you used (if compiling from source): –
- Python version: 3.7.10
- CUDA/cuDNN version: cuda 11.1
- GPU models and configuration:
- Any other relevant information:
Additional context
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Video Classification | Video Classification Model In Python
An overview of video classification. A deep learning guide to build video classification models in Python and learn about video ...
Read more >Video classification with Keras and Deep Learning
In this tutorial, you will learn how to perform video classification using Keras, Python, and Deep Learning.
Read more >Video Classification with a CNN-RNN Architecture - Keras
This example demonstrates video classification, an important use-case with applications in recommendations, security, and so on.
Read more >Video classification | TensorFlow Lite
Video classification is the machine learning task of identifying what a video represents. A video classification model is trained on a video ...
Read more >Introduction to Video Classification and Human Activity ...
Finally, make a video classifier using Keras. ... This is also the reason the approaches above will not work well when the actions...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hi @ValentinKovalev sorry for the delayed reply! You can take a look at the default transforms we use here: https://github.com/PyTorchLightning/lightning-flash/blob/828fbf09a0150d795271310e7208fdf50c996bd9/flash/video/classification/data.py#L278 - you should be able to adapt that to your needs. Hope that helps!
@ValentinKovalev glad you got it working! PRs are always welcome 😃