【发布时间】:2022-07-20 17:21:24
【问题描述】:
#parameter
batch_size = 32
img_height = 48
img_width = 48
#load image
train_ds = tf.keras.preprocessing.image_dataset_from_directory(
'Lampung_PNG',
label_mode = "int", #categorical or binary
#class_name=['0', '1', '2', '3', ...]
color_mode='grayscale',
batch_size=batch_size,
image_size=(img_height, img_width),
shuffle=True,
seed=9898,
validation_split=0.1,
subset="training",
)
valid_ds = tf.keras.preprocessing.image_dataset_from_directory(
'Lampung_PNG',
label_mode = "int", #categorical or binary
#class_name=['0', '1', '2', '3', ...]
color_mode='grayscale',
batch_size=batch_size,
image_size=(img_height, img_width),
shuffle=True,
seed=9898,
validation_split=0.1,
subset="validation",
)
valid_ds =
我的问题 = 如何将 train_ds 和 valid_ds 转换为 numpy 数组?我想应用这个,但我不能使用我当前的数据集。
sm = SVMSMOTE(random_state=42)
x_res, y_res = sm.fit_resample(train_ds, valid_ds)
print('Resampled dataset shape %s' % Counter(y_res))
【问题讨论】:
-
请澄清您的具体问题或提供更多详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。
标签: python numpy tensorflow svm smote