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
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
69 additions
and
58 deletions
+69
-58
research/brain_coder/single_task/test_tasks.py
research/brain_coder/single_task/test_tasks.py
+1
-2
research/brain_coder/single_task/tune.py
research/brain_coder/single_task/tune.py
+1
-0
research/cognitive_mapping_and_planning/scripts/script_env_vis.py
.../cognitive_mapping_and_planning/scripts/script_env_vis.py
+14
-14
research/cognitive_mapping_and_planning/scripts/script_plot_trajectory.py
...ve_mapping_and_planning/scripts/script_plot_trajectory.py
+32
-32
research/cognitive_mapping_and_planning/src/file_utils.py
research/cognitive_mapping_and_planning/src/file_utils.py
+1
-0
research/cognitive_mapping_and_planning/src/graph_utils.py
research/cognitive_mapping_and_planning/src/graph_utils.py
+1
-0
research/cognitive_mapping_and_planning/src/map_utils.py
research/cognitive_mapping_and_planning/src/map_utils.py
+1
-0
research/cognitive_mapping_and_planning/src/utils.py
research/cognitive_mapping_and_planning/src/utils.py
+4
-4
research/compression/entropy_coder/core/entropy_coder_single.py
...ch/compression/entropy_coder/core/entropy_coder_single.py
+1
-1
research/compression/entropy_coder/core/entropy_coder_train.py
...rch/compression/entropy_coder/core/entropy_coder_train.py
+1
-1
research/compression/entropy_coder/dataset/gen_synthetic_dataset.py
...ompression/entropy_coder/dataset/gen_synthetic_dataset.py
+1
-0
research/compression/entropy_coder/dataset/synthetic_model.py
...arch/compression/entropy_coder/dataset/synthetic_model.py
+1
-0
research/compression/entropy_coder/lib/block_util.py
research/compression/entropy_coder/lib/block_util.py
+3
-2
research/compression/entropy_coder/lib/blocks_masked_conv2d.py
...rch/compression/entropy_coder/lib/blocks_masked_conv2d.py
+1
-0
research/compression/entropy_coder/lib/blocks_masked_conv2d_test.py
...ompression/entropy_coder/lib/blocks_masked_conv2d_test.py
+1
-0
research/compression/entropy_coder/lib/blocks_std_test.py
research/compression/entropy_coder/lib/blocks_std_test.py
+1
-0
research/delf/delf/python/feature_io.py
research/delf/delf/python/feature_io.py
+1
-0
research/differential_privacy/dp_sgd/dp_mnist/dp_mnist.py
research/differential_privacy/dp_sgd/dp_mnist/dp_mnist.py
+1
-0
research/differential_privacy/dp_sgd/per_example_gradients/per_example_gradients.py
...acy/dp_sgd/per_example_gradients/per_example_gradients.py
+1
-0
research/differential_privacy/multiple_teachers/aggregation.py
...rch/differential_privacy/multiple_teachers/aggregation.py
+1
-2
No files found.
research/brain_coder/single_task/test_tasks.py
View file @
d5e826e3
...
@@ -4,6 +4,7 @@ from __future__ import print_function
...
@@ -4,6 +4,7 @@ from __future__ import print_function
"""Tasks that test correctness of algorithms."""
"""Tasks that test correctness of algorithms."""
from
six.moves
import
xrange
from
common
import
reward
as
reward_lib
# brain coder
from
common
import
reward
as
reward_lib
# brain coder
from
single_task
import
misc
# brain coder
from
single_task
import
misc
# brain coder
...
@@ -124,5 +125,3 @@ class HillClimbingTask(object):
...
@@ -124,5 +125,3 @@ class HillClimbingTask(object):
# closest next element.
# closest next element.
# Maximum distance possible is num_actions * base / 2 = 3 * 8 / 2 = 12
# Maximum distance possible is num_actions * base / 2 = 3 * 8 / 2 = 12
return
(
len
(
prefix
)
+
(
1
-
min_dist
/
12.0
)),
False
return
(
len
(
prefix
)
+
(
1
-
min_dist
/
12.0
)),
False
research/brain_coder/single_task/tune.py
View file @
d5e826e3
...
@@ -39,6 +39,7 @@ from absl import app
...
@@ -39,6 +39,7 @@ from absl import app
from
absl
import
flags
from
absl
import
flags
from
absl
import
logging
from
absl
import
logging
import
numpy
as
np
import
numpy
as
np
from
six.moves
import
xrange
import
tensorflow
as
tf
import
tensorflow
as
tf
from
single_task
import
defaults
# brain coder
from
single_task
import
defaults
# brain coder
...
...
research/cognitive_mapping_and_planning/scripts/script_env_vis.py
View file @
d5e826e3
...
@@ -90,7 +90,7 @@ def walk_through(b):
...
@@ -90,7 +90,7 @@ def walk_through(b):
root
=
tk
.
Tk
()
root
=
tk
.
Tk
()
image
=
b
.
render_nodes
(
b
.
task
.
nodes
[[
current_node
],:])[
0
]
image
=
b
.
render_nodes
(
b
.
task
.
nodes
[[
current_node
],:])[
0
]
print
image
.
shape
print
(
image
.
shape
)
image
=
image
.
astype
(
np
.
uint8
)
image
=
image
.
astype
(
np
.
uint8
)
im
=
Image
.
fromarray
(
image
)
im
=
Image
.
fromarray
(
image
)
im
=
ImageTk
.
PhotoImage
(
im
)
im
=
ImageTk
.
PhotoImage
(
im
)
...
...
research/cognitive_mapping_and_planning/scripts/script_plot_trajectory.py
View file @
d5e826e3
...
@@ -220,7 +220,7 @@ def plot_trajectory_first_person(dt, orig_maps, out_dir):
...
@@ -220,7 +220,7 @@ def plot_trajectory_first_person(dt, orig_maps, out_dir):
t
.
set_bbox
(
dict
(
color
=
'white'
,
alpha
=
0.85
,
pad
=-
0.1
))
t
.
set_bbox
(
dict
(
color
=
'white'
,
alpha
=
0.85
,
pad
=-
0.1
))
# Action to take.
# Action to take.
action_latex
=
[
'$\odot$ '
,
'$\curvearrowright$ '
,
'$\curvearrowleft$ '
,
'$\Uparrow$ '
]
action_latex
=
[
'$\odot$ '
,
'$\curvearrowright$ '
,
'$\curvearrowleft$ '
,
r
'$\Uparrow$ '
]
t
=
ax
.
text
(
0.99
,
0.99
,
action_latex
[
actions
[
step_number
]],
t
=
ax
.
text
(
0.99
,
0.99
,
action_latex
[
actions
[
step_number
]],
horizontalalignment
=
'right'
,
horizontalalignment
=
'right'
,
verticalalignment
=
'top'
,
verticalalignment
=
'top'
,
...
@@ -265,7 +265,7 @@ def plot_trajectory_first_person(dt, orig_maps, out_dir):
...
@@ -265,7 +265,7 @@ def plot_trajectory_first_person(dt, orig_maps, out_dir):
tmp_file_name
=
'tmp.mp4'
tmp_file_name
=
'tmp.mp4'
line_ani
.
save
(
tmp_file_name
,
writer
=
writer
,
savefig_kwargs
=
{
'facecolor'
:
'black'
})
line_ani
.
save
(
tmp_file_name
,
writer
=
writer
,
savefig_kwargs
=
{
'facecolor'
:
'black'
})
out_file_name
=
os
.
path
.
join
(
out_dir
,
'vis_{:04d}.mp4'
.
format
(
i
))
out_file_name
=
os
.
path
.
join
(
out_dir
,
'vis_{:04d}.mp4'
.
format
(
i
))
print
out_file_name
print
(
out_file_name
)
if
fu
.
exists
(
out_file_name
):
if
fu
.
exists
(
out_file_name
):
gfile
.
Remove
(
out_file_name
)
gfile
.
Remove
(
out_file_name
)
...
@@ -318,7 +318,7 @@ def plot_trajectory(dt, hardness, orig_maps, out_dir):
...
@@ -318,7 +318,7 @@ def plot_trajectory(dt, hardness, orig_maps, out_dir):
ax
.
set_ylim
([
xy1
[
1
],
xy2
[
1
]])
ax
.
set_ylim
([
xy1
[
1
],
xy2
[
1
]])
file_name
=
os
.
path
.
join
(
out_dir
,
'trajectory_{:04d}.png'
.
format
(
i
))
file_name
=
os
.
path
.
join
(
out_dir
,
'trajectory_{:04d}.png'
.
format
(
i
))
print
file_name
print
(
file_name
)
with
fu
.
fopen
(
file_name
,
'w'
)
as
f
:
with
fu
.
fopen
(
file_name
,
'w'
)
as
f
:
plt
.
savefig
(
f
)
plt
.
savefig
(
f
)
plt
.
close
(
fig
)
plt
.
close
(
fig
)
...
...
research/cognitive_mapping_and_planning/src/file_utils.py
View file @
d5e826e3
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
"""Utilities for manipulating files.
"""Utilities for manipulating files.
"""
"""
import
os
import
os
import
numpy
as
np
import
PIL
import
PIL
from
tensorflow.python.platform
import
gfile
from
tensorflow.python.platform
import
gfile
import
cv2
import
cv2
...
...
research/cognitive_mapping_and_planning/src/graph_utils.py
View file @
d5e826e3
...
@@ -19,6 +19,7 @@ import skimage.morphology
...
@@ -19,6 +19,7 @@ import skimage.morphology
import
numpy
as
np
import
numpy
as
np
import
networkx
as
nx
import
networkx
as
nx
import
itertools
import
itertools
import
logging
import
graph_tool
as
gt
import
graph_tool
as
gt
import
graph_tool.topology
import
graph_tool.topology
import
graph_tool.generation
import
graph_tool.generation
...
...
research/cognitive_mapping_and_planning/src/map_utils.py
View file @
d5e826e3
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
"""
"""
import
copy
import
copy
import
skimage.morphology
import
skimage.morphology
import
logging
import
numpy
as
np
import
numpy
as
np
import
scipy.ndimage
import
scipy.ndimage
import
matplotlib.pyplot
as
plt
import
matplotlib.pyplot
as
plt
...
...
research/cognitive_mapping_and_planning/src/utils.py
View file @
d5e826e3
...
@@ -17,6 +17,7 @@ r"""Generaly Utilities.
...
@@ -17,6 +17,7 @@ r"""Generaly Utilities.
"""
"""
import
numpy
as
np
,
cPickle
,
os
,
time
import
numpy
as
np
,
cPickle
,
os
,
time
from
six.moves
import
xrange
import
src.file_utils
as
fu
import
src.file_utils
as
fu
import
logging
import
logging
...
@@ -93,12 +94,12 @@ def tic_toc_print(interval, string):
...
@@ -93,12 +94,12 @@ def tic_toc_print(interval, string):
global
tic_toc_print_time_old
global
tic_toc_print_time_old
if
'tic_toc_print_time_old'
not
in
globals
():
if
'tic_toc_print_time_old'
not
in
globals
():
tic_toc_print_time_old
=
time
.
time
()
tic_toc_print_time_old
=
time
.
time
()
print
string
print
(
string
)
else
:
else
:
new_time
=
time
.
time
()
new_time
=
time
.
time
()
if
new_time
-
tic_toc_print_time_old
>
interval
:
if
new_time
-
tic_toc_print_time_old
>
interval
:
tic_toc_print_time_old
=
new_time
;
tic_toc_print_time_old
=
new_time
;
print
string
print
(
string
)
def
mkdir_if_missing
(
output_dir
):
def
mkdir_if_missing
(
output_dir
):
if
not
fu
.
exists
(
output_dir
):
if
not
fu
.
exists
(
output_dir
):
...
@@ -165,4 +166,3 @@ def calc_pr(gt, out, wt=None):
...
@@ -165,4 +166,3 @@ def calc_pr(gt, out, wt=None):
ap
=
voc_ap
(
rec
,
prec
)
ap
=
voc_ap
(
rec
,
prec
)
return
ap
,
rec
,
prec
return
ap
,
rec
,
prec
research/compression/entropy_coder/core/entropy_coder_single.py
View file @
d5e826e3
...
@@ -58,7 +58,7 @@ def main(_):
...
@@ -58,7 +58,7 @@ def main(_):
#iteration = FLAGS.iteration
#iteration = FLAGS.iteration
if
not
tf
.
gfile
.
Exists
(
FLAGS
.
input_codes
):
if
not
tf
.
gfile
.
Exists
(
FLAGS
.
input_codes
):
print
'
\n
Input codes not found.
\n
'
print
(
'
\n
Input codes not found.
\n
'
)
return
return
with
tf
.
gfile
.
FastGFile
(
FLAGS
.
input_codes
,
'rb'
)
as
code_file
:
with
tf
.
gfile
.
FastGFile
(
FLAGS
.
input_codes
,
'rb'
)
as
code_file
:
...
...
research/compression/entropy_coder/core/entropy_coder_train.py
View file @
d5e826e3
...
@@ -171,7 +171,7 @@ def train():
...
@@ -171,7 +171,7 @@ def train():
'code_length'
:
model
.
average_code_length
'code_length'
:
model
.
average_code_length
}
}
np_tensors
=
sess
.
run
(
tf_tensors
,
feed_dict
=
feed_dict
)
np_tensors
=
sess
.
run
(
tf_tensors
,
feed_dict
=
feed_dict
)
print
np_tensors
[
'code_length'
]
print
(
np_tensors
[
'code_length'
]
)
sv
.
Stop
()
sv
.
Stop
()
...
...
research/compression/entropy_coder/dataset/gen_synthetic_dataset.py
View file @
d5e826e3
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
import
os
import
os
import
numpy
as
np
import
numpy
as
np
from
six.moves
import
xrange
import
tensorflow
as
tf
import
tensorflow
as
tf
import
synthetic_model
import
synthetic_model
...
...
research/compression/entropy_coder/dataset/synthetic_model.py
View file @
d5e826e3
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
"""Binary code sample generator."""
"""Binary code sample generator."""
import
numpy
as
np
import
numpy
as
np
from
six.moves
import
xrange
_CRC_LINE
=
[
_CRC_LINE
=
[
...
...
research/compression/entropy_coder/lib/block_util.py
View file @
d5e826e3
...
@@ -21,6 +21,7 @@ from __future__ import unicode_literals
...
@@ -21,6 +21,7 @@ from __future__ import unicode_literals
import
math
import
math
import
numpy
as
np
import
numpy
as
np
import
six
import
tensorflow
as
tf
import
tensorflow
as
tf
...
@@ -39,7 +40,7 @@ class RsqrtInitializer(object):
...
@@ -39,7 +40,7 @@ class RsqrtInitializer(object):
1.0 / sqrt(product(shape[dims]))
1.0 / sqrt(product(shape[dims]))
**kwargs: Extra keyword arguments to pass to tf.truncated_normal.
**kwargs: Extra keyword arguments to pass to tf.truncated_normal.
"""
"""
if
isinstance
(
dims
,
(
int
,
long
)
):
if
isinstance
(
dims
,
six
.
integer_types
):
self
.
_dims
=
[
dims
]
self
.
_dims
=
[
dims
]
else
:
else
:
self
.
_dims
=
dims
self
.
_dims
=
dims
...
@@ -73,7 +74,7 @@ class RectifierInitializer(object):
...
@@ -73,7 +74,7 @@ class RectifierInitializer(object):
sqrt(scale / product(shape[dims])).
sqrt(scale / product(shape[dims])).
**kwargs: Extra keyword arguments to pass to tf.truncated_normal.
**kwargs: Extra keyword arguments to pass to tf.truncated_normal.
"""
"""
if
isinstance
(
dims
,
(
int
,
long
)
):
if
isinstance
(
dims
,
six
.
integer_types
):
self
.
_dims
=
[
dims
]
self
.
_dims
=
[
dims
]
else
:
else
:
self
.
_dims
=
dims
self
.
_dims
=
dims
...
...
research/compression/entropy_coder/lib/blocks_masked_conv2d.py
View file @
d5e826e3
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
"""Define some typical masked 2D convolutions."""
"""Define some typical masked 2D convolutions."""
import
numpy
as
np
import
numpy
as
np
from
six.moves
import
xrange
import
tensorflow
as
tf
import
tensorflow
as
tf
import
block_util
import
block_util
...
...
research/compression/entropy_coder/lib/blocks_masked_conv2d_test.py
View file @
d5e826e3
...
@@ -19,6 +19,7 @@ from __future__ import division
...
@@ -19,6 +19,7 @@ from __future__ import division
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
import
numpy
as
np
import
numpy
as
np
from
six.moves
import
xrange
import
tensorflow
as
tf
import
tensorflow
as
tf
import
blocks_masked_conv2d
import
blocks_masked_conv2d
...
...
research/compression/entropy_coder/lib/blocks_std_test.py
View file @
d5e826e3
...
@@ -22,6 +22,7 @@ import math
...
@@ -22,6 +22,7 @@ import math
import
os
import
os
import
numpy
as
np
import
numpy
as
np
from
six.moves
import
xrange
import
tensorflow
as
tf
import
tensorflow
as
tf
import
blocks_std
import
blocks_std
...
...
research/delf/delf/python/feature_io.py
View file @
d5e826e3
...
@@ -25,6 +25,7 @@ from __future__ import print_function
...
@@ -25,6 +25,7 @@ from __future__ import print_function
from
delf
import
feature_pb2
from
delf
import
feature_pb2
from
delf
import
datum_io
from
delf
import
datum_io
import
numpy
as
np
import
numpy
as
np
from
six.moves
import
xrange
import
tensorflow
as
tf
import
tensorflow
as
tf
...
...
research/differential_privacy/dp_sgd/dp_mnist/dp_mnist.py
View file @
d5e826e3
...
@@ -22,6 +22,7 @@ import sys
...
@@ -22,6 +22,7 @@ import sys
import
time
import
time
import
numpy
as
np
import
numpy
as
np
from
six.moves
import
xrange
import
tensorflow
as
tf
import
tensorflow
as
tf
from
differential_privacy.dp_sgd.dp_optimizer
import
dp_optimizer
from
differential_privacy.dp_sgd.dp_optimizer
import
dp_optimizer
...
...
research/differential_privacy/dp_sgd/per_example_gradients/per_example_gradients.py
View file @
d5e826e3
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
import
collections
import
collections
from
six.moves
import
xrange
import
tensorflow
as
tf
import
tensorflow
as
tf
OrderedDict
=
collections
.
OrderedDict
OrderedDict
=
collections
.
OrderedDict
...
...
research/differential_privacy/multiple_teachers/aggregation.py
View file @
d5e826e3
...
@@ -19,6 +19,7 @@ from __future__ import division
...
@@ -19,6 +19,7 @@ from __future__ import division
from
__future__
import
print_function
from
__future__
import
print_function
import
numpy
as
np
import
numpy
as
np
from
six.moves
import
xrange
def
labels_from_probs
(
probs
):
def
labels_from_probs
(
probs
):
...
@@ -127,5 +128,3 @@ def aggregation_most_frequent(logits):
...
@@ -127,5 +128,3 @@ def aggregation_most_frequent(logits):
result
[
i
]
=
np
.
argmax
(
label_counts
)
result
[
i
]
=
np
.
argmax
(
label_counts
)
return
np
.
asarray
(
result
,
dtype
=
np
.
int32
)
return
np
.
asarray
(
result
,
dtype
=
np
.
int32
)
Prev
1
2
3
4
5
6
…
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