wenyu1009 / RTSRN

MIT License
17 stars 2 forks source link

hog loss #1

Closed 649459021 closed 11 months ago

649459021 commented 1 year ago

Hi,

thanks for releasing this nice work! I have a question about the implementation of HOG loss.

Why use @torch.no_grad() at HOGLayerC forward function ? The gradient of HOG loss cannot participate in back propagation.

wenyu1009 commented 1 year ago

Hi,

Thank you for your interest in our work! You've raised an important point regarding the implementation of HOG loss, which I admittedly overlooked earlier. The HOGLayerC function implementation is inspired by the CVPR 2022 paper "Masked Feature Prediction for Self-Supervised Visual Pre-Training". After reflecting on your question, I believe the following two points are crucial:

Non-Differentiability of HOG Features: The computation of HOG features involves operations such as edge detection, histogram binning, and normalization. Many of these operations are non-differentiable or lack well-defined gradients. As a result, even if gradients were computed for these features, they wouldn't effectively contribute to the backpropagation process in neural network training.

Additional Regularization Effect: Despite the non-differentiability of HOG features, they can still provide indirect regularization. This means that HOG features may help the model focus on key aspects of images, such as edges and textures, thereby improving the results.

Furthermore, our ablation studies (Table 7)and visualization results (Figure 6) in the paper demonstrate that this loss can indeed help the model to focus on certain critical features of images.

I hope this clarifies your query!