label_dict = {}
for entry in csv:
label_dict[entry[0].decode("UTF-8")] = int(entry[1])
for file_name in tf.io.gfile.listdir(data_dir_path):
image = os.path.join(data_dir_path, file_name)
label = _NAMES[label_dict[file_name]]
yield file_name, {"image": image, "label": label}
After Change
self.info.features["label"].names = [v for k, v in sorted(label_id_to_name.items())]
filename_to_label = {
row["Filename"]: row["Species"]forrow in reader
}
for file_name in tf.io.gfile.listdir(data_dir_path):
yield file_name, {