[英]How can I fix the issue to reshape process in image derived from x_train in Python?
I found a dataset from Kaggle Here is the link: https://www.kaggle.com/quangqiyana/human-gender-identity我从 Kaggle 找到了一个数据集,这是链接: https://www.kaggle.com/quangqiyana/human-gender-identity
I want to implement CNN algorithm into dataset.我想将 CNN 算法实现到数据集中。
I wrote some codes to get X_train and Y_train我写了一些代码来获取 X_train 和 Y_train
train = pd.read_csv("files/gender.csv")
train.shape -> (230, 67502)
train.drop('Unnamed: 0', axis=1, inplace=True)
Y_train = train["Label"]
X_train = train.drop(labels = ["Label"],axis = 1)
Then I want to show some images by iloc process然后我想通过 iloc 进程显示一些图像
img = X_train.iloc[0].to_numpy()
img = np.pad(img, (0, (67600-img.shape[0])), 'constant').reshape((260, 260))
plt.imshow(img)
plt.title(train.iloc[0,0])
plt.axis("off")
plt.show()
Because any number is not a square of 67502
, I can use pad
.因为任何数字都不是67502
的平方,所以我可以使用pad
。 But the image couldn't show with resolution.但是图像无法以分辨率显示。
Here is the screenshot.这是屏幕截图。
How can I fix the reshape issue?如何解决重塑问题?
This dataset is likely not intended to be used with CNN, because the data encoded into the columns has no spatial relation to each other, like in images.该数据集可能不打算与 CNN 一起使用,因为编码到列中的数据彼此之间没有空间关系,就像在图像中一样。 Considering that this dataset was downloaded 1 (one) time, probably by you, and nobody has created any notebooks or deemed it worth a discussion, I'd recommend to move to another dataset, which has other people working on it, so you can ask questions there (on Kaggle) and get help.考虑到该数据集可能由您下载了 1(一次),并且没有人创建任何笔记本或认为值得讨论,我建议转移到另一个数据集,该数据集有其他人在处理它,这样您就可以在那里(在 Kaggle 上)提问并获得帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.