Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
bb6f092a
Unverified
Commit
bb6f092a
authored
Apr 24, 2020
by
Yuhao Zhang
Committed by
GitHub
Apr 23, 2020
Browse files
Guard the unsafe tf.log to prevent NAN (#8223)
parent
396fa8e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
research/video_prediction/prediction_train.py
research/video_prediction/prediction_train.py
+4
-1
No files found.
research/video_prediction/prediction_train.py
View file @
bb6f092a
...
@@ -33,6 +33,9 @@ VAL_INTERVAL = 200
...
@@ -33,6 +33,9 @@ VAL_INTERVAL = 200
# How often to save a model checkpoint
# How often to save a model checkpoint
SAVE_INTERVAL
=
2000
SAVE_INTERVAL
=
2000
# EPSILON to avoid NAN
EPSILON
=
1e-9
# tf record data location:
# tf record data location:
DATA_DIR
=
'push/push_train'
DATA_DIR
=
'push/push_train'
...
@@ -81,7 +84,7 @@ def peak_signal_to_noise_ratio(true, pred):
...
@@ -81,7 +84,7 @@ def peak_signal_to_noise_ratio(true, pred):
Returns:
Returns:
peak signal to noise ratio (PSNR)
peak signal to noise ratio (PSNR)
"""
"""
return
10.0
*
tf
.
log
(
1.0
/
mean_squared_error
(
true
,
pred
))
/
tf
.
log
(
10.0
)
return
10.0
*
(
-
tf
.
log
(
tf
.
maximum
(
mean_squared_error
(
true
,
pred
)
,
EPSILON
))
)
/
tf
.
log
(
10.0
)
def
mean_squared_error
(
true
,
pred
):
def
mean_squared_error
(
true
,
pred
):
...
...
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