intrinsic_flow
intrinsic_flow copied to clipboard
small batch_size causes bad result
when I run the test scripts with batch_size=8:
python scripts/test_pose_transfer_model.py --gpu_ids 0 --id PoseTransfer_0.5 --batch_size 8 --n_vis 8 --which_epoch best --save_output
the results look well:
but if I change batch_size to 1:
python scripts/test_pose_transfer_model.py --gpu_ids 0 --id PoseTransfer_0.5 --batch_size 1 --n_vis 8 --which_epoch best --save_output
the results are different and worse than batch_size=8
This is probably caused by the BN layer in the model. BN layers will track running statistics (mean and variance) in testing, so using a different batch_size from training setting (especially small batch_size like 1) will change the statistics of a minibatch, and lead to worse performance.
To figure out this problem, a usual method is fixing the parameters of BN layers in evaluation phase:
model = model.eval()
I test the results but they are not good as before: