diff --git a/gui.js b/gui.js index 664a527a21..06050afdc8 100644 --- a/gui.js +++ b/gui.js @@ -6191,7 +6191,7 @@ function _get_tensorflow_save_model_code () { model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy']) model.fit(train_generator, validation_data=validation_generator, epochs=${_epochs}) -# Speichere das trainierte Modell +# Save the model to model.h5 for future usage. model.save('model.h5') ` @@ -6205,31 +6205,31 @@ function _get_tensorflow_data_loader_code () { return ` from tensorflow.keras.preprocessing.image import ImageDataGenerator -# Definiere den Pfad zum Ordner mit den Bildern +# Define path to data data_dir = 'data/' -# Definiere die Größe, zu der die Bilder resized werden sollen +# Define size of images target_size = (${height}, ${width}) -# Erstelle einen ImageDataGenerator, um die Bilder einzulesen und zu resizen -datagen = ImageDataGenerator(rescale=1./divide_by, # Normalisiere die Bildpixel - validation_split=${_validation_split}, # Splitte die Daten automatisch in Trainings- und Validierungssets - preprocessing_function=lambda x: tf.image.resize(x, target_size)) # Resize die Bilder +# Create ImageDataGenerator to read images and resize them +datagen = ImageDataGenerator(rescale=1./divide_by, # Normalize (from 0-255 to 0-1) + validation_split=${_validation_split}, # Split into validation and training datasets + preprocessing_function=lambda x: tf.image.resize(x, target_size)) # Resize images -# Lese die Bilder aus dem Ordner ein und teile sie automatisch in Trainings- und Validierungssets auf +# Read images and split them into training and validation dataset automatically train_generator = datagen.flow_from_directory( data_dir, target_size=target_size, batch_size=${_batch_size}, class_mode='categorical', - subset='training') # 'training' für das Trainingsset + subset='training') validation_generator = datagen.flow_from_directory( data_dir, target_size=target_size, batch_size=32, class_mode='categorical', - subset='validation') # 'validation' für das Validierungsset + subset='validation') `; }