in 06_preprocessing/jpeg_to_tfrecord_tft.py [0:0]
def tft_preprocess(img_record):
# tft_preprocess gets a batch, but decode_jpeg can only read individual files
img = tf.map_fn(decode_image, img_record['img_bytes'],
fn_output_signature=tf.float32)
img = tf.image.convert_image_dtype(img, tf.float32) # [0,1]
img = tf.image.resize_with_pad(img, IMG_HEIGHT, IMG_WIDTH)
return {
'image': img,
'label': img_record['label'],
'label_int': img_record['label_int']
}