haitongli/knowledge-distillation-pytorch

Computing teacher outpouts is called only onece?

ssqfs opened this issue · 1 comments

ssqfs commented

Teacher model's outputs are only computed before training epoch. https://github.com/peterliht/knowledge-distillation-pytorch/blob/master/train.py#L277

It assumes that inputs are fixed in each epoch. But the inputs are different in each epoch due to the random transform operations, e.g. randonCrop, randomFlip.
I think the right way is to recalculate teacher's outputs in each epoch.
Is it a bug?

I think so.
Especially, you set shuffle dataset to True.
In this case, every epoch is different, even if you do not use data augmentation.