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

ValueError: Error when checking : expected input_1 to have 4 dimensions, but got array with shape (50, 50, 3)
원인: 예측할 때 주는 것은 수조,array,np.asarray(imagelist)
다음은 올바른 코드입니다.
path = '../../white_mouse_data/test/1/'
# path=r"D:\git_project\mouse_detect_demo\mouse_data\0_test\\"
files = os.listdir(path)

aaa = 0
index = 0
imagelist = []
for file in files:
    a = cv2.imread(path + file)
    a=cv2.resize(a,(IMG_SIZE,IMG_SIZE),interpolation=cv2.INTER_CUBIC)
    imagelist.append(a)
t0 = time.time()
result = model.predict(np.asarray(imagelist))

좋은 웹페이지 즐겨찾기