ValueError: Error when checking : expected input_1 to have 4 dimensions, but got array with shape (2

时间:2022-02-09 21:57:03

The input shape you have defined is the shape of a single sample. The model itself expects some array of samples as input (even if its an array of length 1).

Your output really should be 4-d, with the 1st dimension to enumerate the samples. i.e. for a single image you should return a shape of (1, 32, 32, 3).

也就是说输入应该是4维的,RGB三个维度外加一个图片数量维度,一张照片也应该是4维,数量维度为1