The BBC Dataset, proposed by Baraldi et al. in A deep siamese network for scene detection in broadcast videos Link: https://arxiv.org/abs/1510.08893 The dataset consists of 11 videos (BBC/videos/bbc_01.mp4 to BBC/videos/bbc_11.mp4). The annotated scenes are provided in correspon
| 3 | |
| 4 | |
| 5 | class BBCDataset: |
| 6 | """ |
| 7 | The BBC Dataset, proposed by Baraldi et al. in A deep siamese network for scene detection in broadcast videos |
| 8 | Link: https://arxiv.org/abs/1510.08893 |
| 9 | The dataset consists of 11 videos (BBC/videos/bbc_01.mp4 to BBC/videos/bbc_11.mp4). |
| 10 | The annotated scenes are provided in corresponding files (BBC/fixed/[i]-scenes.txt). |
| 11 | """ |
| 12 | |
| 13 | def __init__(self, dataset_dir: str): |
| 14 | self._video_files = [ |
| 15 | file for file in sorted(glob.glob(os.path.join(dataset_dir, "videos", "*.mp4"))) |
| 16 | ] |
| 17 | self._scene_files = [ |
| 18 | file for file in sorted(glob.glob(os.path.join(dataset_dir, "fixed", "*.txt"))) |
| 19 | ] |
| 20 | assert len(self._video_files) == len(self._scene_files) |
| 21 | for video_file, scene_file in zip(self._video_files, self._scene_files, strict=True): |
| 22 | video_id = os.path.basename(video_file).replace("bbc_", "").split(".")[0] |
| 23 | scene_id = os.path.basename(scene_file).split("-")[0] |
| 24 | assert video_id == scene_id |
| 25 | |
| 26 | def __getitem__(self, index): |
| 27 | video_file = self._video_files[index] |
| 28 | scene_file = self._scene_files[index] |
| 29 | return video_file, scene_file |
| 30 | |
| 31 | def __len__(self): |
| 32 | return len(self._video_files) |