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
6f0d4255
Commit
6f0d4255
authored
4 years ago
by
Frisinghelli Daniel
Browse files
Options
Downloads
Patches
Plain Diff
Plotting samples for presentation
parent
6c3c00d5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
main/config.py
+1
-1
1 addition, 1 deletion
main/config.py
main/eval.py
+7
-4
7 additions, 4 deletions
main/eval.py
with
8 additions
and
5 deletions
main/config.py
+
1
−
1
View file @
6f0d4255
...
...
@@ -124,7 +124,7 @@ plot_samples = True
# number of samples to plot
# if nsamples = -1, all samples are plotted
nsamples
=
1
0
nsamples
=
5
0
# plot_bands defines the bands used to plot a false color composite of the
# input scene: red = bands[0], green = bands[1], blue = bands[2]
...
...
This diff is collapsed.
Click to expand it.
main/eval.py
+
7
−
4
View file @
6f0d4255
# builtins
import
os
import
sys
# externals
...
...
@@ -20,17 +21,18 @@ if __name__ == '__main__':
cm
,
accuracy
,
loss
=
trainer
.
predict
(
state_path
,
state_file
,
confusion
=
True
)
# calculate overal accuracy
#
#
calculate overal accuracy
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
(
trainer
.
model
.
epoch
,
acc
*
100
))
# plot confusion matrix
#
#
plot confusion matrix
trainer
.
dataset
.
plot_confusion_matrix
(
cm
,
state
=
state_file
)
# plot loss and accuracy
trainer
.
dataset
.
plot_loss
(
trainer
.
loss_state
)
trainer
.
dataset
.
plot_loss
(
os
.
path
.
join
(
state_path
,
state_file
.
replace
(
'
.pt
'
,
'
_loss.pt
'
)))
# whether to plot the samples of the validation dataset
if
plot_samples
:
...
...
@@ -65,4 +67,5 @@ if __name__ == '__main__':
fig
,
ax
=
trainer
.
dataset
.
plot_sample
(
inputs
,
labels
,
y_pred
,
bands
=
plot_bands
,
state
=
sname
,
stretch
=
True
)
stretch
=
True
,
alpha
=
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