daijifeng001 / MNC

Instance-aware Semantic Segmentation via Multi-task Network Cascades
Other
489 stars 182 forks source link

IndexError: index 4 is out of bounds for axis 1 with size 4 while running demo.py #34

Open wuzheng-sjtu opened 7 years ago

wuzheng-sjtu commented 7 years ago

Hi, @Oh233 and @daijifeng001

Thanks a lot for sharing your great work.

I have trained the mnc-5stage network using my own training dataset(which only contains one type of object) and got a AP value on my testing data. But when I ran demo.py to visualize the output, I got this error. Can you help me please? Thanks in advance.

Traceback (most recent call last): File "./tools/demo.py", line 151, in 100, im.shape[1], im.shape[0]) File "/home/cewu/MNC/tools/../lib/transform/mask_transform.py", line 234, in gpu_mask_voting inds = nms(dets, cfg.TEST.MASK_MERGE_NMS_THRESH) File "/home/cewu/MNC/tools/../lib/nms/nms_wrapper.py", line 19, in nms return gpu_nms(dets, thresh, device_id=cfg.GPU_ID) File "nms/gpu_nms.pyx", line 24, in nms.gpu_nms.gpu_nms (nms/gpu_nms.cpp:1754) IndexError: index 4 is out of bounds for axis 1 with size 4

zhuanshen123 commented 7 years ago

Hi, I have encountered the same problem, have you solved it?

ZhuangNi commented 7 years ago

I have the same problem! Have any advices?

zhuanshen123 commented 7 years ago

Sorry, I did not solve this problem.

At 2017-04-18 16:08:28, "ZhuangNi" notifications@github.com wrote:

I have the same problem! Have any advices?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

chituma110 commented 7 years ago

@ZhuangNi I trained R-FCN and I had the same problem,Did you solved the problem?

File "nms/gpu_nms.pyx", line 24, in nms.gpu_nms.gpu_nms (nms/gpu_nms.cpp:1556) IndexError: index 4 is out of bounds for axis 1 with size 4

zhuanshen123 commented 7 years ago

Sorry, I did not solve this problem.

At 2017-04-18 22:32:47, "Qishang Cheng" notifications@github.com wrote:

@ZhuangNi I trained R-FCN and I had the same problem,Did you solved the problem?

File "nms/gpu_nms.pyx", line 24, in nms.gpu_nms.gpu_nms (nms/gpu_nms.cpp:1556) IndexError: index 4 is out of bounds for axis 1 with size 4

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

ZhuangNi commented 7 years ago

@zhuanshen123 @chituma110 We should ensure the labels of the bounding box are between the weight and the height of the image, or the program will assert (boxes[:, 2] >= boxes[:, 0]).all(). In _load_pascal_annotations(): x1 = float(bbox.find('xmin').text) - 1 y1 = float(bbox.find('ymin').text) - 1 x2 = float(bbox.find('xmax').text) - 1 y2 = float(bbox.find('ymax').text) - 1 In append_flipped_rois(): boxes = self.roidb[i]['boxes'].copy() oldx1 = boxes[:, 0].copy() oldx2 = boxes[:, 2].copy() boxes[:, 0] = widths[i] - oldx2 - 1 boxes[:, 2] = widths[i] - oldx1 - 1 assert (boxes[:, 2] >= boxes[:, 0]).all()

avilash commented 7 years ago

Can you please attach your demo.py and test.prototxt ?

wujunhust912 commented 7 years ago

@ZhuangNi @avilash @zhuanshen123 have you solve the problem?

hgaiser commented 7 years ago

In general I encounter this issue when the number of classes as defined in tools/demo.py does not match the number of classes in train.prototxt. Can you check / post your classes from demo.py ?

chrisras commented 6 years ago

I had this problem when I only had once class defined in CLASSES. If only one was defined rather than counted the number of classes as 1 it would be determined to be the length of the string, therefore, giving problems as the model only expects one class. Quick fix was to set CLASSES = ['yourclass'] rather than CLASSES = ('yourclass')