Issue
Hello i have a dataset of 32FC1 Images of 80x60 and what im doing is to reshape the dataset to transform it and label it so it could be used to train a CNN but when i reshape my dataset i get the following error:
arraynegativos= ds_negatives.reshape(( n_negatives_img, img_width, img_height))
arraypositivos= ds_positives.reshape((n_positives_img, img_width, img_height))
AttributeError: 'list' object has no attribute 'reshape'
So i converted my ds_negative to numpy array like this:
ds_negatives1 = np.array(ds_negatives)
But it gives me this error:
cannot reshape array of size 1 into shape (26308,80,60)
So now im a bit confused, how do i transform my dataset to be reshaped into that?
Here is the link of the script so u can see it better.
https://colab.research.google.com/drive/1KzoHXA8Y6lcyvq7K7segFfJp2AIw9P45?usp=sharing
Solution
When you say ds_negatives = ["/content/drive/MyDrive/Colab Notebooks/negative_depth.txt"]
you are not setting ds_negatives
to the content of that file but simply to a string containing the file path. Therefore the list (and np array you create from it) only contain one item. Depending on how you want to read the text file you should use something like open("path", "r").read()
or .readlines()
Answered By - Lecdi
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.