ly015 / intrinsic_flow

Pytorch implementation of the CVPR 2019 paper Dense Intrinsic Appearance Flow for Human Pose Transfer.

Home Page:http://mmlab.ie.cuhk.edu.hk/projects/pose-transfer/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

small batch_size causes bad result

piaozhx opened this issue · comments

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:
test_epochbest_bs8

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
test_epochbest_bs1

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:
test_epochbest_bs8_eval