[英]How to compare one column value available or not in another column dataframe and extract another column of second dataframe if present
[英]How to get the CK+ Dataset into a dataframe where one column is the image and the second column is the emotion (Is that even necessary?)
我想構建一個 model 用於情感分類,並且我正在努力處理數據集。 我正在使用 CK+,因為我讀到它符合行業標准。 我不知道如何以正確的方式格式化它,所以我可以開始工作。 數據集按以下方式格式化。
憤怒(文件夾)
蔑視(文件夾)
我需要文件夾名稱作為文件夾內文件的標簽,但我真的不知道如何到達那里。
您可以使用tf.keras.utils.image_dataset_from_directory
function 將所有數據加載到tf.data.Dataset
中。 假設您的Anger
和Contempt
文件夾位於名為Parent
的目錄中,您可以這樣做:
import tensorflow as tf
dataset = tf.keras.utils.image_dataset_from_directory('Parent')
然后,您可以直接從數據集中訪問圖像和標簽,例如:
iterator = dataset.as_numpy_iterator()
print(iterator.next())
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.