Hi, @mario98 , have you solved this problem. I also want to use the mean and sigma of BN layers estimated from target domain , not in source domain. Which is actually the AdaBN 30. But I don’t known how can I complete simply?
Does it work now?



 mario98:

Interestingly, this approach fails spectacularly.
Here is my code where I want to adapt the batch norm statistics to my new test set:
    for module in my_model.modules():
      if type(module) == nn.BatchNorm2d:
        module.reset_parameters()
    for it, images in enumerate(test_set_loader):
      images = Variable(images.cuda(gpu_id), volatile=True)
      my_model(images)

The result is a dramatic drop in accuracy to almost random guessing. It’s a semantic segmentation task. In contrast, when I use the batch norm statistics estimated for (and during) training, the results are much better.
Where is my logic error? Or is this exactly the effect I was worried about that a running average with momentum is not equal to a true average?