Incompatible shapes at component 0: expected [?,299,299,3] but got [1,256,256,3]
Siddharth-Gautam0 opened this issue · 1 comments
Siddharth-Gautam0 commented
This error pops up while training the skin cancer model. Changed the batch size to 1 but it didn't solve the problem.
x4nth055 commented
Hey there,
The code contain the resizing to (299,299, 3):
# preprocess data
def decode_img(img):
# convert the compressed string to a 3D uint8 tensor
img = tf.image.decode_jpeg(img, channels=3)
# Use `convert_image_dtype` to convert to floats in the [0,1] range.
img = tf.image.convert_image_dtype(img, tf.float32)
# resize the image to the desired size.
return tf.image.resize(img, [299, 299])
def process_path(filepath, label):
# load the raw data from the file as a string
img = tf.io.read_file(filepath)
img = decode_img(img)
return img, label
valid_ds = valid_ds.map(process_path)
train_ds = train_ds.map(process_path)I'm not sure how this error occurred in your case, did you use the same code in the repository?