深度学习自制、自定义数据集
数据有点大,仅供参考,主要是代码。 数据来源kaggle
import os.path
import pandas as pd
traindir = r"C:\Users\AIAXIT\Desktop\DeepLearningProject\Project\plant-seedlings-classification\train"
fileList = os.listdir(traindir)
train = []
trainlabel = []
for i in fileList:
fileName = os.path.join(traindir, i)
image = os.listdir(fileName)
for j in image:
train.append(os.path.join(fileName, j))
trainlabel.append(i)
dftrain = pd.DataFrame(train)
dflabel = pd.DataFrame(trainlabel)
testdir = r"C:\Users\AIAXIT\Desktop\DeepLearningProject\Project\plant-seedlings-classification\test"
fileList = os.listdir(testdir)
test = []
for i in fileList:
test.append(i)
dftest = pd.DataFrame(test)
效果图: 训练集: 训练集label: 测试集: 后期自己要写进csv或者其它文件,自己写努力一下下,已经很简单了!
|