This repository has been archived by the owner on Sep 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 274
Trained the model and attatched the results #89
Open
Aksh4y2604
wants to merge
2
commits into
UWARG:master
Choose a base branch
from
Aksh4y2604:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
rayjinghaolei
suggested changes
May 27, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also group this into the function
|
||
print("Test Loss: ", testLoss) | ||
print("Test Accuracy: ", testAccuracy) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the idea is to group most of the code into functions and to have main function calling them one by one
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!