in datasets/AVideoDataset.py [0:0]
def select_fold_hmdb51(video_list, annotation_path, fold, train, num_shots=-1):
print(f"Getting HMDB51 dataset. Train Mode: {train}, fold: {fold}", flush=True)
target_tag = 1 if train else 2
name = "*test_split{}.txt".format(fold)
files = glob.glob(os.path.join(annotation_path, name))
selected_files = []
for f in files:
with open(f, "r") as fid:
data = fid.readlines()
data = [x.strip().split(" ") for x in data]
data = [x[0] for x in data if int(x[1]) == target_tag]
selected_files.extend(data)
selected_files = set(selected_files)
if num_shots != -1 and num_shots > 0:
indices = [i for i in range(len(video_list)) if os.path.basename(video_list[i]) in selected_files]
indices = few_shot_setup(self.samples, indices, num_shots=self.num_shots)
print(f"Number of videos: {len(indices)}")
else:
indices = [i for i in range(len(video_list)) if os.path.basename(video_list[i]) in selected_files]
return indices