Browse Source

fix bug in model zoo for mobilenet

tags/v0.5.0-beta
chenzomi 5 years ago
parent
commit
b42ba6c48b
8 changed files with 27 additions and 25 deletions
  1. +1
    -1
      mindspore/model_zoo/mobilenetv2/Readme.md
  2. +3
    -1
      mindspore/model_zoo/mobilenetv2/eval.py
  3. +1
    -1
      mindspore/model_zoo/mobilenetv2/scripts/run_infer.sh
  4. +4
    -4
      mindspore/model_zoo/mobilenetv2/scripts/run_train.sh
  5. +1
    -1
      mindspore/model_zoo/mobilenetv2/train.py
  6. +1
    -1
      mindspore/model_zoo/mobilenetv3/Readme.md
  7. +5
    -5
      mindspore/model_zoo/mobilenetv3/scripts/run_infer.sh
  8. +11
    -11
      mindspore/model_zoo/mobilenetv3/scripts/run_train.sh

+ 1
- 1
mindspore/model_zoo/mobilenetv2/Readme.md View File

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


+ 3
- 1
mindspore/model_zoo/mobilenetv2/eval.py View File

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


+ 1
- 1
mindspore/model_zoo/mobilenetv2/scripts/run_infer.sh View File

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

+ 4
- 4
mindspore/model_zoo/mobilenetv2/scripts/run_train.sh View File

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


+ 1
- 1
mindspore/model_zoo/mobilenetv2/train.py View File

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


+ 1
- 1
mindspore/model_zoo/mobilenetv3/Readme.md View File

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


+ 5
- 5
mindspore/model_zoo/mobilenetv3/scripts/run_infer.sh View File

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

+ 11
- 11
mindspore/model_zoo/mobilenetv3/scripts/run_train.sh View File

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


Loading…
Cancel
Save