Skip to content

Commit

Permalink
Update dataset_classification.py (#1599)
Browse files Browse the repository at this point in the history
The indexing of 1 is incorrect. Given a path, it will think the file name is the first thing in the path. To be consistent with line 174 I simply replaced 1 with -1. But can also use os.path.basename(sample).split(".")[0]

I noticed this when I was using the feat_extract_pytorch.py in action_recognition, and tried to use my custom data paths in the txt file pointed to by VAL_ANNO_PATH in the configuration yaml files.
  • Loading branch information
Zarand3r authored Jan 27, 2021
1 parent 2672f9a commit 7f597e1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gluoncv/torch/data/video_cls/dataset_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def __getitem__(self, index):
sample = self.dataset_samples[index]
buffer = self.loadvideo_decord(sample)
buffer = self.data_transform(buffer)
return buffer, self.label_array[index], sample.split("/")[1].split(".")[0]
return buffer, self.label_array[index], sample.split("/")[-1].split(".")[0]

elif self.mode == 'test':
sample = self.test_dataset[index]
Expand Down

0 comments on commit 7f597e1

Please sign in to comment.