The mathematical way is just summing up everything channel-wise for the whole dataset and dividing by amount of pixels.
As imagenet is huge they may have chosen a subset of images or maybe mean per-image means (if images are same size it’s equivalent to the first operation).