Problem:
This problem occurs when you run your code on windows because windows paths use backslash ("\") instead of forward slash ("/").
As you see in the code:
  
      github.com
  
  
    pytorch/vision/blob/7b9d30eb7c4d92490d9ac038a140398e0a690db6/torchvision/datasets/ucf101.py#L94 3

    return self.full_video_clips.metadatadef _select_fold(self, video_list, annotation_path, fold, train):    name = "train" if train else "test"    name = "{}list{:02d}.txt".format(name, fold)    f = os.path.join(annotation_path, name)    selected_files = []    with open(f, "r") as fid:        data = fid.readlines()        data = [x.strip().split(" ") for x in data]        data = [os.path.join(self.root, x[0]) for x in data]        selected_files.extend(data)    selected_files = set(selected_files)    indices = [i for i in range(len(video_list)) if video_list[i] in selected_files]    return indicesdef __len__(self):    return self.video_clips.num_clips()def __getitem__(self, idx):    video, audio, info, video_idx = self.video_clips.get_clip(idx)



  
  
    
    
  
  


So, this line of code reads the file path from label file as “action\video_name” and merge it with “root” path using backslash therefore full path becomes like “root\action/video_name”. Such paths doesn’t match with the video lists at line#97 and returns empty list for indices variable.
Solution:
Two of possible solutions can be:

Replace the forwardslashes “/” in the label files with backslashes “\”.
Override the _select_fold(…) function of class UCF101 and fix the backslashes inside the function.