From 478643f721ed18a64e22fbb7ff76399876ecff18 Mon Sep 17 00:00:00 2001 From: FangManLin <2387517593@qq.com> Date: Wed, 20 Apr 2022 10:41:09 +0800 Subject: [PATCH] fix yolov3 fix Dockerfile fix docker_start.sh fix modelarts/args_modelarts_multi.py fix epoch fix epoch_ --- .../YoloV3_ID0076_for_TensorFlow/Dockerfile | 4 +--- .../YoloV3_ID0076_for_TensorFlow/docker_start.sh | 14 ++++++++++++++ .../infer/docker_start_infer.sh | 2 +- .../modelarts/args_modelarts_multi.py | 2 +- .../modelarts/args_modelarts_single.py | 2 +- .../test/train_performance_1p.sh | 1 + .../YoloV3_ID0076_for_TensorFlow/train.py | 6 ++++-- 7 files changed, 23 insertions(+), 8 deletions(-) diff --git a/TensorFlow/built-in/cv/detection/YoloV3_ID0076_for_TensorFlow/Dockerfile b/TensorFlow/built-in/cv/detection/YoloV3_ID0076_for_TensorFlow/Dockerfile index 6076e6fcd..0dd97d97f 100644 --- a/TensorFlow/built-in/cv/detection/YoloV3_ID0076_for_TensorFlow/Dockerfile +++ b/TensorFlow/built-in/cv/detection/YoloV3_ID0076_for_TensorFlow/Dockerfile @@ -1,9 +1,7 @@ ARG FROM_IMAGE_NAME=ascend-tensorflow-arm:20.1.0 FROM ${FROM_IMAGE_NAME} - +USER root RUN apt -y install libgl1-mesa-glx COPY requirements.txt . RUN pip3.7 install -r requirements.txt - -RUN ln -s /usr/bin/python3.7 /usr/bin/python3 \ No newline at end of file diff --git a/TensorFlow/built-in/cv/detection/YoloV3_ID0076_for_TensorFlow/docker_start.sh b/TensorFlow/built-in/cv/detection/YoloV3_ID0076_for_TensorFlow/docker_start.sh index e99bbe768..949698ab8 100644 --- a/TensorFlow/built-in/cv/detection/YoloV3_ID0076_for_TensorFlow/docker_start.sh +++ b/TensorFlow/built-in/cv/detection/YoloV3_ID0076_for_TensorFlow/docker_start.sh @@ -1,5 +1,19 @@ #!/bin/bash +#Copyright 2022 Huawei Technologies Co., Ltd + +#Licensed under the Apache License, Version 2.0 (the "License"); +#you may not use this file except in compliance with the License. +#You may obtain a copy of the License at + +#http://www.apache.org/licenses/LICENSE-2.0 + +#Unless required by applicable law or agreed to in writing, software +#distributed under the License is distributed on an "AS IS" BASIS, +#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +#See the License for the specific language governing permissions and +#limitations under the License. + docker_image=$1 data_dir=$2 model_dir=$3 diff --git a/TensorFlow/built-in/cv/detection/YoloV3_ID0076_for_TensorFlow/infer/docker_start_infer.sh b/TensorFlow/built-in/cv/detection/YoloV3_ID0076_for_TensorFlow/infer/docker_start_infer.sh index 72889067a..69f4fbbf4 100644 --- a/TensorFlow/built-in/cv/detection/YoloV3_ID0076_for_TensorFlow/infer/docker_start_infer.sh +++ b/TensorFlow/built-in/cv/detection/YoloV3_ID0076_for_TensorFlow/infer/docker_start_infer.sh @@ -38,7 +38,7 @@ function param_check() { param_check -docker run -it \ +docker run -it -u root \ --device=/dev/davinci0 \ --device=/dev/davinci_manager \ --device=/dev/devmm_svm \ diff --git a/TensorFlow/built-in/cv/detection/YoloV3_ID0076_for_TensorFlow/modelarts/args_modelarts_multi.py b/TensorFlow/built-in/cv/detection/YoloV3_ID0076_for_TensorFlow/modelarts/args_modelarts_multi.py index 2d7d2032f..7ae30ea0c 100644 --- a/TensorFlow/built-in/cv/detection/YoloV3_ID0076_for_TensorFlow/modelarts/args_modelarts_multi.py +++ b/TensorFlow/built-in/cv/detection/YoloV3_ID0076_for_TensorFlow/modelarts/args_modelarts_multi.py @@ -45,7 +45,7 @@ if not os.path.exists(save_dir): if not os.path.exists(log_dir): os.makedirs(log_dir) -work_path = '/cache/user-job-dir/YoloV3_for_TensorFlow' +work_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), "../") ### Some paths train_file = os.path.join(work_path, './modelarts/coco2014_trainval_modelarts.txt') # The path of the training txt file. diff --git a/TensorFlow/built-in/cv/detection/YoloV3_ID0076_for_TensorFlow/modelarts/args_modelarts_single.py b/TensorFlow/built-in/cv/detection/YoloV3_ID0076_for_TensorFlow/modelarts/args_modelarts_single.py index 3cf9c9568..7f5d4bd35 100644 --- a/TensorFlow/built-in/cv/detection/YoloV3_ID0076_for_TensorFlow/modelarts/args_modelarts_single.py +++ b/TensorFlow/built-in/cv/detection/YoloV3_ID0076_for_TensorFlow/modelarts/args_modelarts_single.py @@ -45,7 +45,7 @@ if not os.path.exists(save_dir): if not os.path.exists(log_dir): os.makedirs(log_dir) -work_path = '/cache/user-job-dir/YoloV3_for_TensorFlow' +work_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), "../") ### Some paths train_file = os.path.join(work_path, './modelarts/coco2014_trainval_modelarts.txt') # The path of the training txt file. diff --git a/TensorFlow/built-in/cv/detection/YoloV3_ID0076_for_TensorFlow/test/train_performance_1p.sh b/TensorFlow/built-in/cv/detection/YoloV3_ID0076_for_TensorFlow/test/train_performance_1p.sh index 714d7a8b5..f53b38fd4 100644 --- a/TensorFlow/built-in/cv/detection/YoloV3_ID0076_for_TensorFlow/test/train_performance_1p.sh +++ b/TensorFlow/built-in/cv/detection/YoloV3_ID0076_for_TensorFlow/test/train_performance_1p.sh @@ -135,6 +135,7 @@ do --mode single \ --data_url $data_path/coco \ --train_url ${cur_path}/output/$ASCEND_DEVICE_ID/ckpt \ + --total_epoches 1 \ --over_dump ${over_dump} \ --over_dump_path ${over_dump_path} \ > ${cur_path}/output/${ASCEND_DEVICE_ID}/train_${ASCEND_DEVICE_ID}.log 2>&1 & diff --git a/TensorFlow/built-in/cv/detection/YoloV3_ID0076_for_TensorFlow/train.py b/TensorFlow/built-in/cv/detection/YoloV3_ID0076_for_TensorFlow/train.py index 9fdc9b34e..234837384 100644 --- a/TensorFlow/built-in/cv/detection/YoloV3_ID0076_for_TensorFlow/train.py +++ b/TensorFlow/built-in/cv/detection/YoloV3_ID0076_for_TensorFlow/train.py @@ -71,7 +71,8 @@ parser.add_argument("--save_dir", default='./training/', help="path of ckpt.") parser.add_argument("--batch_size", type=int, default=16, help="batchsize.") - +parser.add_argument("--total_epoches", type=int, default=200, + help="epoches of train.") # modify for npu overflow start # enable overflow parser.add_argument("--over_dump", type=str, default="False", @@ -108,7 +109,8 @@ if args_input.save_dir: args.save_dir = args_input.save_dir if args_input.batch_size: args.batch_size = args_input.batch_size - +if args_input.total_epoches: + args.total_epoches = args_input.total_epoches print('setting train mode %s.' % args_input.mode) # setting loggers -- Gitee