[خامی حل کریں] ویلیو ایرر: کلہاڑی سرنی سے مماثل نہیں ہے

Valueerror



Original Traceback (most recent call last): File '/home/cody/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py', line 178, in _worker_loop data = fetcher.fetch(index) File '/home/cody/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py', line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File '/home/cody/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py', line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File '/home/cody/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/dataset.py', line 256, in __getitem__ return self.dataset[self.indices[idx]] File '/home/cody/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/dataset.py', line 206, in __getitem__ return self.datasets[dataset_idx][sample_idx] File '/home/cody/PycharmProjects/ONET/Facial_Landmark_Detection/train_test/datasets.py', line 314, in __getitem__ image_t = np.transpose(image_t, (2, 0, 1)) File '', line 6, in transpose File '/home/cody/anaconda3/envs/pytorch/lib/python3.6/site-packages/numpy/core/fromnumeric.py', line 650, in transpose return _wrapfunc(a, 'transpose', axes) File '/home/cody/anaconda3/envs/pytorch/lib/python3.6/site-packages/numpy/core/fromnumeric.py', line 61, in _wrapfunc return bound(*args, **kwds) ValueError: axes don't match array

حل:

image = np.array(Image.open(img_name))

تبدیل کرنا:



image = np.array(Image.open(img_name).convert('RGB'))

تصویر فائل کے نیچے کی تصاویر ، کچھ سنگل چینل ہیں ، کچھ تین چینلز ہیں ، آپ تصویر کو پڑھنے کے موڈ میں تبدیل کرسکتے ہیں