img_shape = 224
test_data = []
test_labels = []
for select in ['/Covid_19/','/Normal/', '/Pneumonia/']:
for img in (os.listdir(test_path + select)):
img = plt.imread(test_path + select + img, 0)
img = cv2.resize(img, (img_shape, img_shape))
img = np.dstack([img, img, img])
img = img.astype('float32') / 255
if select =='/Covid_19/':
label = 0
elif select=='/Normal/':
label = 1
elif select=='/Pneuminia/':
label = 2
test_data.append(img)
test_labels.append(label)
test_data = np.array(test_data)
test_labels = np.array(test_labels)
--------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-3-fcf0539110b5> in <module>()
18 test_labels.append(label)
19
---> 20 test_data = np.array(test_data)
21 test_labels = np.array(test_labels)
ValueError: could not broadcast input array from shape (224,224,9) into shape (224,224)