Image preparation for prediction of a continuous variable

Good day friend.

Please keep in mind that I am a novice in the computer science field. So I have Image data for Deep learning, my goal is to be able to predict Milk yield (a continuous variable) based on image data. My question is how and where do I put the milk yield labels?. Do I name the images according to the milk yield values or what?

Your assistance will be greatly appreciated.

The simplest option is to create a csv-file containing (or something like that) containing filename, yield rows. Load it as a pandas-dataframe.

Then when you iterate over the rows, for each row read the image file, decode the image, and then process it to match your model’s expected input.

Something like:

def load_image(filename):
  img = tf.io.read_file(filename)
  img = tf.image.decode_jpeg(img)
  img = ...
  return img

def process_row(filename, label):
  return load_image(filename), label

df = pandas.read_csv(csv_file)
ds = tf.data.dataset.from_tensor_slices(dict(df))
ds = ds.shuffle().map(process_row).batch(...)

Oh ok, thank you so much for the assistance. I’ll try that