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
461fc094
Commit
461fc094
authored
May 16, 2018
by
Haiyang Kong
Committed by
Taylor Robie
May 15, 2018
Browse files
Make codes more pythonic. (#4213)
* Make codes more pythonic. * Restore the indents Restore the indents.
parent
ea6d6aab
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
10 deletions
+3
-10
research/slim/slim_walkthrough.ipynb
research/slim/slim_walkthrough.ipynb
+1
-3
research/slim/train_image_classifier.py
research/slim/train_image_classifier.py
+1
-4
research/tcn/estimators/base_estimator.py
research/tcn/estimators/base_estimator.py
+1
-3
No files found.
research/slim/slim_walkthrough.ipynb
View file @
461fc094
...
...
@@ -999,12 +999,10 @@
"\n",
" variables_to_restore = []\n",
" for var in slim.get_model_variables():\n",
" excluded = False\n",
" for exclusion in exclusions:\n",
" if var.op.name.startswith(exclusion):\n",
" excluded = True\n",
" break\n",
"
if not excluded
:\n",
"
else
:\n",
" variables_to_restore.append(var)\n",
"\n",
" return slim.assign_from_checkpoint_fn(\n",
...
...
research/slim/train_image_classifier.py
View file @
461fc094
...
...
@@ -340,12 +340,10 @@ def _get_init_fn():
# TODO(sguada) variables.filter_variables()
variables_to_restore
=
[]
for
var
in
slim
.
get_model_variables
():
excluded
=
False
for
exclusion
in
exclusions
:
if
var
.
op
.
name
.
startswith
(
exclusion
):
excluded
=
True
break
if
not
excluded
:
else
:
variables_to_restore
.
append
(
var
)
if
tf
.
gfile
.
IsDirectory
(
FLAGS
.
checkpoint_path
):
...
...
@@ -552,7 +550,6 @@ def main(_):
# Merge all summaries together.
summary_op
=
tf
.
summary
.
merge
(
list
(
summaries
),
name
=
'summary_op'
)
###########################
# Kicks off the training. #
###########################
...
...
research/tcn/estimators/base_estimator.py
View file @
461fc094
...
...
@@ -71,12 +71,10 @@ class InitFromPretrainedCheckpointHook(session_run_hook.SessionRunHook):
# Variable filtering by given exclude_scopes.
filtered_variables_to_restore
=
{}
for
v
in
variable_to_restore
:
excluded
=
False
for
exclusion
in
exclusions
:
if
v
.
name
.
startswith
(
exclusion
):
excluded
=
True
break
if
not
excluded
:
else
:
var_name
=
v
.
name
.
split
(
':'
)[
0
]
filtered_variables_to_restore
[
var_name
]
=
v
...
...
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