cwq159 / PyTorch-Spiking-YOLOv3

A PyTorch implementation of Spiking-YOLOv3. Two branches are provided, based on two common PyTorch implementation of YOLOv3(ultralytics/yolov3 & eriklindernoren/PyTorch-YOLOv3), with support for Spiking-YOLOv3-Tiny at present.
GNU General Public License v3.0
207 stars 58 forks source link

ValueError: array has an inhomogeneous shape after 1 dimensions #54

Open dev2y opened 1 year ago

dev2y commented 1 year ago

Did any of you get this error?

python train.py --batch-size 32 --cfg cfg/yolov3-tiny.cfg --data data/coco.data --weights ''
Apex recommended for faster mixed precision training: https://github.com/NVIDIA/apex
Namespace(epochs=300, batch_size=32, cfg='cfg/yolov3-tiny.cfg', data='data/coco.data', multi_scale=False, img_size=[320, 640, 640], rect=False, resume=False, nosave=False, notest=False, evolve=False, bucket='', cache_images=False, weights='', name='', device='', adam=False, single_cls=False, freeze_layers=False)
Using CPU

Start Tensorboard with "tensorboard --logdir=runs", view at http://localhost:6006/
WARNING: smart bias initialization failure.
WARNING: smart bias initialization failure.
Model Summary: 37 layers, 8.85237e+06 parameters, 8.85237e+06 gradients
Optimizer groups: 13 .bias, 13 Conv2d.weight, 11 other
Reading image shapes: 100%|█████| 117264/117264 [00:06<00:00, 18844.44it/s]
Caching labels data/coco/trainvalno5k.txt (117264 found, 0 missing, 0 empty, 4514 duplicate, for 117264 images): 100%|██| 117264/117264 [00:11<00:00, 10099.37it/s]
Saving labels to /home/py/PyTorch-Spiking-YOLOv3/data/coco/labels/train2014.npy for faster future loading
Traceback (most recent call last):
  File "/home/py/PyTorch-Spiking-YOLOv3/train.py", line 435, in <module>
    train(hyp)  # train normally
  File "/home/py/PyTorch-Spiking-YOLOv3/train.py", line 194, in train
    dataset = LoadImagesAndLabels(train_path, img_size, batch_size,
  File "/home/py/PyTorch-Spiking-YOLOv3/utils/datasets.py", line 408, in __init__
    np.save(np_labels_path, self.labels)  # save for next time
  File "<__array_function__ internals>", line 200, in save
  File "/home/rcnn/pyenv/lib/python3.10/site-packages/numpy/lib/npyio.py", line 521, in save
    arr = np.asanyarray(arr)
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (117264,) + inhomogeneous part.
CXCxyz commented 4 months ago

I've encountered the same issue. How do you address this issue?