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
0785f0c0
Unverified
Commit
0785f0c0
authored
Jan 04, 2018
by
Neal Wu
Committed by
GitHub
Jan 04, 2018
Browse files
Revert "Flags"
parent
ad5c1fbb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
58 deletions
+41
-58
tutorials/image/cifar10/cifar10.py
tutorials/image/cifar10/cifar10.py
+7
-12
tutorials/image/cifar10/cifar10_eval.py
tutorials/image/cifar10/cifar10_eval.py
+14
-20
tutorials/image/cifar10/cifar10_multi_gpu_train.py
tutorials/image/cifar10/cifar10_multi_gpu_train.py
+10
-13
tutorials/image/cifar10/cifar10_train.py
tutorials/image/cifar10/cifar10_train.py
+10
-13
No files found.
tutorials/image/cifar10/cifar10.py
View file @
0785f0c0
...
...
@@ -35,7 +35,6 @@ from __future__ import absolute_import
from
__future__
import
division
from
__future__
import
print_function
import
argparse
import
os
import
re
import
sys
...
...
@@ -46,19 +45,15 @@ import tensorflow as tf
import
cifar10_input
parser
=
argparse
.
ArgumentParser
()
FLAGS
=
tf
.
app
.
flags
.
FLAGS
# Basic model parameters.
parser
.
add_argument
(
'--batch_size'
,
type
=
int
,
default
=
128
,
help
=
'Number of images to process in a batch.'
)
parser
.
add_argument
(
'--data_dir'
,
type
=
str
,
default
=
'/tmp/cifar10_data'
,
help
=
'Path to the CIFAR-10 data directory.'
)
parser
.
add_argument
(
'--use_fp16'
,
type
=
bool
,
default
=
False
,
help
=
'Train the model using fp16.'
)
FLAGS
=
parser
.
parse_args
()
tf
.
app
.
flags
.
DEFINE_integer
(
'batch_size'
,
128
,
"""Number of images to process in a batch."""
)
tf
.
app
.
flags
.
DEFINE_string
(
'data_dir'
,
'/tmp/cifar10_data'
,
"""Path to the CIFAR-10 data directory."""
)
tf
.
app
.
flags
.
DEFINE_boolean
(
'use_fp16'
,
False
,
"""Train the model using fp16."""
)
# Global constants describing the CIFAR-10 data set.
IMAGE_SIZE
=
cifar10_input
.
IMAGE_SIZE
...
...
tutorials/image/cifar10/cifar10_eval.py
View file @
0785f0c0
...
...
@@ -43,25 +43,20 @@ import tensorflow as tf
import
cifar10
parser
=
cifar10
.
parser
parser
.
add_argument
(
'--eval_dir'
,
type
=
str
,
default
=
'/tmp/cifar10_eval'
,
help
=
'Directory where to write event logs.'
)
parser
.
add_argument
(
'--eval_data'
,
type
=
str
,
default
=
'test'
,
help
=
'Either `test` or `train_eval`.'
)
parser
.
add_argument
(
'--checkpoint_dir'
,
type
=
str
,
default
=
'/tmp/cifar10_train'
,
help
=
'Directory where to read model checkpoints.'
)
parser
.
add_argument
(
'--eval_interval_secs'
,
type
=
int
,
default
=
60
*
5
,
help
=
'How often to run the eval.'
)
parser
.
add_argument
(
'--num_examples'
,
type
=
int
,
default
=
10000
,
help
=
'Number of examples to run.'
)
parser
.
add_argument
(
'--run_once'
,
type
=
bool
,
default
=
False
,
help
=
'Whether to run eval only once.'
)
FLAGS
=
tf
.
app
.
flags
.
FLAGS
tf
.
app
.
flags
.
DEFINE_string
(
'eval_dir'
,
'/tmp/cifar10_eval'
,
"""Directory where to write event logs."""
)
tf
.
app
.
flags
.
DEFINE_string
(
'eval_data'
,
'test'
,
"""Either 'test' or 'train_eval'."""
)
tf
.
app
.
flags
.
DEFINE_string
(
'checkpoint_dir'
,
'/tmp/cifar10_train'
,
"""Directory where to read model checkpoints."""
)
tf
.
app
.
flags
.
DEFINE_integer
(
'eval_interval_secs'
,
60
*
5
,
"""How often to run the eval."""
)
tf
.
app
.
flags
.
DEFINE_integer
(
'num_examples'
,
10000
,
"""Number of examples to run."""
)
tf
.
app
.
flags
.
DEFINE_boolean
(
'run_once'
,
False
,
"""Whether to run eval only once."""
)
def
eval_once
(
saver
,
summary_writer
,
top_k_op
,
summary_op
):
...
...
@@ -159,5 +154,4 @@ def main(argv=None): # pylint: disable=unused-argument
if
__name__
==
'__main__'
:
FLAGS
=
parser
.
parse_args
()
tf
.
app
.
run
()
tutorials/image/cifar10/cifar10_multi_gpu_train.py
View file @
0785f0c0
...
...
@@ -49,19 +49,17 @@ from six.moves import xrange # pylint: disable=redefined-builtin
import
tensorflow
as
tf
import
cifar10
parser
=
cifar10
.
parser
FLAGS
=
tf
.
app
.
flags
.
FLAGS
parser
.
add_argument
(
'--train_dir'
,
type
=
str
,
default
=
'/tmp/cifar10_train'
,
help
=
'Directory where to write event logs and checkpoint.'
)
parser
.
add_argument
(
'--max_steps'
,
type
=
int
,
default
=
1000000
,
help
=
'Number of batches to run.'
)
parser
.
add_argument
(
'--num_gpus'
,
type
=
int
,
default
=
1
,
help
=
'How many GPUs to use.'
)
parser
.
add_argument
(
'--log_device_placement'
,
type
=
bool
,
default
=
False
,
help
=
'Whether to log device placement.'
)
tf
.
app
.
flags
.
DEFINE_string
(
'train_dir'
,
'/tmp/cifar10_train'
,
"""Directory where to write event logs """
"""and checkpoint."""
)
tf
.
app
.
flags
.
DEFINE_integer
(
'max_steps'
,
1000000
,
"""Number of batches to run."""
)
tf
.
app
.
flags
.
DEFINE_integer
(
'num_gpus'
,
1
,
"""How many GPUs to use."""
)
tf
.
app
.
flags
.
DEFINE_boolean
(
'log_device_placement'
,
False
,
"""Whether to log device placement."""
)
def
tower_loss
(
scope
,
images
,
labels
):
...
...
@@ -276,5 +274,4 @@ def main(argv=None): # pylint: disable=unused-argument
if
__name__
==
'__main__'
:
FLAGS
=
parser
.
parse_args
()
tf
.
app
.
run
()
tutorials/image/cifar10/cifar10_train.py
View file @
0785f0c0
...
...
@@ -43,19 +43,17 @@ import tensorflow as tf
import
cifar10
parser
=
cifar10
.
parser
FLAGS
=
tf
.
app
.
flags
.
FLAGS
parser
.
add_argument
(
'--train_dir'
,
type
=
str
,
default
=
'/tmp/cifar10_train'
,
help
=
'Directory where to write event logs and checkpoint.'
)
parser
.
add_argument
(
'--max_steps'
,
type
=
int
,
default
=
1000000
,
help
=
'Number of batches to run.'
)
parser
.
add_argument
(
'--log_device_placement'
,
type
=
bool
,
default
=
False
,
help
=
'Whether to log device placement.'
)
parser
.
add_argument
(
'--log_frequency'
,
type
=
int
,
default
=
10
,
help
=
'How often to log results to the console.'
)
tf
.
app
.
flags
.
DEFINE_string
(
'train_dir'
,
'/tmp/cifar10_train'
,
"""Directory where to write event logs """
"""and checkpoint."""
)
tf
.
app
.
flags
.
DEFINE_integer
(
'max_steps'
,
1000000
,
"""Number of batches to run."""
)
tf
.
app
.
flags
.
DEFINE_boolean
(
'log_device_placement'
,
False
,
"""Whether to log device placement."""
)
tf
.
app
.
flags
.
DEFINE_integer
(
'log_frequency'
,
10
,
"""How often to log results to the console."""
)
def
train
():
...
...
@@ -126,5 +124,4 @@ def main(argv=None): # pylint: disable=unused-argument
if
__name__
==
'__main__'
:
FLAGS
=
parser
.
parse_args
()
tf
.
app
.
run
()
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