我正在尝试从github运行一个项目,我试图对图像进行群集,但是当我运行该项目时,出现了一个错误ValueError: Error when checking input: expected input_1 to have 4 dimensions, but got array with shape (500, 150528)
我尝试调试该项目,发现它是由这两个功能引起的
def load_images(self):
self.images = []
for image in self.image_paths:
self.images.append(
cv2.cvtColor(cv2.resize(cv2.imread(self.folder_path + "\\" + image), (224, 224)), cv2.COLOR_BGR2RGB))
self.images = np.float32(self.images).reshape(len(self.images), -1)
self.images /= 255
print("\n " + str(
self.max_examples) + " images from the \"" + self.folder_path + "\" folder have been loaded in a random order.")
和
pred = VGG16.predict(self.images)
我不确定是否正确使用它或项目需要一些修改 但是如何修改代码以预测数组中的图像?