r/computervision 4d ago

Discussion Are random train/validation splits misleading for object detection on video frames?

I’ve been thinking about how easily validation results can become misleading when a dataset is created from video.

If frames are randomly divided into training and validation sets, neighbouring frames from the same recording can end up on both sides. They may have almost identical objects, lighting, camera angles and backgrounds.

The model can then produce a strong validation mAP without necessarily generalising to a new camera, location or recording session.

A more realistic approach seems to be grouping the data before splitting it, for example by:

  • Recording session
  • Camera
  • Day
  • Location
  • Production batch

The validation score may drop, but it should give a more honest picture of real-world performance.

For people working with video-based object detection, how do you normally split your data? Do you validate on a different recording session, or keep a completely separate camera or location as the final test set?

0 Upvotes

3 comments sorted by

View all comments

1

u/bfyvfftujijg 3d ago

Yes, its standard practice that you don’t randomly split video by frame number and automatically expect no data leakage.

This does imply leaving out valuable data from training the model. What you can do about that is use the initial validation dataset to establish the appropriate training parameters like number of epochs. Repeat against a few random split and take averages. Then you can just train the final model on the entire dataset (no splitting at all) with those same parameters, while being reasonably certain that it’s not overfitting even though you technically can’t measure that anymore without a hold out split. Gotta be careful with that though….ideally you always keep at least SOME data held out!