Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
sjromuel
Masterarbeit
Commits
276b29e0
Commit
276b29e0
authored
Nov 23, 2020
by
sjromuel
Browse files
d
parent
6eca8d37
Changes
1
Hide whitespace changes
Inline
Side-by-side
RobinNet/nets/Unet.py
View file @
276b29e0
...
...
@@ -115,7 +115,7 @@ def Unet(x, weights, filter_multiplier, training=True):
def
train_unet
(
model
,
inputs
,
gt
,
weights
,
optimizer
,
filter_multiplier
):
with
tf
.
GradientTape
()
as
tape
:
pred
=
model
(
inputs
,
weights
,
filter_multiplier
,
training
=
True
)
fig
=
plt
.
figure
()
'''
fig = plt.figure()
fig.add_subplot(2, 3, 1)
plt.imshow(inputs[1, :, :, 0], cmap=plt.cm.bone)
plt.title('Input')
...
...
@@ -125,7 +125,7 @@ def train_unet(model, inputs, gt, weights, optimizer, filter_multiplier):
fig.add_subplot(2, 3, 3)
plt.imshow(gt[1,:,:,0], cmap=plt.cm.bone)
plt.title('True')
plt
.
show
()
plt.show()
'''
current_loss
=
dice_loss
(
pred
,
gt
,
axis
=
(
1
,
2
,
3
))
grads
=
tape
.
gradient
(
current_loss
,
weights
)
...
...
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