Open swjtulinxi opened 3 years ago
同问,是在那个文件的程序里实现的?
1 Get attention feature from PAM/CAM, you should modify forward code(models/base.py) (feed the whole image to a network) 2 Modify test.py to save attention feature((using np.save(XXX.npy))),shape is BxNxN 3 For PAM, we decode the saved attention feature (using np.load(XXX.npy)), each row is an attention map for the corresponding pixel, then, you can resize img (20481020) to (256128) and get pixel index form image(x,y value), where you need (like one pixel from a person or a car ), the row of the pixel of attention is M = W * y + x, attention[:,M:M+1,:] is Mth attention map for the corresponding pixel. 4 For CAM, when u save the feature map(before/after apply CAM), then u can use opencv(function: applyColorMap) to visualize.
118