In the parse_fn() method we wrote in the previous subsection for dataset.map(), tf.io.read_file() was called to read the file corresponding to each filename listed by the dataset, and then tf.io.decode_png() converted the bytes into an image tensor.
tf.io also contains decode_jpeg(), decode_gif(), and more. It also provides the more generic decode_image(), which can infer which image format to use (refer to the documentation at https://www.tensorflow.org/api_docs/python/tf/io).
Furthermore, numerous methods can be applied to parsing computer vision labels. Obviously, if the labels are also images (for instance, for image segmentation or edition), the methods we just listed can be reused all the same. If the labels are stored in text files, TextLineDataset or FixedLengthRecordDataset (refer to the documentation at https://www.tensorflow.org/api_docs/python/tf/data) can be used to iterate over them, and modules such as tf.strings can help parse the lines/records...