wfcrgt:

modules = list(resnet.children())[:-2] # delete the last fc layer


In python, [:,-2] pratically removes the last two layers in ResNet, including self.layer4 and self.fc, causing your modified ResNet50MoveLinear network  to lack ‘layer4’， which degraded performance.