From e7817efe9cdb1d6feddf0b4d131e058faff8764b Mon Sep 17 00:00:00 2001 From: gengdongjie Date: Tue, 15 Sep 2020 11:45:45 +0800 Subject: [PATCH] fix codedex warning --- model_zoo/official/cv/maskrcnn/README.md | 1 + model_zoo/official/cv/warpctc/process_data.py | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/model_zoo/official/cv/maskrcnn/README.md b/model_zoo/official/cv/maskrcnn/README.md index 25ec1832da..20eb077c50 100644 --- a/model_zoo/official/cv/maskrcnn/README.md +++ b/model_zoo/official/cv/maskrcnn/README.md @@ -326,6 +326,7 @@ sh run_distribute_train.sh [RANK_TABLE_FILE] [PRETRAINED_MODEL] > hccl.json which is specified by RANK_TABLE_FILE is needed when you are running a distribute task. You can generate it by using the [hccl_tools](https://gitee.com/mindspore/mindspore/tree/master/model_zoo/utils/hccl_tools). > As for PRETRAINED_MODEL, if not set, the model will be trained from the very beginning. Ready-made pretrained_models are not available now. Stay tuned. +> This is processor cores binding operation regarding the `device_num` and total processor numbers. If you are not expect to do it, remove the operations `taskset` in `scripts/run_distribute_train.sh` ### [Training Result](#content) diff --git a/model_zoo/official/cv/warpctc/process_data.py b/model_zoo/official/cv/warpctc/process_data.py index 567ad10933..234250e0e3 100755 --- a/model_zoo/official/cv/warpctc/process_data.py +++ b/model_zoo/official/cv/warpctc/process_data.py @@ -14,6 +14,7 @@ # ============================================================================ """Generate train and test dataset""" import os +import shutil import math as m import random from multiprocessing import Process @@ -46,11 +47,14 @@ def generate_captcha(name, img_num, img_width, img_height, max_digits, process_n process_num(int): number of process to generate captcha images, default is 16 """ cur_script_path = os.path.dirname(os.path.realpath(__file__)) - path = os.path.join(cur_script_path, "data", name) + path_data = os.path.join(cur_script_path, "data") + if not os.path.exists(path_data): + os.mkdir(path_data) + path = os.path.join(path_data, name) print("Generating dataset [{}] under {}...".format(name, path)) if os.path.exists(path): - os.system("rm -rf {}".format(path)) - os.system("mkdir -p {}".format(path)) + shutil.rmtree(path) + os.mkdir(path) img_num_per_thread = m.ceil(img_num / process_num) processes = []