Convert the path names in image_ids to string in "ascii" format then create the dataset.
The error occured when trying to use strings of a different encoding when hdf5 supports ascii or utf-8.
data_file.create_dataset("embeddings", data = image_embeddings)
ascii_img_id = []
for img_path in image_ids:
ascii_img_ids.append(img_path.encode("ascii"))
data_file.create_dataset("image_ids", data = image_ids)
TypeError Traceback (most recent call last)
Convert the path names in image_ids to string in "ascii" format then create the dataset. The error occured when trying to use strings of a different encoding when hdf5 supports ascii or utf-8. data_file.create_dataset("embeddings", data = image_embeddings) ascii_img_id = [] for img_path in image_ids: ascii_img_ids.append(img_path.encode("ascii")) data_file.create_dataset("image_ids", data = image_ids)