all the input arrays must have same number of dimensions, but the array at index 0 has 2 dimension(s) and the array at index 1 has 1 dimension(s)

Author: tanzhikunCreated Oct 27, 2025Updated Oct 27, 2025

the problems occurred when i wanted to train my own dataset, and i have no idea to solve it

Traceback (most recent call last): File "E:\Users\Lenovo\Desktop\\unet\train.py", line 213, in train_model( File "E:\Users\Lenovo\Desktop\\unet\train.py", line 43, in train_model dataset = CarvanaDataset(dir_img, dir_mask, img_scale) #对图像进行寻找,缩放 File "E:\Users\Lenovo\Desktop\\unet\\utils\data_loading.py", line 117, in init super().init(images_dir, mask_dir, scale, mask_suffix='_mask') File "E:\Users\Lenovo\Desktop\\unet\\utils\data_loading.py", line 58, in init self.mask_values = list(sorted(np.unique(np.concatenate(unique), axis=0).tolist())) File "<__array_function__ internals>", line 180, in concatenate ValueError: all the input arrays must have same number of dimensions, but the array at index 0 has 2 dimension(s) and the array at index 1 has 1 dimension(s)