Browse Source

!3816 If not set pretrained model,we should not be allowed to run training tasks

Merge pull request !3816 from zhouyuanshen/master
tags/v0.7.0-beta
mindspore-ci-bot Gitee 5 years ago
parent
commit
e01036f6ca
3 changed files with 18 additions and 34 deletions
  1. +2
    -2
      model_zoo/official/cv/faster_rcnn/README.md
  2. +8
    -16
      model_zoo/official/cv/faster_rcnn/scripts/run_distribute_train.sh
  3. +8
    -16
      model_zoo/official/cv/faster_rcnn/scripts/run_standalone_train.sh

+ 2
- 2
model_zoo/official/cv/faster_rcnn/README.md View File

@@ -94,7 +94,7 @@ sh run_standalone_train.sh [PRETRAINED_MODEL]
``` ```
> Rank_table.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). > Rank_table.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.
> As for PRETRAINED_MODEL,it should be a ResNet50 checkpoint that trained over ImageNet2012. Ready-made pretrained_models are not available now. Stay tuned.


#### Result #### Result
@@ -125,7 +125,7 @@ sh run_eval.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH]


#### Result #### Result
Inference result will be stored in the example path, whose folder name is "infer". Under this, you can find result like the followings in log.
Inference result will be stored in the example path, whose folder name is "eval". Under this, you can find result like the followings in log.
``` ```
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.360 Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.360


+ 8
- 16
model_zoo/official/cv/faster_rcnn/scripts/run_distribute_train.sh View File

@@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
# ============================================================================ # ============================================================================


if [ $# -lt 1 ] || [ $# -gt 2 ]
if [ $# -ne 2 ]
then then
echo "Usage: sh run_train.sh [RANK_TABLE_FILE] [PRETRAINED_PATH]" echo "Usage: sh run_train.sh [RANK_TABLE_FILE] [PRETRAINED_PATH]"
exit 1 exit 1
@@ -37,15 +37,12 @@ then
exit 1 exit 1
fi fi


if [ $# == 2 ]
then
PATH2=$(get_real_path $2)
echo $PATH2
if [ ! -f $PATH2 ]
then
echo "error: PRETRAINED_PATH=$PATH2 is not a file"
exit 1
fi
PATH2=$(get_real_path $2)
echo $PATH2
if [ ! -f $PATH2 ]
then
echo "error: PRETRAINED_PATH=$PATH2 is not a file"
exit 1
fi fi


ulimit -u unlimited ulimit -u unlimited
@@ -65,11 +62,6 @@ do
cd ./train_parallel$i || exit cd ./train_parallel$i || exit
echo "start training for rank $RANK_ID, device $DEVICE_ID" echo "start training for rank $RANK_ID, device $DEVICE_ID"
env > env.log env > env.log
if [ $# == 2 ]
then
python train.py --do_train=True --device_id=$i --rank_id=$i --run_distribute=True --device_num=$DEVICE_NUM --pre_trained=$PATH2 &> log &
else
python train.py --do_train=True --device_id=$i --rank_id=$i --run_distribute=True --device_num=$DEVICE_NUM &> log &
fi
python train.py --do_train=True --device_id=$i --rank_id=$i --run_distribute=True --device_num=$DEVICE_NUM --pre_trained=$PATH2 &> log &
cd .. cd ..
done done

+ 8
- 16
model_zoo/official/cv/faster_rcnn/scripts/run_standalone_train.sh View File

@@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
# ============================================================================ # ============================================================================


if [ $# -gt 1 ]
if [ $# -ne 1 ]
then then
echo "Usage: sh run_standalone_train.sh [PRETRAINED_PATH]" echo "Usage: sh run_standalone_train.sh [PRETRAINED_PATH]"
exit 1 exit 1
@@ -28,16 +28,13 @@ get_real_path(){
fi fi
} }


if [ $# == 1 ]
then
PATH1=$(get_real_path $1)
echo $PATH1
PATH1=$(get_real_path $1)
echo $PATH1


if [ ! -f $PATH1 ]
then
echo "error: PRETRAINED_PATH=$PATH1 is not a file"
exit 1
fi
if [ ! -f $PATH1 ]
then
echo "error: PRETRAINED_PATH=$PATH1 is not a file"
exit 1
fi fi


ulimit -u unlimited ulimit -u unlimited
@@ -57,10 +54,5 @@ cp -r ../src ./train
cd ./train || exit cd ./train || exit
echo "start training for device $DEVICE_ID" echo "start training for device $DEVICE_ID"
env > env.log env > env.log
if [ $# == 1 ]
then
python train.py --do_train=True --device_id=$DEVICE_ID --pre_trained=$PATH1 &> log &
else
python train.py --do_train=True --device_id=$DEVICE_ID &> log &
fi
python train.py --do_train=True --device_id=$DEVICE_ID --pre_trained=$PATH1 &> log &
cd .. cd ..

Loading…
Cancel
Save