question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ethanwharriscommented, Aug 23, 2021

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!

1reaction
ethanwharriscommented, Jun 21, 2021

@ValentinKovalev glad you got it working! PRs are always welcome 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found