Hi friends !
I’m trying my hand on the new FastAI version and I’m completely stuck in front of a message saying:
Could not do one pass in your dataloader, there is something wrong in it
Specifically, I’m tackling the Facial Keypoint Detection on Kaggle. The training data is in a csv, where the first 30 columns are the x and y key point location and the last column is a string with the image pixel values. (https://www.kaggle.com/c/facial-keypoints-detection/data)
I wrote a function to get_x
def get_image(x):
im= np.array(x['Image'].split(' '), dtype = float).reshape(96,96)
return p_image.fromarray(np.zeros((96,96))) # I know I'm not returning the loaded image, but I was trying to figure out the shape and if it was supposed to be a PIL image instead of a np.array
And to get y:
def get_labels(x):
points = x.drop('Image')
#px = points.drop([idx for idx in points.index if idx.endswith('_y')])
#py = points.drop([idx for idx in points.index if idx.endswith('_x')])
#kps = np.concatenate([px.values.astype(float).reshape(-1,1), py.values.astype(float).reshape(-1,1)], axis = 1)
# I'm only taking a single point as a debug process. However, I do not now if TensorPoint is necessary ?
debug_x = x['nose_tip_x']
debug_y = x['nose_tip_y']
kps = np.array([debug_x, debug_y], dtype = np.float32).reshape(-1)
return TensorPoint.create(kps)
And finally constructing the dataloader:
dblock = DataBlock(blocks = (ImageBlock, PointBlock),
get_x= get_image, get_y = get_labels,
item_tfms = RandomResizedCrop(128, min_scale=0.35))
dls = dblock.dataloaders(train_data)
When calling show batch
, I get the following error:
AttributeError: 'PointScaler' object has no attribute 'sz'
Could someone please explain to me (or point me in the direction of) the reason why it does that ?
Thanks a lot !