pmorerio / minimal-entropy-correlation-alignment

Code for the paper "Minimal-Entropy Correlation Alignment for Unsupervised Deep Domain Adaptation", ICLR 2018
MIT License
63 stars 17 forks source link

using log_coral_loss with large activation #3

Closed hcyoo93 closed 3 years ago

hcyoo93 commented 3 years ago

Hello, @pmorerio

Thank you for your nice work!

I got a question about calculating log_coral_loss.

Let say, activation after conv_layer is the size of [20, 256, 200, 176] (N, H, W, C respectively), it is too big to flatten and calculate the covariance matrix.

In this case, what can be a good solution? (1x1 convolution and 2d_maxpool would work properly...?) Do you have a similar experience?

Any advice and comments are welcome!

Thank you in advance.

pmorerio commented 3 years ago

Hi, thanks for you comment! So, I understand you want to compute covariance in between a batch of images (or feature maps). Easiest thing you could try is to average across spatial dimensions, in order to get an average feature vector [200,176] for your image/feature map. Alternatively, a flatten+FC layer could help you reducing the dimension in order to get a vector. Both of the alternatives, however, are somehow 'destroying' spatial correlation. You should probably ask yourself what kind of correlation is important in your problem. Hope this discussion could be of any help in your research. Best, P.

hcyoo93 commented 3 years ago

Thank you for your kind reply!

I would try the simple one(averaging across spatial dimension) first!

Best, Yoo

pmorerio commented 3 years ago

Wish you good luck with you project!