XiaLiPKU / EMANet

The code for Expectation-Maximization Attention Networks for Semantic Segmentation (ICCV'2019 Oral)
https://xialipku.github.io/publication/expectation-maximization-attention-networks-for-semantic-segmentation/
GNU General Public License v3.0
680 stars 130 forks source link

How do you implement the equation(15) in your paper? #5

Closed Dorispaopao closed 4 years ago

Dorispaopao commented 5 years ago

And how to consider the gradient backpropgation in your implement?

XiaLiPKU commented 5 years ago

For the first question: I implemented it in the 'train.py' https://github.com/XiaLiPKU/EMANet/blob/9a492d8aaad297e15eac044b3bb9583e63ffa3a3/train.py#L134. Implement it in the EMAU module may be more good-looking. But as the \mu has to be averaged on the whole batch, implementing it in the module needs the 'reduce' operation as in SyncBN. So I just write the line in the 'train.py', where the \mu from all GPUs are already together here.

XiaLiPKU commented 5 years ago

And how to consider the gradient backpropgation in your implement?

For the second question:

I simple cut off the gradients for the A_E and A_M iterations as https://github.com/XiaLiPKU/EMANet/blob/9a492d8aaad297e15eac044b3bb9583e63ffa3a3/network.py#L227. To be honest, there lacks deep exploration of what happens inside the EMA. So EMANet is just a naive exploration on the EM + Attention mechanism. So, I just look forward for more deep analysis by dear followers.