def __init__(self, video_name): # ex: filename = 916710595466737253411014029368.mp4 os.chdir(VIDEOS_URL) self.video_name = video_name ## get basic decode information frames_type = coviexinfo.get_num_frames(video_name) self.num_frames = frames_type.shape[1] self.num_I = np.sum(frames_type[0] == 1).item()
def count(data_root): os.chdir(data_root) average_frames = AverageMeter() videos = os.listdir(data_root) random.shuffle(videos) cnt=0 for video in tqdm(videos): frames_type = coviexinfo.get_num_frames(video) average_frames.update(frames_type.shape[1]) cnt+=1 if cnt%10==0: print("This dataset average frames number is %f" % average_frames.avg)