Search⌘ K

Execution

Explore how to execute data extraction for image processing by iterating through datasets using TensorFlow sessions. Learn to decode image files once, save pixel data efficiently, and complete key functions with TensorFlow and NumPy to prepare data for machine learning models.

Chapter Goals:

  • Iterate through a dataset and extract pixel data using tf.compat.v1.Session

A. Data iteration

In the previous chapter we set up a next-element tensor using the get_next function. The way we actually execute the data extraction is by using the run function of tf.compat.v1.Session.

Each time we use sess.run(next_image), we are iterating a single step through our dataset. So the first time we use sess.run(next_image), it’ll return the first pixel array in dataset (as a NumPy array), and the ithi^{th} ...