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
d5e826e3
Unverified
Commit
d5e826e3
authored
Jan 29, 2018
by
Steven Hickson
Committed by
GitHub
Jan 29, 2018
Browse files
Merge branch 'master' into master
parents
e1ac09e1
fc37f117
Changes
153
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
48 additions
and
27 deletions
+48
-27
research/real_nvp/celeba_formatting.py
research/real_nvp/celeba_formatting.py
+3
-1
research/real_nvp/imnet_formatting.py
research/real_nvp/imnet_formatting.py
+4
-2
research/real_nvp/lsun_formatting.py
research/real_nvp/lsun_formatting.py
+3
-2
research/real_nvp/real_nvp_multiscale_dataset.py
research/real_nvp/real_nvp_multiscale_dataset.py
+17
-14
research/real_nvp/real_nvp_utils.py
research/real_nvp/real_nvp_utils.py
+1
-0
research/slim/datasets/build_imagenet_data.py
research/slim/datasets/build_imagenet_data.py
+1
-0
research/slim/datasets/preprocess_imagenet_validation_data.py
...arch/slim/datasets/preprocess_imagenet_validation_data.py
+1
-0
research/slim/datasets/process_bounding_boxes.py
research/slim/datasets/process_bounding_boxes.py
+1
-0
research/slim/nets/cyclegan.py
research/slim/nets/cyclegan.py
+1
-1
research/slim/nets/dcgan.py
research/slim/nets/dcgan.py
+1
-0
research/slim/nets/dcgan_test.py
research/slim/nets/dcgan_test.py
+1
-0
research/street/python/decoder.py
research/street/python/decoder.py
+1
-0
research/street/python/shapes.py
research/street/python/shapes.py
+1
-0
research/street/python/vgsl_model.py
research/street/python/vgsl_model.py
+3
-1
research/street/python/vgslspecs.py
research/street/python/vgslspecs.py
+1
-0
research/swivel/prep.py
research/swivel/prep.py
+3
-2
research/swivel/text2bin.py
research/swivel/text2bin.py
+1
-1
research/syntaxnet/dragnn/python/dragnn_model_saver_lib_test.py
...ch/syntaxnet/dragnn/python/dragnn_model_saver_lib_test.py
+1
-1
research/syntaxnet/dragnn/python/graph_builder.py
research/syntaxnet/dragnn/python/graph_builder.py
+1
-1
research/syntaxnet/dragnn/python/graph_builder_test.py
research/syntaxnet/dragnn/python/graph_builder_test.py
+2
-1
No files found.
research/real_nvp/celeba_formatting.py
View file @
d5e826e3
...
...
@@ -30,6 +30,8 @@ python celeba_formatting.py \
"""
from
__future__
import
print_function
import
os
import
os.path
...
...
@@ -70,7 +72,7 @@ def main():
writer
=
tf
.
python_io
.
TFRecordWriter
(
file_out
)
for
example_idx
,
img_fn
in
enumerate
(
img_fn_list
):
if
example_idx
%
1000
==
0
:
print
example_idx
,
"/"
,
num_examples
print
(
example_idx
,
"/"
,
num_examples
)
image_raw
=
scipy
.
ndimage
.
imread
(
os
.
path
.
join
(
fn_root
,
img_fn
))
rows
=
image_raw
.
shape
[
0
]
cols
=
image_raw
.
shape
[
1
]
...
...
research/real_nvp/imnet_formatting.py
View file @
d5e826e3
...
...
@@ -34,6 +34,8 @@ done
"""
from
__future__
import
print_function
import
os
import
os.path
...
...
@@ -73,10 +75,10 @@ def main():
file_out
=
"%s_%05d.tfrecords"
file_out
=
file_out
%
(
FLAGS
.
file_out
,
example_idx
//
n_examples_per_file
)
print
"Writing on:"
,
file_out
print
(
"Writing on:"
,
file_out
)
writer
=
tf
.
python_io
.
TFRecordWriter
(
file_out
)
if
example_idx
%
1000
==
0
:
print
example_idx
,
"/"
,
num_examples
print
(
example_idx
,
"/"
,
num_examples
)
image_raw
=
scipy
.
ndimage
.
imread
(
os
.
path
.
join
(
fn_root
,
img_fn
))
rows
=
image_raw
.
shape
[
0
]
cols
=
image_raw
.
shape
[
1
]
...
...
research/real_nvp/lsun_formatting.py
View file @
d5e826e3
...
...
@@ -29,6 +29,7 @@ python lsun_formatting.py \
--fn_root [LSUN_FOLDER]
"""
from
__future__
import
print_function
import
os
import
os.path
...
...
@@ -68,10 +69,10 @@ def main():
file_out
=
"%s_%05d.tfrecords"
file_out
=
file_out
%
(
FLAGS
.
file_out
,
example_idx
//
n_examples_per_file
)
print
"Writing on:"
,
file_out
print
(
"Writing on:"
,
file_out
)
writer
=
tf
.
python_io
.
TFRecordWriter
(
file_out
)
if
example_idx
%
1000
==
0
:
print
example_idx
,
"/"
,
num_examples
print
(
example_idx
,
"/"
,
num_examples
)
image_raw
=
numpy
.
array
(
Image
.
open
(
os
.
path
.
join
(
fn_root
,
img_fn
)))
rows
=
image_raw
.
shape
[
0
]
cols
=
image_raw
.
shape
[
1
]
...
...
research/real_nvp/real_nvp_multiscale_dataset.py
View file @
d5e826e3
...
...
@@ -23,11 +23,14 @@ $ python real_nvp_multiscale_dataset.py \
--data_path [DATA_PATH]
"""
from
__future__
import
print_function
import
time
from
datetime
import
datetime
import
os
import
numpy
from
six.moves
import
xrange
import
tensorflow
as
tf
from
tensorflow
import
gfile
...
...
@@ -1435,10 +1438,10 @@ class RealNVP(object):
n_equal
=
int
(
n_equal
)
n_dash
=
bar_len
-
n_equal
progress_bar
=
"["
+
"="
*
n_equal
+
"-"
*
n_dash
+
"]
\r
"
print
progress_bar
,
print
(
progress_bar
,
end
=
' '
)
cost
=
self
.
bit_per_dim
.
eval
()
eval_costs
.
append
(
cost
)
print
""
print
(
""
)
return
float
(
numpy
.
mean
(
eval_costs
))
...
...
@@ -1467,7 +1470,7 @@ def train_model(hps, logdir):
ckpt_state
=
tf
.
train
.
get_checkpoint_state
(
logdir
)
if
ckpt_state
and
ckpt_state
.
model_checkpoint_path
:
print
"Loading file %s"
%
ckpt_state
.
model_checkpoint_path
print
(
"Loading file %s"
%
ckpt_state
.
model_checkpoint_path
)
saver
.
restore
(
sess
,
ckpt_state
.
model_checkpoint_path
)
# Start the queue runners.
...
...
@@ -1499,8 +1502,8 @@ def train_model(hps, logdir):
format_str
=
(
'%s: step %d, loss = %.2f '
'(%.1f examples/sec; %.3f '
'sec/batch)'
)
print
format_str
%
(
datetime
.
now
(),
global_step_val
,
loss
,
examples_per_sec
,
duration
)
print
(
format_str
%
(
datetime
.
now
(),
global_step_val
,
loss
,
examples_per_sec
,
duration
)
)
if
should_eval_summaries
:
summary_str
=
outputs
[
-
1
]
...
...
@@ -1542,24 +1545,24 @@ def evaluate(hps, logdir, traindir, subset="valid", return_val=False):
while
True
:
ckpt_state
=
tf
.
train
.
get_checkpoint_state
(
traindir
)
if
not
(
ckpt_state
and
ckpt_state
.
model_checkpoint_path
):
print
"No model to eval yet at %s"
%
traindir
print
(
"No model to eval yet at %s"
%
traindir
)
time
.
sleep
(
30
)
continue
print
"Loading file %s"
%
ckpt_state
.
model_checkpoint_path
print
(
"Loading file %s"
%
ckpt_state
.
model_checkpoint_path
)
saver
.
restore
(
sess
,
ckpt_state
.
model_checkpoint_path
)
current_step
=
tf
.
train
.
global_step
(
sess
,
eval_model
.
step
)
if
current_step
==
previous_global_step
:
print
"Waiting for the checkpoint to be updated."
print
(
"Waiting for the checkpoint to be updated."
)
time
.
sleep
(
30
)
continue
previous_global_step
=
current_step
print
"Evaluating..."
print
(
"Evaluating..."
)
bit_per_dim
=
eval_model
.
eval_epoch
(
hps
)
print
(
"Epoch: %d, %s -> %.3f bits/dim"
%
(
current_step
,
subset
,
bit_per_dim
))
print
"Writing summary..."
print
(
"Epoch: %d, %s -> %.3f bits/dim"
%
(
current_step
,
subset
,
bit_per_dim
))
print
(
"Writing summary..."
)
summary
=
tf
.
Summary
()
summary
.
value
.
extend
(
[
tf
.
Summary
.
Value
(
...
...
@@ -1597,7 +1600,7 @@ def sample_from_model(hps, logdir, traindir):
ckpt_state
=
tf
.
train
.
get_checkpoint_state
(
traindir
)
if
not
(
ckpt_state
and
ckpt_state
.
model_checkpoint_path
):
if
not
initialized
:
print
"No model to eval yet at %s"
%
traindir
print
(
"No model to eval yet at %s"
%
traindir
)
time
.
sleep
(
30
)
continue
else
:
...
...
@@ -1607,7 +1610,7 @@ def sample_from_model(hps, logdir, traindir):
current_step
=
tf
.
train
.
global_step
(
sess
,
eval_model
.
step
)
if
current_step
==
previous_global_step
:
print
"Waiting for the checkpoint to be updated."
print
(
"Waiting for the checkpoint to be updated."
)
time
.
sleep
(
30
)
continue
previous_global_step
=
current_step
...
...
research/real_nvp/real_nvp_utils.py
View file @
d5e826e3
...
...
@@ -19,6 +19,7 @@ r"""Utility functions for Real NVP.
# pylint: disable=dangerous-default-value
import
numpy
from
six.moves
import
xrange
import
tensorflow
as
tf
from
tensorflow.python.framework
import
ops
...
...
research/slim/datasets/build_imagenet_data.py
View file @
d5e826e3
...
...
@@ -94,6 +94,7 @@ import threading
import
google3
import
numpy
as
np
from
six.moves
import
xrange
import
tensorflow
as
tf
tf
.
app
.
flags
.
DEFINE_string
(
'train_directory'
,
'/tmp/'
,
...
...
research/slim/datasets/preprocess_imagenet_validation_data.py
View file @
d5e826e3
...
...
@@ -51,6 +51,7 @@ from __future__ import print_function
import
os
import
os.path
import
sys
from
six.moves
import
xrange
if
__name__
==
'__main__'
:
...
...
research/slim/datasets/process_bounding_boxes.py
View file @
d5e826e3
...
...
@@ -85,6 +85,7 @@ import glob
import
os.path
import
sys
import
xml.etree.ElementTree
as
ET
from
six.moves
import
xrange
class
BoundingBox
(
object
):
...
...
research/slim/nets/cyclegan.py
View file @
d5e826e3
...
...
@@ -18,7 +18,7 @@ from __future__ import division
from
__future__
import
print_function
import
numpy
as
np
from
six.moves
import
xrange
import
tensorflow
as
tf
layers
=
tf
.
contrib
.
layers
...
...
research/slim/nets/dcgan.py
View file @
d5e826e3
...
...
@@ -19,6 +19,7 @@ from __future__ import print_function
from
math
import
log
from
six.moves
import
xrange
import
tensorflow
as
tf
slim
=
tf
.
contrib
.
slim
...
...
research/slim/nets/dcgan_test.py
View file @
d5e826e3
...
...
@@ -18,6 +18,7 @@ from __future__ import absolute_import
from
__future__
import
division
from
__future__
import
print_function
from
six.moves
import
xrange
import
tensorflow
as
tf
from
nets
import
dcgan
...
...
research/street/python/decoder.py
View file @
d5e826e3
...
...
@@ -25,6 +25,7 @@ import collections
import
re
import
errorcounter
as
ec
from
six.moves
import
xrange
import
tensorflow
as
tf
# Named tuple Part describes a part of a multi (1 or more) part code that
...
...
research/street/python/shapes.py
View file @
d5e826e3
...
...
@@ -24,6 +24,7 @@ tensor_dim: gets a shape dimension as a constant integer if known otherwise a
runtime usable tensor value.
tensor_shape: returns the full shape of a tensor as the tensor_dim.
"""
from
six.moves
import
xrange
import
tensorflow
as
tf
...
...
research/street/python/vgsl_model.py
View file @
d5e826e3
...
...
@@ -14,6 +14,8 @@
# ==============================================================================
"""String network description language to define network layouts."""
from
__future__
import
print_function
import
re
import
time
...
...
@@ -170,7 +172,7 @@ def Eval(train_dir,
_AddRateToSummary
(
'Sequence error rate'
,
rates
.
sequence_error
,
step
,
sw
)
sw
.
flush
()
print
'Error rates='
,
rates
print
(
'Error rates='
,
rates
)
else
:
raise
ValueError
(
'Non-softmax decoder evaluation not implemented!'
)
if
eval_interval_secs
:
...
...
research/street/python/vgslspecs.py
View file @
d5e826e3
...
...
@@ -23,6 +23,7 @@ from string import maketrans
import
nn_ops
import
shapes
from
six.moves
import
xrange
import
tensorflow
as
tf
import
tensorflow.contrib.slim
as
slim
...
...
research/swivel/prep.py
View file @
d5e826e3
...
...
@@ -61,6 +61,7 @@ import os
import
struct
import
sys
from
six.moves
import
xrange
import
tensorflow
as
tf
flags
=
tf
.
app
.
flags
...
...
@@ -118,7 +119,7 @@ def create_vocabulary(lines):
if
not
num_words
:
raise
Exception
(
'empty vocabulary'
)
print
'vocabulary contains %d tokens'
%
num_words
print
(
'vocabulary contains %d tokens'
%
num_words
)
vocab
=
vocab
[:
num_words
]
return
[
tok
for
tok
,
n
in
vocab
]
...
...
@@ -309,7 +310,7 @@ def main(_):
write_vocab_and_sums
(
vocab
,
sums
,
'row_vocab.txt'
,
'row_sums.txt'
)
write_vocab_and_sums
(
vocab
,
sums
,
'col_vocab.txt'
,
'col_sums.txt'
)
print
'done!'
print
(
'done!'
)
if
__name__
==
'__main__'
:
...
...
research/swivel/text2bin.py
View file @
d5e826e3
...
...
@@ -49,7 +49,7 @@ import sys
try
:
opts
,
args
=
getopt
(
sys
.
argv
[
1
:],
'o:v:'
,
[
'output='
,
'vocab='
])
except
GetoptError
,
e
:
except
GetoptError
as
e
:
print
>>
sys
.
stderr
,
e
sys
.
exit
(
2
)
...
...
research/syntaxnet/dragnn/python/dragnn_model_saver_lib_test.py
View file @
d5e826e3
...
...
@@ -45,7 +45,7 @@ class DragnnModelSaverLibTest(test_util.TensorFlowTestCase):
master_spec
=
spec_pb2
.
MasterSpec
()
root_dir
=
os
.
path
.
join
(
FLAGS
.
test_srcdir
,
'dragnn/python'
)
with
file
(
os
.
path
.
join
(
root_dir
,
'testdata'
,
spec_path
),
'r'
)
as
fin
:
with
open
(
os
.
path
.
join
(
root_dir
,
'testdata'
,
spec_path
),
'r'
)
as
fin
:
text_format
.
Parse
(
fin
.
read
().
replace
(
'TOPDIR'
,
root_dir
),
master_spec
)
return
master_spec
...
...
research/syntaxnet/dragnn/python/graph_builder.py
View file @
d5e826e3
...
...
@@ -28,7 +28,7 @@ from syntaxnet.util import check
try
:
tf
.
NotDifferentiable
(
'ExtractFixedFeatures'
)
except
KeyError
,
e
:
except
KeyError
as
e
:
logging
.
info
(
str
(
e
))
...
...
research/syntaxnet/dragnn/python/graph_builder_test.py
View file @
d5e826e3
...
...
@@ -20,6 +20,7 @@ import os.path
import
numpy
as
np
from
six.moves
import
xrange
import
tensorflow
as
tf
from
google.protobuf
import
text_format
...
...
@@ -245,7 +246,7 @@ class GraphBuilderTest(test_util.TensorFlowTestCase):
master_spec
=
spec_pb2
.
MasterSpec
()
testdata
=
os
.
path
.
join
(
FLAGS
.
test_srcdir
,
'dragnn/core/testdata'
)
with
file
(
os
.
path
.
join
(
testdata
,
spec_path
),
'r'
)
as
fin
:
with
open
(
os
.
path
.
join
(
testdata
,
spec_path
),
'r'
)
as
fin
:
text_format
.
Parse
(
fin
.
read
().
replace
(
'TESTDATA'
,
testdata
),
master_spec
)
return
master_spec
...
...
Prev
1
2
3
4
5
6
7
8
Next
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