From f5f7ac0054323c88f04805fa30451b2c73a58762 Mon Sep 17 00:00:00 2001 From: zhengya01 Date: Thu, 31 Jan 2019 10:04:39 +0000 Subject: [PATCH] add ce --- fluid/PaddleCV/HiNAS_models/nn_paddle.py | 8 ++++++++ fluid/PaddleCV/HiNAS_models/reader.py | 2 -- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/fluid/PaddleCV/HiNAS_models/nn_paddle.py b/fluid/PaddleCV/HiNAS_models/nn_paddle.py index 8cb30673..c91d3d80 100755 --- a/fluid/PaddleCV/HiNAS_models/nn_paddle.py +++ b/fluid/PaddleCV/HiNAS_models/nn_paddle.py @@ -94,6 +94,14 @@ class Model(object): return [avg_cost, accuracy] def run(self): + + if FLAGS.enable_ce: + import random + SEED = 102 + random.seed(SEED) + np.random.seed(SEED) + fluid.default_main_program().random_seed = SEED + fluid.default_startup_program().random_seed = SEED train_files = reader.train10() test_files = reader.test10() diff --git a/fluid/PaddleCV/HiNAS_models/reader.py b/fluid/PaddleCV/HiNAS_models/reader.py index 9448af4e..9b28a2ee 100755 --- a/fluid/PaddleCV/HiNAS_models/reader.py +++ b/fluid/PaddleCV/HiNAS_models/reader.py @@ -82,8 +82,6 @@ def preprocess(sample, is_training): img = (img_float - mean) / std if is_training and FLAGS.cutout: - if FLAGS.enable_ce: - np.random.seed(0) center = np.random.randint(image_size, size=2) offset_width = max(0, center[0] - half_length) offset_height = max(0, center[1] - half_length) -- GitLab