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
3f14aa4c
Commit
3f14aa4c
authored
4 years ago
by
Frisinghelli Daniel
Browse files
Options
Downloads
Patches
Plain Diff
Loss file is deprecated; loss is now also stored in state file
parent
42efced5
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
pysegcnn/core/graphics.py
+5
-5
5 additions, 5 deletions
pysegcnn/core/graphics.py
with
5 additions
and
5 deletions
pysegcnn/core/graphics.py
+
5
−
5
View file @
3f14aa4c
...
...
@@ -174,17 +174,17 @@ def plot_confusion_matrix(cm, labels, normalize=True,
return
fig
,
ax
def
plot_loss
(
loss
_file
,
figsize
=
(
10
,
10
),
step
=
5
,
def
plot_loss
(
state
_file
,
figsize
=
(
10
,
10
),
step
=
5
,
colors
=
[
'
lightgreen
'
,
'
green
'
,
'
skyblue
'
,
'
steelblue
'
],
outpath
=
os
.
path
.
join
(
HERE
,
'
_graphics/
'
)):
# load the model
loss
state
=
torch
.
load
(
loss
_file
)
# load the model
state
model_
state
=
torch
.
load
(
state
_file
)
# get all non-zero elements, i.e. get number of epochs trained before
# early stop
loss
=
{
k
:
v
[
np
.
nonzero
(
v
)].
reshape
(
v
.
shape
[
0
],
-
1
)
for
k
,
v
in
state
.
items
()
if
k
!=
'
epoch
'
}
model_state
[
'
state
'
].
items
()
}
# compute running mean with a window equal to the number of batches in
# an epoch
...
...
@@ -245,7 +245,7 @@ def plot_loss(loss_file, figsize=(10, 10), step=5,
# save figure
os
.
makedirs
(
outpath
,
exist_ok
=
True
)
fig
.
savefig
(
os
.
path
.
join
(
outpath
,
os
.
path
.
basename
(
loss
_file
).
replace
(
'
.pt
'
,
'
.png
'
)),
outpath
,
os
.
path
.
basename
(
state
_file
).
replace
(
'
.pt
'
,
'
.png
'
)),
dpi
=
300
,
bbox_inches
=
'
tight
'
)
return
fig
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