Commit 6eb4b244 authored by Yuxin Wu's avatar Yuxin Wu

Fallback to tf.contrib.layers.variance_scaling_initializer.

parent 32c83fea
...@@ -60,7 +60,7 @@ Dependencies: ...@@ -60,7 +60,7 @@ Dependencies:
+ Python 2.7 or 3 + Python 2.7 or 3
+ Python bindings for OpenCV (Optional, but required by a lot of features) + Python bindings for OpenCV (Optional, but required by a lot of features)
+ TensorFlow >= 1.2.0 (Optional if you only want to use `tensorpack.dataflow` alone as a data processing library) + TensorFlow >= 1.3.0 (Optional if you only want to use `tensorpack.dataflow` alone as a data processing library)
``` ```
# install git, then: # install git, then:
pip install -U git+https://github.com/ppwwyyxx/tensorpack.git pip install -U git+https://github.com/ppwwyyxx/tensorpack.git
......
...@@ -208,7 +208,6 @@ def get_train_dataflow(add_mask=False): ...@@ -208,7 +208,6 @@ def get_train_dataflow(add_mask=False):
changed or skipped accordingly. changed or skipped accordingly.
""" """
# Valid training images should have at least one fg box. # Valid training images should have at least one fg box.
# But this filter shall not be applied for testing. # But this filter shall not be applied for testing.
imgs = list(filter(lambda img: len(img['boxes']) > 0, imgs)) # log invalid training imgs = list(filter(lambda img: len(img['boxes']) > 0, imgs)) # log invalid training
......
...@@ -36,8 +36,8 @@ try: ...@@ -36,8 +36,8 @@ try:
import tensorflow as tf # noqa import tensorflow as tf # noqa
_version = tf.__version__.split('.') _version = tf.__version__.split('.')
assert int(_version[0]) >= 1, "TF>=1.0 is required!" assert int(_version[0]) >= 1, "TF>=1.0 is required!"
if int(_version[1]) < 2: if int(_version[1]) < 3:
print("TF<1.2 support will be removed after 2018-02-28!") print("TF<1.3 support will be removed after 2018-03-15! Actually many examples already require TF>=1.3.")
_HAS_TF = True _HAS_TF = True
except ImportError: except ImportError:
_HAS_TF = False _HAS_TF = False
......
...@@ -60,7 +60,8 @@ def Conv2D(x, out_channel, kernel_shape, ...@@ -60,7 +60,8 @@ def Conv2D(x, out_channel, kernel_shape,
kw_args['dilations'] = shape4d(dilation_rate, data_format=data_format) kw_args['dilations'] = shape4d(dilation_rate, data_format=data_format)
if W_init is None: if W_init is None:
W_init = tf.variance_scaling_initializer(scale=2.0) # W_init = tf.variance_scaling_initializer(scale=2.0)
W_init = tf.contrib.layers.variance_scaling_initializer(2.0)
if b_init is None: if b_init is None:
b_init = tf.constant_initializer() b_init = tf.constant_initializer()
...@@ -114,7 +115,8 @@ def Deconv2D(x, out_channel, kernel_shape, ...@@ -114,7 +115,8 @@ def Deconv2D(x, out_channel, kernel_shape,
* ``b``: bias * ``b``: bias
""" """
if W_init is None: if W_init is None:
W_init = tf.variance_scaling_initializer(scale=2.0) # W_init = tf.variance_scaling_initializer(scale=2.0)
W_init = tf.contrib.layers.variance_scaling_initializer(2.0)
if b_init is None: if b_init is None:
b_init = tf.constant_initializer() b_init = tf.constant_initializer()
......
...@@ -38,7 +38,8 @@ def FullyConnected(x, out_dim, ...@@ -38,7 +38,8 @@ def FullyConnected(x, out_dim,
x = symbf.batch_flatten(x) x = symbf.batch_flatten(x)
if W_init is None: if W_init is None:
W_init = tf.variance_scaling_initializer(2.0) # W_init = tf.variance_scaling_initializer(2.0)
W_init = tf.contrib.layers.variance_scaling_initializer(2.0)
if b_init is None: if b_init is None:
b_init = tf.constant_initializer() b_init = tf.constant_initializer()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment