AlexHex7 / Non-local_pytorch

Implementation of Non-local Block.
Apache License 2.0
1.57k stars 277 forks source link

Visualization of Nonlocal Map #37

Open songkq opened 4 years ago

songkq commented 4 years ago

Hi, @AlexHex7 . I was confused how to implement visualization of the Nonlocal Map.

As for the Nonlocal Map of Net.nl_2 layer, which size is (49, 9), and the code you released first reshapes each row of nl_map to (3, 3) and converts it to (56, 56, 3) as the resized-input image. Then directly add the image and heat_map by a weighted sum to obtain img_add as the attention visualization for current query rect[(y0, x0), (y1, x1)].

Why each row of nl_map can represent the attention of current query?