Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
Im
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王肇一
Im
Commits
21be8b98
Commit
21be8b98
authored
Feb 08, 2020
by
王肇一
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gpu tensor to cpu
parent
5fee1f79
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
4 deletions
+3
-4
train.py
mrnet/train.py
+1
-2
eval.py
utils/eval.py
+2
-2
No files found.
mrnet/train.py
View file @
21be8b98
...
...
@@ -53,8 +53,7 @@ def train_net(net, device, epochs = 5, batch_size = 1, lr = 0.1):
jac
=
eval_jac
(
net
,
val_loader
,
device
,
n_val
)
# overall_acc, avg_per_class_acc, avg_jacc, avg_dice = eval_multi(net, val_loader, device, n_val)
scheduler
.
step
()
logging
.
info
(
f
'Avg Dice:{dice}
\n
'
f
'Jaccard:{jac}
\n
'
logging
.
info
(
f
'Avg Dice:{dice} Jaccard:{jac}
\n
'
f
'Learning Rate:{scheduler.get_lr()[0]}'
)
if
epoch
%
5
==
0
:
try
:
...
...
utils/eval.py
View file @
21be8b98
...
...
@@ -64,8 +64,8 @@ def eval_jac(net, loader, device, n_val):
true_masks
=
true_masks
.
to
(
device
=
device
,
dtype
=
mask_type
)
pred_masks
=
net
(
imgs
)
pred_masks
=
torch
.
round
(
pred_masks
)
.
detach
()
.
numpy
()
true_masks
=
torch
.
round
(
true_masks
)
.
numpy
()
pred_masks
=
torch
.
round
(
pred_masks
)
.
cpu
()
.
detach
()
.
numpy
()
true_masks
=
torch
.
round
(
true_masks
)
.
cpu
()
.
numpy
()
jac
+=
jaccard_score
(
true_masks
.
flatten
(),
pred_masks
.
flatten
())
pbar
.
update
(
imgs
.
shape
[
0
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment