提交 d9f100dc 编写于 作者: L luxuhui

fix some tiny bugs

N/A
Signed-off-by: NLuxuhui <luxuhui@xiaomi.com>
上级 d0ddb683
...@@ -53,12 +53,13 @@ Optional dependencies ...@@ -53,12 +53,13 @@ Optional dependencies
- Remark - Remark
* - Android NDK * - Android NDK
- `NDK installation guide <https://developer.android.com/ndk/guides/setup#install>`__ - `NDK installation guide <https://developer.android.com/ndk/guides/setup#install>`__
- Required by Android build, r15b, r15c, r16b, r17b - Required by Android build, r15b or higher version for bazel users, r17b or higher version for cmake users.
* - Bazel * - Bazel
- `bazel installation guide <https://docs.bazel.build/versions/master/install.html>`__ - `bazel installation guide <https://docs.bazel.build/versions/master/install.html>`__
- 0.13.0 - 0.13.0
* - ADB * - ADB
- Linux:``apt-get install android-tools-adb`` Mac:``brew cask install android-platform-tools`` - | Linux:``apt-get install android-tools-adb``
| Mac:``brew cask install android-platform-tools``
- Required by Android run, >= 1.0.32 - Required by Android run, >= 1.0.32
* - TensorFlow * - TensorFlow
- pip install tensorflow==1.8.0 - pip install tensorflow==1.8.0
...@@ -89,3 +90,4 @@ For python dependencies, ...@@ -89,3 +90,4 @@ For python dependencies,
- It will link ``libc++`` instead of ``gnustl`` if ``NDK version >= r17b`` and ``bazel version >= 0.13.0``, please refer to `NDK cpp-support <https://developer.android.com/ndk/guides/cpp-support>`__. - It will link ``libc++`` instead of ``gnustl`` if ``NDK version >= r17b`` and ``bazel version >= 0.13.0``, please refer to `NDK cpp-support <https://developer.android.com/ndk/guides/cpp-support>`__.
- For Mac, please install Homebrew at first before installing other dependencies. Set ANDROID_NDK_HOME in ``/etc/bashrc`` and then run ``source /etc/bashrc``. This installation was tested with macOS Mojave(10.14). - For Mac, please install Homebrew at first before installing other dependencies. Set ANDROID_NDK_HOME in ``/etc/bashrc`` and then run ``source /etc/bashrc``. This installation was tested with macOS Mojave(10.14).
rs.
\ No newline at end of file
...@@ -10,7 +10,7 @@ Before you do anything, clear the workspace used by build and test process. ...@@ -10,7 +10,7 @@ Before you do anything, clear the workspace used by build and test process.
.. code-block:: sh .. code-block:: sh
tools/clear_workspace.sh tools/clear_workspace.sh [--expunge]
Build Engine Build Engine
......
...@@ -5,7 +5,7 @@ rm -rf mace/codegen/engine ...@@ -5,7 +5,7 @@ rm -rf mace/codegen/engine
rm -rf mace/codegen/opencl rm -rf mace/codegen/opencl
for d in build/*; do for d in build/*; do
if [[ "$d" != "build/cmake-build" ]]; then if [[ "$1" == "--expunge" || "$d" != "build/cmake-build" ]]; then
echo "remove $d" echo "remove $d"
rm -rf "$d" rm -rf "$d"
fi fi
......
...@@ -58,7 +58,7 @@ def images_to_tensors(input_files, image_shape, mean_values=None): ...@@ -58,7 +58,7 @@ def images_to_tensors(input_files, image_shape, mean_values=None):
align_corners=False) align_corners=False)
with tf.Session() as sess: with tf.Session() as sess:
for i in xrange(len(input_files)): for i in range(len(input_files)):
with tf.gfile.FastGFile(input_files[i], 'rb') as f: with tf.gfile.FastGFile(input_files[i], 'rb') as f:
src_image = f.read() src_image = f.read()
dst_image = sess.run(image_data, dst_image = sess.run(image_data,
......
...@@ -51,7 +51,7 @@ def tensors_to_images(input_files, image_shape, add_softmax): ...@@ -51,7 +51,7 @@ def tensors_to_images(input_files, image_shape, add_softmax):
writer = tf.write_file(output, image_data, name='output_writer') writer = tf.write_file(output, image_data, name='output_writer')
with tf.Session() as sess: with tf.Session() as sess:
for i in xrange(len(input_files)): for i in range(len(input_files)):
input_data = np.fromfile(input_files[i], dtype=np.float32) \ input_data = np.fromfile(input_files[i], dtype=np.float32) \
.reshape(image_shape) .reshape(image_shape)
output_file = os.path.join(FLAGS.output_dir, os.path.splitext( output_file = os.path.join(FLAGS.output_dir, os.path.splitext(
......
...@@ -35,8 +35,8 @@ GENERATED_NAME = set() ...@@ -35,8 +35,8 @@ GENERATED_NAME = set()
def generate_obfuscated_name(namespace, name): def generate_obfuscated_name(namespace, name):
md5 = hashlib.md5() md5 = hashlib.md5()
md5.update(namespace) md5.update(namespace.encode('utf-8'))
md5.update(name) md5.update(name.encode('utf-8'))
md5_digest = md5.hexdigest() md5_digest = md5.hexdigest()
name = md5_digest[:8] name = md5_digest[:8]
......
...@@ -67,7 +67,7 @@ class QuantizeStat(object): ...@@ -67,7 +67,7 @@ class QuantizeStat(object):
cur_max_idx = 0 cur_max_idx = 0
cur_min = tensor_min cur_min = tensor_min
cur_max = tensor_max cur_max = tensor_max
for i in xrange(samples): for i in range(samples):
if tensor_mins[i] + 0.1 > cur_max: if tensor_mins[i] + 0.1 > cur_max:
break break
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册