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
Lucas Miranda
deepOF
Commits
506a6baf
Commit
506a6baf
authored
Mar 29, 2021
by
lucas_miranda
Browse files
Replaced pickle with json for security reasons
parent
5e4dbf7b
Pipeline
#97120
passed with stages
in 36 minutes and 18 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
deepof/train_utils.py
View file @
506a6baf
...
...
@@ -17,9 +17,9 @@ from tensorboard.plugins.hparams import api as hp
from
typing
import
Tuple
,
Union
,
Any
,
List
import
deepof.hypermodels
import
deepof.model_utils
import
json
import
numpy
as
np
import
os
import
pickle
import
tensorflow
as
tf
# Ignore warning with no downstream effect
...
...
@@ -53,11 +53,11 @@ def load_treatments(train_path):
with
open
(
os
.
path
.
join
(
train_path
,
[
i
for
i
in
os
.
listdir
(
train_path
)
if
i
.
endswith
(
".
pkl
"
)][
0
],
[
i
for
i
in
os
.
listdir
(
train_path
)
if
i
.
endswith
(
".
json
"
)][
0
],
),
"r
b
"
,
"r"
,
)
as
handle
:
treatment_dict
=
pickle
.
load
(
handle
)
treatment_dict
=
json
.
load
(
handle
)
except
IndexError
:
treatment_dict
=
None
...
...
tests/test_examples/test_single_topview/Others/test_hparams.json
0 → 100644
View file @
506a6baf
{
"units_conv"
:
256
,
"units_lstm"
:
256
,
"units_dense2"
:
64
,
"dropout_rate"
:
0.25
,
"encoding"
:
16
,
"learning_rate"
:
0.001
}
\ No newline at end of file
tests/test_examples/test_single_topview/Others/test_hparams.pkl
deleted
100644 → 0
View file @
5e4dbf7b
File deleted
tests/test_train_utils.py
View file @
506a6baf
...
...
@@ -22,7 +22,7 @@ import tensorflow as tf
def
test_load_treatments
():
assert
deepof
.
train_utils
.
load_treatments
(
"
.
"
)
is
None
assert
deepof
.
train_utils
.
load_treatments
(
"
tests
"
)
is
None
assert
isinstance
(
deepof
.
train_utils
.
load_treatments
(
os
.
path
.
join
(
"tests"
,
"test_examples"
,
"test_single_topview"
,
"Others"
)
...
...
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