I encountered a problem when I used ‘map()’ for data preprocessing, my preprocessing function returned a 4d numpy.ndarray, but when I used the ‘map()’ function, I printed ‘dataset.features’, and found that the features in the column ‘image’ were not a 4d numpy.ndarray but a nested Sequence, and if I promised that a certain sample’s shape, there will be an error: List has no attribute shape
Here is the snap of my code and output of dataset.features
I followed your advice, I artificially defined the type of ‘image’ to be Array4D, and when I print the features of dataset, the features of image is indeed Array4D, but the problem is that when I try to print the dataset[0][‘image’].shape, it still throws the same error,: List has no attribute ‘shape’
Exception has occurred: AttributeError
‘list’ object has no attribute ‘shape’
File “/root/autodl-tmp/dataset/dataset.py”, line 90, in
print(dataset[0][‘image’].shape)
AttributeError: ‘list’ object has no attribute ‘shape’
Another interesting point is that when I add the following lines of code: