Skip to content

Commit 17b6ca9

Browse files
authored
Merge pull request #14 from RaivoKoot/sanity_checks
Add naive sanity check to see if each sample has any RGB frames
2 parents 5a65c71 + a08c1bf commit 17b6ca9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

video_dataset.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,19 @@ def __init__(self,
133133
self.test_mode = test_mode
134134

135135
self._parse_list()
136+
self._sanity_check_samples()
136137

137138
def _load_image(self, directory, idx):
138139
return [Image.open(os.path.join(directory, self.imagefile_template.format(idx))).convert('RGB')]
139140

140141
def _parse_list(self):
141142
self.video_list = [VideoRecord(x.strip().split(), self.root_path) for x in open(self.annotationfile_path)]
142143

144+
def _sanity_check_samples(self):
145+
for record in self.video_list:
146+
if record.num_frames <= 0 or record.start_frame == record.end_frame:
147+
print(f"\nDataset Warning: data sample {record.path} seems to have zero RGB frames on disk!\n")
148+
143149
def _sample_indices(self, record):
144150
"""
145151
For each segment, chooses an index from where frames

0 commit comments

Comments
 (0)