diff --git a/transformers_doc/en/tensorflow/video_classification.ipynb b/transformers_doc/en/tensorflow/video_classification.ipynb index 87697b86..97638100 100644 --- a/transformers_doc/en/tensorflow/video_classification.ipynb +++ b/transformers_doc/en/tensorflow/video_classification.ipynb @@ -149,6 +149,51 @@ " ...\n", "```\n", "\n", + "You can then count the number of total videos." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import pathlib\n", + "dataset_root_path = \"UCF101_subset\"\n", + "dataset_root_path = pathlib.Path(dataset_root_path)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "video_count_train = len(list(dataset_root_path.glob(\"train/*/*.avi\")))\n", + "video_count_val = len(list(dataset_root_path.glob(\"val/*/*.avi\")))\n", + "video_count_test = len(list(dataset_root_path.glob(\"test/*/*.avi\")))\n", + "video_total = video_count_train + video_count_val + video_count_test\n", + "print(f\"Total videos: {video_total}\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "all_video_file_paths = (\n", + " list(dataset_root_path.glob(\"train/*/*.avi\"))\n", + " + list(dataset_root_path.glob(\"val/*/*.avi\"))\n", + " + list(dataset_root_path.glob(\"test/*/*.avi\"))\n", + " )\n", + "all_video_file_paths[:5]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ "The (`sorted`) video paths appear like so:\n", "\n", "```bash\n", @@ -784,7 +829,11 @@ ] } ], - "metadata": {}, + "metadata": { + "language_info": { + "name": "python" + } + }, "nbformat": 4, "nbformat_minor": 4 }