ValueError: Cannot feed value of shape (1, 375, 287, 12, 1) for Tensor 'image_tensor:0', which has shape '(?, ?, ?, 3)'

полный код программы можно посмотреть по ссылки [https://stackoverflow.com/questions/51872412/tensorflow-numpy-image-reshape-grayscale-images][1] Я добавил функцию как там советовалось :

def load_image_into_numpy_array(image):
    # The function supports only grayscale images
    #assert len(image.shape) == 2  or len(image.shape) == 3
    last_axis = -1
    dim_to_repeat = 2
    repeats = 3
    grscale_img_3dims = np.expand_dims(image, last_axis)
    training_image = np.repeat(grscale_img_3dims, repeats, dim_to_repeat).astype('uint8')
    #assert len(training_image.shape) == 3
    #assert training_image.shape[-1] == 3
    return training_image
 

при assert выдаёт ошибку 'PngImageFile' object has no attribute 'shape'

я всё что с assert закоментил и теперь у меня ошибка: ValueError: Cannot feed value of shape (1, 375, 287, 12, 1) for Tensor 'image_tensor:0', which has shape '(?, ?, ?, 3)' на строчке Detection -

feed_dict={image_tensor: image_np_expanded})

Как исправить ошибку ?


Ответы (0 шт):