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
e00e0e13
Commit
e00e0e13
authored
Dec 03, 2018
by
dreamdragon
Browse files
Merge remote-tracking branch 'upstream/master'
parents
b915db4e
402b561b
Changes
205
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
95 additions
and
22 deletions
+95
-22
research/astronet/light_curve/median_filter_test.py
research/astronet/light_curve/median_filter_test.py
+1
-1
research/astronet/light_curve/periodic_event.py
research/astronet/light_curve/periodic_event.py
+0
-0
research/astronet/light_curve/periodic_event_test.py
research/astronet/light_curve/periodic_event_test.py
+1
-1
research/astronet/light_curve/test_data/0114/011442793/kplr011442793-2009350155506_llc.fits
..._data/0114/011442793/kplr011442793-2009350155506_llc.fits
+0
-0
research/astronet/light_curve/test_data/0114/011442793/kplr011442793-2010009091648_llc.fits
..._data/0114/011442793/kplr011442793-2010009091648_llc.fits
+0
-0
research/astronet/light_curve/test_data/0114/011442793/kplr011442793-2010174085026_llc.fits
..._data/0114/011442793/kplr011442793-2010174085026_llc.fits
+0
-0
research/astronet/light_curve/util.py
research/astronet/light_curve/util.py
+0
-0
research/astronet/light_curve/util_test.py
research/astronet/light_curve/util_test.py
+9
-9
research/astronet/tf_util/BUILD
research/astronet/tf_util/BUILD
+54
-0
research/astronet/tf_util/__init__.py
research/astronet/tf_util/__init__.py
+14
-0
research/astronet/tf_util/config_util.py
research/astronet/tf_util/config_util.py
+0
-0
research/astronet/tf_util/config_util_test.py
research/astronet/tf_util/config_util_test.py
+1
-1
research/astronet/tf_util/configdict.py
research/astronet/tf_util/configdict.py
+0
-0
research/astronet/tf_util/configdict_test.py
research/astronet/tf_util/configdict_test.py
+1
-1
research/astronet/tf_util/estimator_runner.py
research/astronet/tf_util/estimator_runner.py
+3
-1
research/astronet/tf_util/example_util.py
research/astronet/tf_util/example_util.py
+0
-0
research/astronet/tf_util/example_util_test.py
research/astronet/tf_util/example_util_test.py
+1
-1
research/audioset/README.md
research/audioset/README.md
+4
-3
research/audioset/vggish_input.py
research/audioset/vggish_input.py
+3
-2
research/deeplab/export_model.py
research/deeplab/export_model.py
+3
-2
No files found.
research/astronet/light_curve
_util
/median_filter_test.py
→
research/astronet/light_curve/median_filter_test.py
View file @
e00e0e13
...
...
@@ -21,7 +21,7 @@ from __future__ import print_function
from
absl.testing
import
absltest
import
numpy
as
np
from
light_curve
_util
import
median_filter
from
light_curve
import
median_filter
class
MedianFilterTest
(
absltest
.
TestCase
):
...
...
research/astronet/light_curve
_util
/periodic_event.py
→
research/astronet/light_curve/periodic_event.py
View file @
e00e0e13
File moved
research/astronet/light_curve
_util
/periodic_event_test.py
→
research/astronet/light_curve/periodic_event_test.py
View file @
e00e0e13
...
...
@@ -20,7 +20,7 @@ from __future__ import print_function
from
absl.testing
import
absltest
from
light_curve
_util
.periodic_event
import
Event
from
light_curve.periodic_event
import
Event
class
EventTest
(
absltest
.
TestCase
):
...
...
research/astronet/light_curve
_util
/test_data/0114/011442793/kplr011442793-2009350155506_llc.fits
→
research/astronet/light_curve/test_data/0114/011442793/kplr011442793-2009350155506_llc.fits
View file @
e00e0e13
File moved
research/astronet/light_curve
_util
/test_data/0114/011442793/kplr011442793-2010009091648_llc.fits
→
research/astronet/light_curve/test_data/0114/011442793/kplr011442793-2010009091648_llc.fits
View file @
e00e0e13
File moved
research/astronet/light_curve
_util
/test_data/0114/011442793/kplr011442793-2010174085026_llc.fits
→
research/astronet/light_curve/test_data/0114/011442793/kplr011442793-2010174085026_llc.fits
View file @
e00e0e13
File moved
research/astronet/light_curve
_util
/util.py
→
research/astronet/light_curve/util.py
View file @
e00e0e13
File moved
research/astronet/light_curve
_util
/util_test.py
→
research/astronet/light_curve/util_test.py
View file @
e00e0e13
...
...
@@ -21,9 +21,9 @@ from __future__ import print_function
from
absl.testing
import
absltest
import
numpy
as
np
from
light_curve
_util
import
periodic_event
from
light_curve
import
periodic_event
from
light_curve
_util
import
util
from
light_curve
import
util
class
LightCurveUtilTest
(
absltest
.
TestCase
):
...
...
@@ -89,13 +89,13 @@ class LightCurveUtilTest(absltest.TestCase):
]
all_flux
=
[
np
.
ones
(
25
),
np
.
ones
(
10
)]
self
.
assert
Equal
(
l
en
(
all_time
)
,
2
)
self
.
assert
Equal
(
l
en
(
all_time
[
0
]
)
,
25
)
self
.
assert
Equal
(
l
en
(
all_time
[
1
]
)
,
10
)
self
.
assert
L
en
(
all_time
,
2
)
self
.
assert
L
en
(
all_time
[
0
],
25
)
self
.
assert
L
en
(
all_time
[
1
],
10
)
self
.
assert
Equal
(
l
en
(
all_flux
)
,
2
)
self
.
assert
Equal
(
l
en
(
all_flux
[
0
]
)
,
25
)
self
.
assert
Equal
(
l
en
(
all_flux
[
1
]
)
,
10
)
self
.
assert
L
en
(
all_flux
,
2
)
self
.
assert
L
en
(
all_flux
[
0
],
25
)
self
.
assert
L
en
(
all_flux
[
1
],
10
)
# Gap width 0.5.
split_time
,
split_flux
=
util
.
split
(
all_time
,
all_flux
,
gap_width
=
0.5
)
...
...
@@ -268,7 +268,7 @@ class LightCurveUtilTest(absltest.TestCase):
np
.
array
([
80
,
90
]),
]
reshard_xs
=
util
.
reshard_arrays
(
xs
,
ys
)
self
.
assert
Equal
(
5
,
l
en
(
reshard_xs
)
)
self
.
assert
L
en
(
reshard_xs
,
5
)
np
.
testing
.
assert_array_equal
([],
reshard_xs
[
0
])
np
.
testing
.
assert_array_equal
([
1
,
2
],
reshard_xs
[
1
])
np
.
testing
.
assert_array_equal
([
3
,
4
,
5
,
6
],
reshard_xs
[
2
])
...
...
research/astronet/tf_util/BUILD
0 → 100644
View file @
e00e0e13
package
(
default_visibility
=
[
"//visibility:public"
])
licenses
([
"notice"
])
# Apache 2.0
py_library
(
name
=
"configdict"
,
srcs
=
[
"configdict.py"
],
srcs_version
=
"PY2AND3"
,
deps
=
[
],
)
py_test
(
name
=
"configdict_test"
,
size
=
"small"
,
srcs
=
[
"configdict_test.py"
],
srcs_version
=
"PY2AND3"
,
deps
=
[
":configdict"
],
)
py_library
(
name
=
"config_util"
,
srcs
=
[
"config_util.py"
],
srcs_version
=
"PY2AND3"
,
)
py_test
(
name
=
"config_util_test"
,
size
=
"small"
,
srcs
=
[
"config_util_test.py"
],
srcs_version
=
"PY2AND3"
,
deps
=
[
":config_util"
],
)
py_library
(
name
=
"estimator_runner"
,
srcs
=
[
"estimator_runner.py"
],
srcs_version
=
"PY2AND3"
,
)
py_library
(
name
=
"example_util"
,
srcs
=
[
"example_util.py"
],
srcs_version
=
"PY2AND3"
,
visibility
=
[
"//visibility:public"
],
)
py_test
(
name
=
"example_util_test"
,
size
=
"small"
,
srcs
=
[
"example_util_test.py"
],
srcs_version
=
"PY2AND3"
,
deps
=
[
":example_util"
],
)
research/astronet/tf_util/__init__.py
0 → 100644
View file @
e00e0e13
# Copyright 2018 The TensorFlow Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
research/astronet/
astronet/
util/config_util.py
→
research/astronet/
tf_
util/config_util.py
View file @
e00e0e13
File moved
research/astronet/
astronet/
util/config_util_test.py
→
research/astronet/
tf_
util/config_util_test.py
View file @
e00e0e13
...
...
@@ -20,7 +20,7 @@ from __future__ import print_function
import
tensorflow
as
tf
from
astronet.
util
import
config_util
from
tf_
util
import
config_util
class
ConfigUtilTest
(
tf
.
test
.
TestCase
):
...
...
research/astronet/
astronet/
util/configdict.py
→
research/astronet/
tf_
util/configdict.py
View file @
e00e0e13
File moved
research/astronet/
astronet/
util/configdict_test.py
→
research/astronet/
tf_
util/configdict_test.py
View file @
e00e0e13
...
...
@@ -20,7 +20,7 @@ from __future__ import print_function
from
absl.testing
import
absltest
from
astronet.
util
import
configdict
from
tf_
util
import
configdict
class
ConfigDictTest
(
absltest
.
TestCase
):
...
...
research/astronet/
astronet/
util/estimator_runner.py
→
research/astronet/
tf_
util/estimator_runner.py
View file @
e00e0e13
...
...
@@ -45,6 +45,8 @@ def evaluate(estimator, eval_args):
latest_checkpoint
=
estimator
.
latest_checkpoint
()
if
not
latest_checkpoint
:
# This is expected if the training job has not yet saved a checkpoint.
tf
.
logging
.
info
(
"No checkpoint in %s, skipping evaluation."
,
estimator
.
model_dir
)
return
global_step
,
values
tf
.
logging
.
info
(
"Starting evaluation on checkpoint %s"
,
latest_checkpoint
)
...
...
@@ -54,7 +56,7 @@ def evaluate(estimator, eval_args):
input_fn
,
steps
=
eval_steps
,
name
=
eval_name
)
if
global_step
is
None
:
global_step
=
values
[
eval_name
].
get
(
"global_step"
)
except
(
tf
.
errors
.
NotFoundError
,
ValueError
)
:
except
tf
.
errors
.
NotFoundError
:
# Expected under some conditions, e.g. checkpoint is already deleted by the
# trainer process. Increasing RunConfig.keep_checkpoint_max may prevent this
# in some cases.
...
...
research/astronet/
astronet/
util/example_util.py
→
research/astronet/
tf_
util/example_util.py
View file @
e00e0e13
File moved
research/astronet/
astronet/
util/example_util_test.py
→
research/astronet/
tf_
util/example_util_test.py
View file @
e00e0e13
...
...
@@ -21,7 +21,7 @@ from __future__ import print_function
import
numpy
as
np
import
tensorflow
as
tf
from
astronet.
util
import
example_util
from
tf_
util
import
example_util
class
ExampleUtilTest
(
tf
.
test
.
TestCase
):
...
...
research/audioset/README.md
View file @
e00e0e13
...
...
@@ -49,14 +49,15 @@ VGGish depends on the following Python packages:
*
[
`resampy`
](
http://resampy.readthedocs.io/en/latest/
)
*
[
`tensorflow`
](
http://www.tensorflow.org/
)
*
[
`six`
](
https://pythonhosted.org/six/
)
*
[
`pysoundfile`
](
https://pysoundfile.readthedocs.io/
)
These are all easily installable via, e.g.,
`pip install numpy`
(as in the
example command sequence below).
Any reasonably recent version of these packages should work. TensorFlow should
be at least version 1.0. We have tested
with Python 2.7.6 and 3.4.3 on
an
Ubuntu-like system with
Num
P
y v1.1
3.1
, SciPy v
0.19.1
, resampy v0.
1.5, TensorFlow
v1.2.1, and Six v1.10
.0.
be at least version 1.0. We have tested
that everything works on Ubuntu
an
d
Windows 10 with Python 3.6.6,
Num
p
y v1.1
5.4
, SciPy v
1.1.0
, resampy v0.
2.1,
TensorFlow v1.3.0, Six v1.11.0 and PySoundFile 0.9
.0.
VGGish also requires downloading two data files:
...
...
research/audioset/vggish_input.py
View file @
e00e0e13
...
...
@@ -17,11 +17,12 @@
import
numpy
as
np
import
resampy
from
scipy.io
import
wavfile
import
mel_features
import
vggish_params
import
soundfile
as
sf
def
waveform_to_examples
(
data
,
sample_rate
):
"""Converts audio waveform into an array of examples for VGGish.
...
...
@@ -80,7 +81,7 @@ def wavfile_to_examples(wav_file):
Returns:
See waveform_to_examples.
"""
sr
,
wav_data
=
wavfile
.
read
(
wav_file
)
wav_data
,
sr
=
sf
.
read
(
wav_file
,
dtype
=
'int16'
)
assert
wav_data
.
dtype
==
np
.
int16
,
'Bad sample type: %r'
%
wav_data
.
dtype
samples
=
wav_data
/
32768.0
# Convert to [-1.0, +1.0]
return
waveform_to_examples
(
samples
,
sr
)
research/deeplab/export_model.py
View file @
e00e0e13
...
...
@@ -126,9 +126,10 @@ def main(unused_argv):
eval_scales
=
FLAGS
.
inference_scales
,
add_flipped_images
=
FLAGS
.
add_flipped_images
)
predictions
=
tf
.
cast
(
predictions
[
common
.
OUTPUT_TYPE
],
tf
.
float32
)
# Crop the valid regions from the predictions.
semantic_predictions
=
tf
.
slice
(
predictions
[
common
.
OUTPUT_TYPE
]
,
predictions
,
[
0
,
0
,
0
],
[
1
,
resized_image_size
[
0
],
resized_image_size
[
1
]])
# Resize back the prediction to the original image size.
...
...
@@ -140,7 +141,7 @@ def main(unused_argv):
label_size
,
method
=
tf
.
image
.
ResizeMethod
.
NEAREST_NEIGHBOR
,
align_corners
=
True
)
return
tf
.
squeeze
(
resized_label
,
3
)
return
tf
.
cast
(
tf
.
squeeze
(
resized_label
,
3
)
,
tf
.
int32
)
semantic_predictions
=
_resize_label
(
semantic_predictions
,
image_size
)
semantic_predictions
=
tf
.
identity
(
semantic_predictions
,
name
=
_OUTPUT_NAME
)
...
...
Prev
1
2
3
4
5
6
7
8
9
…
11
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