我目前正在為一個項目做一些 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清晰可見的地方。我也檢查過它是否在我正在查看的文件夾中。任何人都可以幫忙嗎?:)
添加回答
舉報
0/150
提交
取消