Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PySegCNN
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
earth_observation_public
PySegCNN
Commits
3ec4bf24
Commit
3ec4bf24
authored
4 years ago
by
Frisinghelli Daniel
Browse files
Options
Downloads
Patches
Plain Diff
Adjusted sparcs evaluation to confusion matrix output of predict function
parent
dcfce5a2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sparcs/sparcs_04_eval.py
+7
-7
7 additions, 7 deletions
sparcs/sparcs_04_eval.py
with
7 additions
and
7 deletions
sparcs/sparcs_04_eval.py
+
7
−
7
View file @
3ec4bf24
...
...
@@ -18,13 +18,13 @@ from sparcs.sparcs_02_dataset import (net, valid_ds, valid_dl, optimizer,
if
__name__
==
'
__main__
'
:
#
calculate accuracy for
each batch in the validation set
accuracies
=
predict
(
net
,
valid_dl
,
optimizer
,
accuracy_function
,
state_file
)
mean_acc
=
np
.
mean
(
accurac
ies
)
print
(
'
After training for {:d} epochs, we achieved an overall mean
'
'
accuracy of {:.2f}% on the validation set!
'
.
format
(
net
.
epoch
,
mean_
acc
*
100
))
#
predict
each batch in the validation set
cm
=
predict
(
net
,
valid_dl
,
optimizer
,
accuracy_function
,
state_file
)
# calculate overal
accurac
y
acc
=
(
cm
.
diag
().
sum
()
/
cm
.
sum
()).
numpy
().
item
()
print
(
'
After training for {:d} epochs, we achieved an overall accuracy of
'
'
{:.2f}% on the validation set!
'
.
format
(
net
.
epoch
,
acc
*
100
))
# number of samples to plot
n
=
5
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment