ultralytics / yolov3

YOLOv3 in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
10.18k stars 3.44k forks source link

IndexError: too many indices for array #250

Closed crazy-abc closed 5 years ago

crazy-abc commented 5 years ago

E:\pyProject\yolov3>python train.py --data data/coco_1cls.data Namespace(accumulate=1, backend='nccl', batch_size=16, cfg='cfg/yolov3-spp.cfg', data_cfg='data/coco_1cls.data', dist_url='tcp://127.0.0.1:9999', epochs=273, evolve=False, img_size=416, multi_scale=False, nosave=False, notest=False, num_workers=2, rank=0, resume=False, transfer=False, var=0, world_size=1)

Using CUDA device0 _CudaDeviceProperties(name='GeForce GTX 750 Ti', total_memory=4096MB) Traceback (most recent call last): File "train.py", line 313, in multi_scale=opt.multi_scale, File "train.py", line 150, in train model.class_weights = labels_to_class_weights(dataset.labels, nc).to(device) # attach class weights File "E:\pyProject\yolov3\utils\utils.py", line 55, in labels_to_class_weights classes = labels[:, 0].astype(np.int) # labels = [class xywh] IndexError: too many indices for array

how should i do?

glenn-jocher commented 5 years ago

Hello, thank you for your interest in our work! This is an automated response. Please note that most technical problems are due to:

If none of these apply to you, we suggest you close this issue and raise a new one using the Bug Report template, providing screenshots and minimum viable code to reproduce your issue. Thank you!

pprp commented 4 years ago

I have the same problem. Please first check if the labels are empty.Chances are that the TXT file in labels is empty

glenn-jocher commented 11 months ago

@pprp thank you for the input! Ensure the labels in your TXT file are correctly formatted as [class xywh] for each object instance in the image. You can also verify if your labels are empty or not by checking the content of your label files directly. If the issue persists, feel free to share further details or consider the suggestions outlined in my previous message.