I'm currently doing some AI research for a project and for that I have to get used to a framework called "Pytorch". That's fine and all but following the official tutorial (found here) the code doesn't run properly.
The idea is that I analyse a set of facial features from a prepared dataset and then do something with it (haven't gotten to that part yet). But when I run this piece of code:
img_name = os.path.join(self.root_dir, self.landmarks_frame.iloc([index, 0])) # At this point 'index' is 0
The dataset is initialized like this:
face_dataset = fDataset(csv_file='faces/face_landmarks.csv', root_dir='faces/')
And here is where the error pops up:
for i in range(len(face_dataset)):
sample = face_dataset[i] # <-- right there
That leads to the getter function:
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}
Found in my FaceLandmarksDataset(Dataset):
class I simply get the error of the title. This is strange I find, because I can read the dataset just fine as a frame in PyCharm:
Where the first picture is clearly visible. I have checked as well that it is in the folder that I'm looking in.
Can anyone help out? :)
You don't need the parentheses with iloc
:
self.landmarks_frame.iloc[index, 0]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With