From 928331381ef6ce0622c0b1ac704299046b3afa21 Mon Sep 17 00:00:00 2001 From: manju rangam <158464478+manju-rangam@users.noreply.github.com> Date: Thu, 25 Apr 2024 13:49:30 +0100 Subject: [PATCH] Fix Issue #29817 Video Classification Task Guide Using Undeclared Variables (#30457) * Fix issue #29817 Video Classification Task Guide Using Undeclared Variables * Update docs/source/en/tasks/video_classification.md updated with review comments Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com> * Fix issue #29817 Add line space following PR comments --------- Co-authored-by: manju-rangam Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com> --- docs/source/en/tasks/video_classification.md | 25 ++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/docs/source/en/tasks/video_classification.md b/docs/source/en/tasks/video_classification.md index e3e998c7d6..f551948964 100644 --- a/docs/source/en/tasks/video_classification.md +++ b/docs/source/en/tasks/video_classification.md @@ -104,6 +104,31 @@ UCF101_subset/ ... ``` +You can then count the number of total videos. + +```py +>>> import pathlib +>>> dataset_root_path = "UCF101_subset" +>>> dataset_root_path = pathlib.Path(dataset_root_path) +``` + +```py +>>> video_count_train = len(list(dataset_root_path.glob("train/*/*.avi"))) +>>> video_count_val = len(list(dataset_root_path.glob("val/*/*.avi"))) +>>> video_count_test = len(list(dataset_root_path.glob("test/*/*.avi"))) +>>> video_total = video_count_train + video_count_val + video_count_test +>>> print(f"Total videos: {video_total}") +``` + +```py +>>> all_video_file_paths = ( +... list(dataset_root_path.glob("train/*/*.avi")) +... + list(dataset_root_path.glob("val/*/*.avi")) +... + list(dataset_root_path.glob("test/*/*.avi")) +... ) +>>> all_video_file_paths[:5] +``` + The (`sorted`) video paths appear like so: ```bash