From 0b1a2eb3d38615f4fd18fb6ac639c7450fc96d03 Mon Sep 17 00:00:00 2001 From: Shuhei Iitsuka Date: Mon, 6 Jun 2022 16:05:05 +0900 Subject: [PATCH] TensorFlow version up --- mozc-nazoru/setup.py | 2 +- mozc-nazoru/src/nazoru/lib.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mozc-nazoru/setup.py b/mozc-nazoru/setup.py index acedbb0..f9fd383 100755 --- a/mozc-nazoru/setup.py +++ b/mozc-nazoru/setup.py @@ -61,7 +61,7 @@ setup( install_requires=[ 'cairocffi', 'pillow', - 'tensorflow~=2.5.1', + 'tensorflow~=2.9.1', 'tf_slim~=1.1.0', 'enum34;python_version<"3.4"', 'pyserial', diff --git a/mozc-nazoru/src/nazoru/lib.py b/mozc-nazoru/src/nazoru/lib.py index 740d6a0..d284864 100644 --- a/mozc-nazoru/src/nazoru/lib.py +++ b/mozc-nazoru/src/nazoru/lib.py @@ -113,7 +113,8 @@ def normalize_x(x): x = np.array(x) max_ = np.max(x[:, :2], axis=0) min_ = np.min(x[:, :2], axis=0) - x[:, :2] = (x[:, :2] - min_) / (max_ - min_) + dist = max_ - min_ + x[:, :2] = (x[:, :2] - min_) / np.fmax(dist, np.ones_like(dist) * 0.0001) return x