You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import tensorflow_datasets as tfds
(train_data, test_data), ds_info = tfds.load(name="food101", # target dataset to get from TFDS
split=["train", "validation"],
shuffle_files=True,
as_supervised=True,
with_info=True)
We can get label name with the code below:
class_names = ds_info.features["label"].names
However I cannot find image name or id code related to train_data from tensorflow dataset.
I wish to build dataframe like below in order to see wrong predictions:
filepaths = []
for filepath in test_data.list_files("101_food_classes_10_percent/test//.jpg",
shuffle=False):
filepaths.append(filepath.numpy())
2. Create a dataframe out of current prediction data for analysis
import pandas as pd
pred_df = pd.DataFrame({"img_path": filepaths,
"y_true": y_labels,
"y_pred": pred_classes,
"pred_conf": pred_probs.max(axis=1), # get the maximum prediction probability value
"y_true_classname": [class_names[i] for i in y_labels],
"y_pred_classname": [class_names[i] for i in pred_classes]})
pred_df.head()
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
My steps are below:
import tensorflow_datasets as tfds
(train_data, test_data), ds_info = tfds.load(name="food101", # target dataset to get from TFDS
split=["train", "validation"],
shuffle_files=True,
as_supervised=True,
with_info=True)
We can get label name with the code below:
class_names = ds_info.features["label"].names
However I cannot find image name or id code related to train_data from tensorflow dataset.
I wish to build dataframe like below in order to see wrong predictions:
filepaths = []
for filepath in test_data.list_files("101_food_classes_10_percent/test//.jpg",
shuffle=False):
filepaths.append(filepath.numpy())
2. Create a dataframe out of current prediction data for analysis
import pandas as pd
pred_df = pd.DataFrame({"img_path": filepaths,
"y_true": y_labels,
"y_pred": pred_classes,
"pred_conf": pred_probs.max(axis=1), # get the maximum prediction probability value
"y_true_classname": [class_names[i] for i in y_labels],
"y_pred_classname": [class_names[i] for i in pred_classes]})
pred_df.head()
Any idea to get image name from food 101 dataset?
Thank you in advance.
Beta Was this translation helpful? Give feedback.
All reactions