yangze0930 / NTS-Net

This is a PyTorch implementation of the ECCV2018 paper "Learning to Navigate for Fine-grained Classification" (Ze Yang, Tiange Luo, Dong Wang, Zhiqiang Hu, Jun Gao, Liwei Wang).
MIT License
452 stars 118 forks source link

Anchor boxes visualization #10

Open ygean opened 5 years ago

ygean commented 5 years ago

@yangze0930 Hi, I get self.top_n_cdds in model.py/attention_net and then I pad image to 896 x 896 size, draw anchor boxes in padded image. Have I done something wrong in this procedure? I wanna know how you visualize anchor boxes in image, I'd like you can reply as soon as possible sincerely, thanks a lot

zbxzc35 commented 5 years ago

可视化比较简单,这样做 `,anchors,=generate_default_anchor_maps() print type(anchors),anchors.shape

print len(anchors) for anc in anchors: if anc[0]<0 or anc[1]<0 or anc[2]<0 or anc[3]<0: print anc

import matplotlib.pyplot as plt xmin=-224 xmax=672 ymin=-224 ymax=672 fig = plt.figure(figsize=(8,8)) ax = fig.add_subplot(111) plt.xlim( (xmin, xmax) ) plt.ylim( (ymin, ymax) )

rect = plt.Rectangle((0.1,0.1),0.5,0.3)

ax.add_patch(rect)

for anch in anchors: rect = plt.Rectangle((anch[1],anch[0]),#(x0,y0) anch[3]-anch[1],#width anch[2]-anch[0],#height edgecolor='r', facecolor='none') ax.add_patch(rect) plt.show()`

ray-lee-94 commented 5 years ago

I want to know how to draw the box when testing , so that i can find if the network focus the most import regins. The paper had a amazing visualization.

ygean commented 5 years ago

Actually, I did it by my mentioned approach not zbxzc35 mentioned . But it seems does not have amazing visualization , which anchor boxes should be localized discriminative feature regions on image directly, my visualization result told me that effect of RPN module still confuses me. It need author's help to tell more details.

ygean commented 5 years ago

@VCBE123 I think you need to find anchor boxes selected by trained model and pad your image with constant value for resizing image's size and then, the way of drawing anchor boxes on PIL image format is easy on searching from stackoverflow.com, good luck for you, guy.

ray-lee-94 commented 5 years ago

@zhouyuangan Thank you for your help.

dongzhi0312 commented 5 years ago

@zbxzc35 为什么坐标是 -224 672 输入图片大小不是 448*448 吗,这样的设置不会导致坐标超出图片的大小吗

jxingm commented 5 years ago

@VCBE123 I think you need to find anchor boxes selected by trained model and pad your image with constant value for resizing image's size and then, the way of drawing anchor boxes on PIL image format is easy on searching from stackoverflow.com, good luck for you, guy.

Hello, when I run test.py on CUB_200 dataset, nothing has been output.Is this normal? then where to find the result of bounding boxes of the test images ? without the bbox information how can I visualize? I really need help.

dawnsdaw commented 4 years ago

@VCBE123 I think you need to find anchor boxes selected by trained model and pad your image with constant value for resizing image's size and then, the way of drawing anchor boxes on PIL image format is easy on searching from stackoverflow.com, good luck for you, guy.

Hello, when I run test.py on CUB_200 dataset, nothing has been output.Is this normal? then where to find the result of bounding boxes of the test images ? without the bbox information how can I visualize? I really need help.

I would like to ask, did you successfully draw the bounding box during the test? How to visualize? thank you very much.

atnegam commented 1 year ago

25