facebookresearch / GDT

We present a framework for training multi-modal deep learning models on unlabelled video data by forcing the network to learn invariances to transformations applied to both the audio and video streams.
Apache License 2.0
45 stars 4 forks source link

AttributeError: 'AVideoDataset' object has no attribute '_split_idx' #6

Closed billhhh closed 3 years ago

billhhh commented 3 years ago

Thank you for sharing such a good work! I am trying to run the evaluation on UCF101, however I encountered the error

Traceback (most recent call last): File "/home/huwang/huwang/experiments/multimodal/GDT/eval_video.py", line 837, in <module> best_acc1, best_acc5, best_epoch = main(args, writer) File "/home/huwang/huwang/experiments/multimodal/GDT/eval_video.py", line 321, in main args=args, File "/media/data/huwang/experiments/multimodal/GDT/datasets/AVideoDataset.py", line 251, in __init__ self._construct_loader() File "/media/data/huwang/experiments/multimodal/GDT/datasets/AVideoDataset.py", line 288, in _construct_loader self.ds_name, self._split_idx, path_to_file AttributeError: 'AVideoDataset' object has no attribute '_split_idx'

Could you shed some light on how to solve this issue? Thank you!

XinyuSun commented 3 years ago

Dataset root is not specified. Try modifying the ROOT_DIR and MODE_DIR in datasets/GDTPretrainDataset.py file, line 54. Or set --root_dir in args.

# line 238
with open(path_to_file, "r") as f:
    for clip_idx, path in enumerate(f.read().splitlines()):
        for idx in range(self._num_clips):
            self._path_to_videos.append(
                os.path.join(self.data_prefix, path)
            )
            if self.ds_name != 'audioset':
                class_name = path.split('/')[-2]
                label = self.class_to_idx[class_name]
            self._labels.append(int(label))
            self._spatial_temporal_idx.append(idx)
            self._vid_indices.append(clip_idx)
            self._video_meta[clip_idx * self._num_clips + idx] = {}
assert (
    len(self._path_to_videos) > 0
), "Failed to load {} split {} from {}".format(
    self.ds_name, self._split_idx, path_to_file # the _split_idx arrtibute is undefined if assert failed
)
billhhh commented 3 years ago

Dataset root is not specified. Try modifying the ROOT_DIR and MODE_DIR in datasets/GDTPretrainDataset.py file, line 54. Or set --root_dir in args.

# line 238
with open(path_to_file, "r") as f:
    for clip_idx, path in enumerate(f.read().splitlines()):
        for idx in range(self._num_clips):
            self._path_to_videos.append(
                os.path.join(self.data_prefix, path)
            )
            if self.ds_name != 'audioset':
                class_name = path.split('/')[-2]
                label = self.class_to_idx[class_name]
            self._labels.append(int(label))
            self._spatial_temporal_idx.append(idx)
            self._vid_indices.append(clip_idx)
            self._video_meta[clip_idx * self._num_clips + idx] = {}
assert (
    len(self._path_to_videos) > 0
), "Failed to load {} split {} from {}".format(
    self.ds_name, self._split_idx, path_to_file # the _split_idx arrtibute is undefined if assert failed
)

Thx, the problem has been solved.