Oh sorry for the confusion. It’s not sample-dependent but dataset-dependent. For example here you can find the parameters for imagenet. In short people computes an average of all the images of the dataset (assuming you are working with pictures and no other kind of data)

  
      github.com
  
  
    pytorch/examples/blob/master/imagenet/main.py#L195-196 46

        print("=> loaded checkpoint '{}' (epoch {})"
              .format(args.resume, checkpoint['epoch']))
    else:
        print("=> no checkpoint found at '{}'".format(args.resume))


cudnn.benchmark = True


# Data loading code
traindir = os.path.join(args.data, 'train')
valdir = os.path.join(args.data, 'val')
normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406],
                                 std=[0.229, 0.224, 0.225])


train_dataset = datasets.ImageFolder(
    traindir,
    transforms.Compose([
        transforms.RandomResizedCrop(224),
        transforms.RandomHorizontalFlip(),
        transforms.ToTensor(),
        normalize,
    ]))



  
  
    
    
  
  


in lines 195-196 provided for torchvision models.
normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])

You may find this interesting

  
      stats.stackexchange.com
  
  
      
    
  

  Why normalize images by subtracting dataset's image mean, instead of the current image mean in deep learning? 267



  deep-learning, image-processing



  asked by
  
  
    Max Gordon
  
  on 11:11AM - 08 May 16 UTC