HumamAlwassel / TSP

TSP: Temporally-Sensitive Pretraining of Video Encoders for Localization Tasks (ICCVW 2021)
http://humamalwassel.com/publication/tsp/
MIT License
107 stars 16 forks source link

How do I calculate mean and std for a new dataset? #23

Closed xjtupanda closed 2 years ago

xjtupanda commented 2 years ago

Thanks for your inspiring code with detailed explanations! I have learnt a lot from that and now I'm trying to do some experiments in another dataset. But some implementation details confuse me.

I notice that in the dataset transform part, there is a normalizing step. normalize = T.Normalize(mean=[0.43216, 0.394666, 0.37645], std=[0.22803, 0.22145, 0.216989])

So how do I calculate the mean and std for a new dataset? Should I extract frames from videos first, then calculate mean & std inside all the frames in all videos for each RGB channel?

HumamAlwassel commented 2 years ago

Hello @xjtupanda ,

Thanks for your interest in TSP. Yes you are correct. However, it might be cheaper computationally to sample random parts of the videos and only do the mean and std calculations on these representatives samples.