debug: 固定验证集上的随机噪声,修复resnet在训练时bn层会切换到train的问题
This commit is contained in:
@@ -27,6 +27,16 @@ class ResNetBackbone(VLABackbone):
|
||||
param.requires_grad = False
|
||||
self.model.eval()
|
||||
|
||||
def train(self, mode=True):
|
||||
"""
|
||||
Override train() to keep frozen ResNet in eval mode.
|
||||
This ensures BatchNorm layers use running statistics consistently.
|
||||
"""
|
||||
super().train(mode)
|
||||
if hasattr(self, 'model'):
|
||||
self.model.eval() # Always keep ResNet in eval mode
|
||||
return self
|
||||
|
||||
def forward_single_image(self, image):
|
||||
B, T, C, H, W = image.shape
|
||||
image = image.view(B * T, C, H, W)
|
||||
|
||||
Reference in New Issue
Block a user