亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

TypeError: unhashable type: 'list' 調用 .iloc() 時

TypeError: unhashable type: 'list' 調用 .iloc() 時

catspeake 2021-06-15 13:05:31
我目前正在為一個項目做一些 AI 研究,為此我必須習慣一個名為“Pytorch”的框架。這很好,除了按照官方教程(在此處找到)之外,代碼無法正常運行。這個想法是我從準備好的數據集中分析一組面部特征,然后用它做一些事情(還沒有達到那個部分)。但是當我運行這段代碼時:img_name = os.path.join(self.root_dir, self.landmarks_frame.iloc([index, 0]))  # At this point 'index' is 0數據集初始化如下:face_dataset = fDataset(csv_file='faces/face_landmarks.csv', root_dir='faces/')這是彈出錯誤的地方:for i in range(len(face_dataset)):    sample = face_dataset[i]  # <-- right there這導致了 getter 函數:def __getitem__(self, index):    img_name = os.path.join(self.root_dir, self.landmarks_frame.iloc([index, 0]))    image = io.imread(img_name)    landmarks = self.landmarks_frame.iloc[index, 1:].as_matrix()    landmarks = landmarks.astype('float').reshape(-1, 2)    sample = {'image': image, 'landmarks': landmarks}在我的FaceLandmarksDataset(Dataset):課堂上發現我只是得到了標題的錯誤。我發現這很奇怪,因為我可以在 PyCharm 中將數據集作為框架讀?。旱谝粡垐D清晰可見的地方。我也檢查過它是否在我正在查看的文件夾中。任何人都可以幫忙嗎?:)
查看完整描述

1 回答

?
一只甜甜圈

TA貢獻1836條經驗 獲得超5個贊

您不需要括號iloc

self.landmarks_frame.iloc[index, 0]


查看完整回答
反對 回復 2021-06-22
  • 1 回答
  • 0 關注
  • 170 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號