Spaces:
Sleeping
Sleeping
Delete finetuning.py
Browse files- finetuning.py +0 -39
finetuning.py
DELETED
|
@@ -1,39 +0,0 @@
|
|
| 1 |
-
import matplotlib.pyplot as plt
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
# Trainiere das Modell
|
| 5 |
-
history = model.fit(
|
| 6 |
-
train_generator,
|
| 7 |
-
steps_per_epoch=train_generator.samples // train_generator.batch_size,
|
| 8 |
-
epochs=10,
|
| 9 |
-
validation_data=validation_generator,
|
| 10 |
-
validation_steps=validation_generator.samples // validation_generator.batch_size
|
| 11 |
-
)
|
| 12 |
-
|
| 13 |
-
# Speichern von Genauigkeit und Verlust während des Trainings
|
| 14 |
-
acc = history.history['accuracy']
|
| 15 |
-
val_acc = history.history['val_accuracy']
|
| 16 |
-
loss = history.history['loss']
|
| 17 |
-
val_loss = history.history['val_loss']
|
| 18 |
-
|
| 19 |
-
# Plot der Trainingshistorie
|
| 20 |
-
plt.figure(figsize=(8, 8))
|
| 21 |
-
|
| 22 |
-
# Subplot für Genauigkeit
|
| 23 |
-
plt.subplot(2, 1, 1)
|
| 24 |
-
plt.plot(acc, label='Training Accuracy')
|
| 25 |
-
plt.plot(val_acc, label='Validation Accuracy')
|
| 26 |
-
plt.ylim([0.4, 1]) # Setze die y-Achsen-Grenzen
|
| 27 |
-
plt.plot([initial_epochs - 1, initial_epochs - 1], plt.ylim(), label='Start Fine Tuning')
|
| 28 |
-
plt.legend(loc='lower right')
|
| 29 |
-
plt.title('Training and Validation Accuracy')
|
| 30 |
-
|
| 31 |
-
# Subplot für Verlust
|
| 32 |
-
plt.subplot(2, 1, 2)
|
| 33 |
-
plt.plot(loss, label='Training Loss')
|
| 34 |
-
plt.plot(val_loss, label='Validation Loss')
|
| 35 |
-
plt.plot([initial_epochs - 1, initial_epochs - 1], plt.ylim(), label='Start Fine Tuning')
|
| 36 |
-
plt.legend(loc='upper right')
|
| 37 |
-
plt.title('Training and Validation Loss')
|
| 38 |
-
plt.xlabel('Epoch')
|
| 39 |
-
plt.show()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|