提交 b42ba6c4 编写于 作者: C chenzomi

fix bug in model zoo for mobilenet

上级 93fc82b8
......@@ -133,7 +133,7 @@ result: {'acc': 0.71976314102564111} ckpt=/path/to/checkpoint/mobilenet-200_625.
#### Inference Performance
| Parameters | GoogLeNet | | |
| Parameters | | | |
| -------------------------- | ----------------------------- | ------------------------- | -------------------- |
| Model Version | V1 | | |
| Resource | Huawei 910 | NV SMX2 V100-32G | Huawei 310 |
......
......@@ -36,21 +36,23 @@ args_opt = parser.parse_args()
if __name__ == '__main__':
config_platform = None
net = None
if args_opt.platform == "Ascend":
config_platform = config_ascend
device_id = int(os.getenv('DEVICE_ID'))
context.set_context(mode=context.GRAPH_MODE, device_target="Ascend",
device_id=device_id, save_graphs=False)
net = mobilenet_v2(num_classes=config_platform.num_classes, platform="Ascend")
elif args_opt.platform == "GPU":
config_platform = config_gpu
context.set_context(mode=context.GRAPH_MODE,
device_target="GPU", save_graphs=False)
net = mobilenet_v2(num_classes=config_platform.num_classes, platform="GPU")
else:
raise ValueError("Unsupport platform.")
loss = nn.SoftmaxCrossEntropyWithLogits(
is_grad=False, sparse=True, reduction='mean')
net = mobilenet_v2(num_classes=config_platform.num_classes)
if args_opt.platform == "Ascend":
net.to_float(mstype.float16)
......
......@@ -52,4 +52,4 @@ python ${BASEPATH}/../eval.py \
--platform=$1 \
--dataset_path=$2 \
--checkpoint_path=$3 \
&> infer.log & # dataset val folder path
&> ../infer.log & # dataset val folder path
......@@ -36,13 +36,13 @@ run_ascend()
fi
mkdir ../train
cd ../train || exit
python ${BASEPATH}/../launch.py \
python ${BASEPATH}/../src/launch.py \
--nproc_per_node=$2 \
--visible_devices=$4 \
--server_id=$3 \
--training_script=${BASEPATH}/train.py \
--training_script=${BASEPATH}/../train.py \
--dataset_path=$5 \
--platform=$1 &> train.log & # dataset train folder
--platform=$1 &> ../train.log & # dataset train folder
}
run_gpu()
......@@ -73,7 +73,7 @@ run_gpu()
python ${BASEPATH}/../train.py \
--dataset_path=$4 \
--platform=$1 \
&> train.log & # dataset train folder
&> ../train.log & # dataset train folder
}
if [ $# -gt 5 ] || [ $# -lt 4 ]
......
......@@ -216,7 +216,7 @@ if __name__ == '__main__':
init()
epoch_size = config_ascend.epoch_size
net = mobilenet_v2(num_classes=config_ascend.num_classes)
net = mobilenet_v2(num_classes=config_ascend.num_classes, platform="Ascend")
net.to_float(mstype.float16)
for _, cell in net.cells_and_names():
if isinstance(cell, nn.Dense):
......
......@@ -133,7 +133,7 @@ result: {'acc': 0.71976314102564111} ckpt=/path/to/checkpoint/mobilenet-200_625.
#### Inference Performance
| Parameters | GoogLeNet | | |
| Parameters | | | |
| -------------------------- | ----------------------------- | ------------------------- | -------------------- |
| Model Version | V1 | | |
| Resource | Huawei 910 | NV SMX2 V100-32G | Huawei 310 |
......
......@@ -42,14 +42,14 @@ export RANK_ID=0
export RANK_SIZE=1
if [ -d "eval" ];
then
rm -rf ./eval
rm -rf ../eval
fi
mkdir ./eval
cd ./eval || exit
mkdir ../eval
cd ../eval || exit
# luanch
python ${BASEPATH}/eval.py \
python ${BASEPATH}/../eval.py \
--platform=$1 \
--dataset_path=$2 \
--checkpoint_path=$3 \
&> infer.log & # dataset val folder path
&> ../infer.log & # dataset val folder path
......@@ -31,17 +31,17 @@ run_ascend()
export PYTHONPATH=${BASEPATH}:$PYTHONPATH
if [ -d "train" ];
then
rm -rf ./train
rm -rf ../train
fi
mkdir ./train
cd ./train || exit
python ${BASEPATH}/launch.py \
mkdir ../train
cd ../train || exit
python ${BASEPATH}/../src/launch.py \
--nproc_per_node=$2 \
--visible_devices=$4 \
--server_id=$3 \
--training_script=${BASEPATH}/train.py \
--training_script=${BASEPATH}/../train.py \
--dataset_path=$5 \
--platform=$1 &> train.log & # dataset train folder
--platform=$1 &> ../train.log & # dataset train folder
}
run_gpu()
......@@ -62,17 +62,17 @@ run_gpu()
export PYTHONPATH=${BASEPATH}:$PYTHONPATH
if [ -d "train" ];
then
rm -rf ./train
rm -rf ../train
fi
mkdir ./train
cd ./train || exit
mkdir ../train
cd ../train || exit
export CUDA_VISIBLE_DEVICES="$3"
mpirun -n $2 --allow-run-as-root \
python ${BASEPATH}/train.py \
python ${BASEPATH}/../train.py \
--dataset_path=$4 \
--platform=$1 \
&> train.log & # dataset train folder
&> ../train.log & # dataset train folder
}
if [ $# -gt 5 ] || [ $# -lt 4 ]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册