You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
564 B

6 months ago
import os
from tensorflow.keras.preprocessing.image import ImageDataGenerator
# 设置数据目录
data_dir = 'D:/hand/archive'
train_dir = os.path.join(data_dir, 'leapGestRecog')
validation_dir = os.path.join(data_dir, 'validation')
# 简单的标准化处理
datagen = ImageDataGenerator(rescale=1./255)
train_generator = datagen.flow_from_directory(train_dir, target_size=(150, 150), batch_size=32, class_mode='categorical')
validation_generator = datagen.flow_from_directory(validation_dir, target_size=(150, 150), batch_size=32, class_mode='categorical')