From 50b190db83ea8b8c533ba2c0a322e9b4439424f6 Mon Sep 17 00:00:00 2001 From: typhoonzero Date: Thu, 25 Apr 2019 13:32:32 +0800 Subject: [PATCH] update --- PaddleCV/image_classification/reader.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/PaddleCV/image_classification/reader.py b/PaddleCV/image_classification/reader.py index b55c75f9..11c078cb 100644 --- a/PaddleCV/image_classification/reader.py +++ b/PaddleCV/image_classification/reader.py @@ -136,10 +136,11 @@ def _reader_creator(file_list, def reader(): with open(file_list) as flist: full_lines = [line.strip() for line in flist] + pass_id_as_seed_counter = pass_id_as_seed while True: if shuffle: - if pass_id_as_seed: - np.random.seed(pass_id_as_seed) + if pass_id_as_seed_counter: + np.random.seed(pass_id_as_seed_counter) np.random.shuffle(full_lines) if mode == 'train' and os.getenv('PADDLE_TRAINING_ROLE'): # distributed mode if the env var `PADDLE_TRAINING_ROLE` exits @@ -166,8 +167,8 @@ def _reader_creator(file_list, yield [img_path] if not infinite: break - pass_id_as_seed += 1 - print("passid ++, current: ", pass_id_as_seed) + pass_id_as_seed_counter += 1 + print("passid ++, current: ", pass_id_as_seed_counter) mapper = functools.partial( process_image, mode=mode, color_jitter=color_jitter, rotate=rotate) -- GitLab