SSL92 / hyperIQA

Source code for the CVPR'20 paper "Blindly Assess Image Quality in the Wild Guided by A Self-Adaptive Hyper Network"
MIT License
361 stars 52 forks source link

In the hyperiqasolver.py file, why Param. Requires_grad = False? #16

Open huahua-c opened 3 years ago

huahua-c commented 3 years ago

Thank you very much for your work!I have some questions to ask you.Please help me.In the hyperiqasolver.py file, why Param. Requires_grad = False? Look forward to your answers. model_target = models.TargetNet(paras).cuda() for param in model_target.parameters(): param.requires_grad = False

SSL92 commented 3 years ago

Since the weight parameters of the target network are determined by the hyper network, the target network shoudn't participate the process of training.

Note that by setting 'Requires_grad = False', the target network doesn't allocate gradients during training, but it still delivers gradients to its former hyper network, which makes our model trainable.

huahua-c commented 3 years ago

I see. Thank you very much for your answer!

tengerye commented 3 years ago

Since the weight parameters of the target network are determined by the hyper network, the target network shoudn't participate the process of training.

Note that by setting 'Requires_grad = False', the target network doesn't allocate gradients during training, but it still delivers gradients to its former hyper network, which makes our model trainable.

Hi @SSL92, have you tried the other way? Is the result different?

tengerye commented 3 years ago

Hi @SSL92 @huahua-c, I tested and found the the program never ran into the for loop, for param in model_target.parameters():. These two lines are indeed redundant.