Calling
train_videos = train_videos[:-5]val_videos = train_videos[-5:]
in this order first deletes the last 5 videos from train videos and then assigns the new last 5 to validation, resulting in unused data and data leakage.
This can be fixed by swapping the order of these calls
val_videos = train_videos[-5:]train_videos = train_videos[:-5]
such that the 5 videos are first assigned as val and then removed from train.
Calling
train_videos = train_videos[:-5]
val_videos = train_videos[-5:]
in this order first deletes the last 5 videos from train videos and then assigns the new last 5 to validation, resulting in unused data and data leakage. This can be fixed by swapping the order of these callsval_videos = train_videos[-5:]
train_videos = train_videos[:-5]
such that the 5 videos are first assigned as val and then removed from train.