fix codedex warning

pull/6242/head
gengdongjie 4 years ago
parent 8b0793eb84
commit e7817efe9c

@ -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)

@ -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 = []

Loading…
Cancel
Save