qfgaohao / pytorch-ssd

MobileNetV1, MobileNetV2, VGG based SSD/SSD-lite implementation in Pytorch 1.0 / Pytorch 0.4. Out-of-box support for retraining on Open Images dataset. ONNX and Caffe2 support. Experiment Ideas like CoordConv.
https://medium.com/@smallfishbigsea/understand-ssd-and-implement-your-own-caa3232cd6ad
MIT License
1.39k stars 529 forks source link

VOC dataset IndexError: too many indices for array #132

Open jeomincham opened 4 years ago

jeomincham commented 4 years ago

Hi, I use labelImg make and convert tothe VOC format, trained SSD-Mobilenet for my dataset , but In the transforms.py have some errors:
transforms/transforms.py", line 350, in __call__ boxes[:, :2] += (int(left), int(top)) IndexError: too many indices for array

and transforms/transforms.py", line 15 max_xy = np.minimum(box_a[:, 2:], box_b[2:]) IndexError: too many indices for array

olibartfast commented 4 years ago

Probably you have at least one image with a wrong xml annotation, you could use the __getitem__ function inside voc_dataset.py to look for it i.e.

if len(boxes) == 0:
    print(image_id)

Edit: It can also happen when you have wrongly defined your label class/classes for your dataset