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
088ec5d2
Commit
088ec5d2
authored
Jan 23, 2018
by
cclauss
Browse files
long was removed in Python 3 (en masse)
parent
96e2c0ee
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
5 deletions
+12
-5
research/brain_coder/common/utils.py
research/brain_coder/common/utils.py
+2
-1
research/compression/entropy_coder/lib/block_util.py
research/compression/entropy_coder/lib/block_util.py
+3
-2
research/object_detection/dataset_tools/create_oid_tf_record.py
...ch/object_detection/dataset_tools/create_oid_tf_record.py
+5
-0
research/object_detection/utils/ops.py
research/object_detection/utils/ops.py
+2
-2
No files found.
research/brain_coder/common/utils.py
View file @
088ec5d2
...
@@ -12,6 +12,7 @@ import random
...
@@ -12,6 +12,7 @@ import random
from
absl
import
logging
from
absl
import
logging
import
numpy
as
np
import
numpy
as
np
import
six
from
six.moves
import
xrange
from
six.moves
import
xrange
import
tensorflow
as
tf
import
tensorflow
as
tf
...
@@ -138,7 +139,7 @@ def stack_pad(tensors, pad_axes=None, pad_to_lengths=None, dtype=np.float32,
...
@@ -138,7 +139,7 @@ def stack_pad(tensors, pad_axes=None, pad_to_lengths=None, dtype=np.float32,
same_axes
=
dict
(
enumerate
(
max_lengths
))
same_axes
=
dict
(
enumerate
(
max_lengths
))
if
pad_axes
is
None
:
if
pad_axes
is
None
:
pad_axes
=
[]
pad_axes
=
[]
if
isinstance
(
pad_axes
,
(
int
,
long
)
):
if
isinstance
(
pad_axes
,
six
.
integer_types
):
if
pad_to_lengths
is
not
None
:
if
pad_to_lengths
is
not
None
:
max_lengths
[
pad_axes
]
=
pad_to_lengths
max_lengths
[
pad_axes
]
=
pad_to_lengths
del
same_axes
[
pad_axes
]
del
same_axes
[
pad_axes
]
...
...
research/compression/entropy_coder/lib/block_util.py
View file @
088ec5d2
...
@@ -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/object_detection/dataset_tools/create_oid_tf_record.py
View file @
088ec5d2
...
@@ -42,6 +42,11 @@ import tensorflow as tf
...
@@ -42,6 +42,11 @@ import tensorflow as tf
from
object_detection.dataset_tools
import
oid_tfrecord_creation
from
object_detection.dataset_tools
import
oid_tfrecord_creation
from
object_detection.utils
import
label_map_util
from
object_detection.utils
import
label_map_util
try
:
long
# Python 2
except
NameError
:
long
=
int
# Python 3
tf
.
flags
.
DEFINE_string
(
'input_annotations_csv'
,
None
,
tf
.
flags
.
DEFINE_string
(
'input_annotations_csv'
,
None
,
'Path to CSV containing image bounding box annotations'
)
'Path to CSV containing image bounding box annotations'
)
tf
.
flags
.
DEFINE_string
(
'input_images_directory'
,
None
,
tf
.
flags
.
DEFINE_string
(
'input_images_directory'
,
None
,
...
...
research/object_detection/utils/ops.py
View file @
088ec5d2
...
@@ -203,9 +203,9 @@ def padded_one_hot_encoding(indices, depth, left_pad):
...
@@ -203,9 +203,9 @@ def padded_one_hot_encoding(indices, depth, left_pad):
TODO: add runtime checks for depth and indices.
TODO: add runtime checks for depth and indices.
"""
"""
if
depth
<
0
or
not
isinstance
(
depth
,
(
int
,
long
)
if
six
.
PY2
else
int
):
if
depth
<
0
or
not
isinstance
(
depth
,
six
.
integer_types
):
raise
ValueError
(
'`depth` must be a non-negative integer.'
)
raise
ValueError
(
'`depth` must be a non-negative integer.'
)
if
left_pad
<
0
or
not
isinstance
(
left_pad
,
(
int
,
long
)
if
six
.
PY2
else
int
):
if
left_pad
<
0
or
not
isinstance
(
left_pad
,
six
.
integer_types
):
raise
ValueError
(
'`left_pad` must be a non-negative integer.'
)
raise
ValueError
(
'`left_pad` must be a non-negative integer.'
)
if
depth
==
0
:
if
depth
==
0
:
return
None
return
None
...
...
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