This repository was archived by the owner on Sep 13, 2023. It is now read-only.
Trained the model and attatched the results#89
Open
Aksh4y2604 wants to merge 2 commits intoUWARG:masterfrom
Open
Trained the model and attatched the results#89Aksh4y2604 wants to merge 2 commits intoUWARG:masterfrom
Aksh4y2604 wants to merge 2 commits intoUWARG:masterfrom
Conversation
rayjinghaolei
suggested changes
May 27, 2022
Contributor
rayjinghaolei
left a comment
There was a problem hiding this comment.
all good in terms of other aspects
main.py
Outdated
Comment on lines
56
to
82
| model = models.Sequential() | ||
|
|
||
| #Defining the convulational a stack of COnv2D and MaxPolling2D layers | ||
| model.add(layers.Conv2D(32, (3, 3), activation='relu', input_shape=(32, 32, 3))) | ||
| model.add(layers.MaxPooling2D((2, 2))) | ||
| model.add(layers.Conv2D(64, (3, 3), activation='relu')) | ||
| model.add(layers.MaxPooling2D((2, 2))) | ||
| model.add(layers.Conv2D(64, (3, 3), activation='relu')) | ||
|
|
||
| #Displaying the model architecture | ||
| print("Before Flattening: ") | ||
| model.summary() | ||
|
|
||
| model.add(layers.Flatten()) | ||
| model.add(layers.Dense(64, activation='relu')) | ||
| model.add(layers.Dense(10)) | ||
|
|
||
| print("After Flattening: ") | ||
| model.summary() | ||
|
|
||
| #Compiling and training the model | ||
| model.compile(optimizer='adam', | ||
| loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True), | ||
| metrics=['accuracy']) | ||
|
|
||
| history = model.fit(trainImages, trainLables, epochs=10, | ||
| validation_data=(testImages, testLables)) |
Contributor
There was a problem hiding this comment.
I think you can group this into a function as well
main.py
Outdated
Comment on lines
85
to
90
| plt.plot(history.history['accuracy'], label='accuracy') | ||
| plt.plot(history.history['val_accuracy'], label = 'val_accuracy') | ||
| plt.xlabel('Epoch') | ||
| plt.ylabel('Accuracy') | ||
| plt.ylim([0.5, 1]) | ||
| plt.legend(loc='lower right') |
Contributor
There was a problem hiding this comment.
also group this into the function
|
|
||
| print("Test Loss: ", testLoss) | ||
| print("Test Accuracy: ", testAccuracy) | ||
|
|
Contributor
There was a problem hiding this comment.
the idea is to group most of the code into functions and to have main function calling them one by one
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Looking forward to hearing back from you!