【解决】ValueError: Axes=(0, 1) out of range for array of ndim=0.

TransUnet训练自己制作自己的数据集时遇到报错

遇到报错:

  File "/home/zafu/XD/M-UNET/TransUNet-main/datasets/dataset_synapse.py", line 14, in random_rot_flip
    label = np.rot90(label, k)
  File "<__array_function__ internals>", line 6, in rot90
  File "/home/zafu/anaconda3/envs/torch-tansfuse/lib/python3.7/site-packages/numpy/lib/function_base.py", line 126, in rot90
    .format(axes, m.ndim))
ValueError: Axes=(0, 1) out of range for array of ndim=0.

报错原因:

           
            # data = np.load(data_path)
            data = np.load(data_path, allow_pickle=True)

            image, label = data['image'], data['label']
            print("image",image.size)
            print("image",image.shape)
            print("label",label.size)
            print("label",label.shape)

在dataset_synapse.py   中打印出image和label的尺寸:
image 18048000
image (2000, 3008, 3)
label 1
label ()
不匹配

解决:
数据集制作有问题,重新制作

重新制作数据集后成功!!!
【解决】ValueError: Axes=(0, 1) out of range for array of ndim=0._第1张图片

你可能感兴趣的:(报错,医学分割,python,深度学习)