Hello. I’m new to NLP and I’m trying to follow Tensorflow’s tutorial on Image Captioning (Image captioning with visual attention  |  TensorFlow Core 1), but I ran into an problem when trying to preprocess the images with InceptionV3. As said in the tutorial, I have a preprocessing function
def load_image(image_path):   
    img = tf.io.read_file(image_path)    
    img = tf.image.decode_jpeg(img, channels=3)    
    img = tf.image.resize(img, (299, 299))    
    img = tf.keras.applications.inception_v3.preprocess_input(img)    
    return img, image_path

Then I use it to get a BatchDataset (I get a <BatchDataset shapes: ((None, 299, 299, 3), (None,)), types: (tf.float32, tf.string)>)
# Get unique images
encode_train = sorted(set(img_name_vector))
# Feel free to change batch_size according to your system configuration
image_dataset = tf.data.Dataset.from_tensor_slices(encode_train)
image_dataset = image_dataset.map(load_image, num_parallel_calls=tf.data.experimental.AUTOTUNE).batch(16)

Up to this point, everything works, but then when I try
for img, path in image_dataset:
    #Do something

Either nothing happens or the kernel dies. Is there a way to fix or circumvent that issue?