我目前正在为一个项目做一些 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 中将数据集作为框架读取:第一张图清晰可见的地方。我也检查过它是否在我正在查看的文件夹中。任何人都可以帮忙吗?:)
添加回答
举报
0/150
提交
取消