data310

For today’s class you loaded and preprocessed the tf.dataset the tf_flowers, and then trained a CNN in order to predict whether a particular image was of one of five different types of flowers. For the first part of this exercise, instead of using the tf.keras.utils.get_file() to load your data, use tfds.load() to load a tensorflow dataset as illustrated in the section Using TensorFlow Datasets. Using the relevant parts from the entirety of the example script as a guide, fit a CNN model to your training data and validate using the beans dataset from Tensorflow datasets and then again train and validate using the eurosat dataset. Present your results and discuss the accuracy of each of model.

In the beans dataset, after three epochs, the accuracy on the training data was around 0.7001. Running three epochs took around 11.27 minutes. The loss on the training data was around 0.6875. In addition, the accuracy on the testing data was around 0.6505. The loss on the testing data was around 0.76. In the eurosat dataset, after three epochs, the accuracy on the training data was around 0.7303. Running three epochs took around 4.73 minutes. The loss on the training data was around 0.7554. Also, the accuracy on the testing data was around 0.7619. The loss on the testing data was around 0.6549. In general, due to the model with the eurosat dataset having a higher testing data accuracy, I would say that this model performed better than the other model with the beans dataset.

Additionally, go to the image augmentation exercise and read through and become familiar with the many individual examples presented. Towards the end of this exercise is the Apply augmentation to a dataset example, that illustrates a resize and rescale image augmentation implementation to the tf_flowers dataset. Apply this same method to both the beans and eurosat datasets. Did your model performance improve? How many epochs were you able to run and how much time did it take? Present your results and discuss the accuracy of your augmented output for tomorrow’s class.

For the augmented eurosat dataset, I ran 5 epochs that took around 1.83 minutes, 10 epochs that took around 3.67 minutes, 50 epochs that took around 18.33 minutes, 100 epochs that took around 36.67 minutes. In the model with the augmented eurosat dataset and 5 epochs, the training data accuracy was around 0.7841. The loss on the training data was around 0.6001. The testing data accuracy was around 0.7893. The loss on the testing data was around 0.6519. In the model with the augmented eurosat dataset and 10 epochs, the training data accuracy was around 0.9192. The loss on the training data was 0.2293. The testing data accuracy was around 0.7570. The loss on the testing data was around 1.1830. In the model with the augmented eurosat dataset and 50 epochs, the training data accuracy was around 0.9778. The loss on the training data was around 0.0559. The testing data accuracy was around 0.7444. The loss on the testing data was around 2.4814. In the model with the augmented eurosat dataset and 100 epochs, the training data accuracy was around 0.9788. The loss on the training data was around 0.0514. The testing data accuracy was around 0.7122. The loss on the testing data was around 3.9379. Overall, only the model with the augmented eurosat dataset and 5 epochs had a higher testing data accuracy than the original model with non-augmented eurosat dataset and 3 epochs. Therefore, this model was the only model in which model performance improved.

For the augmented beans dataset, I ran 50 epochs that took around 1.67 minutes, 100 epochs that took around 3.33 minutes, 150 epochs that took around 5 minutes. In the model with the augmented beans dataset and 50 epochs, the training data accuracy was around 1. The loss on the training data was around 0.00016022. The testing data accuracy was around 0.7961. The loss on the testing data was around 1.4619. In the model with the augmented beans dataset and 100 epochs, the training data accuracy was around 1. The loss on the training data was around 0.000025217. The testing data accuracy was around 0.7767. The loss on the testing data was around 2.0690. In the model with the augmented beans dataset and 150 epochs, the training data accuracy was around 1. The loss on the training data was around 0.0000063134. The testing data accuracy was around 0.7087. The loss on the testing data was around 2.1711. Overall, all the models with the augmented beans dataset and tested epochs had a higher testing data accuracy than the original model with the non-augmented beans dataset and 3 epochs. Therefore, all these models demonstrated improvement in model performance.