MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications
与传统卷积神经网络相比,MobileNetV1在准确率略有下降的前提下,大幅减少了参数数量和计算量(与VGG16相比,准确率下降0.9%,但模型参数仅为VGG的1/32)。该模型基于精简架构,采用深度可分离卷积构建轻量级深度神经网络。同时,引入了两个简单的全局超参数,能够有效权衡延迟与准确率。[1]
图1. MobileNetV1架构 [1]
我们复现的模型在ImageNet-1K上的性能如下表所示。
请参考 MindCV 中的安装说明。
请下载ImageNet-1K数据集用于模型训练和验证。
使用预定义的训练方案可轻松复现报告中的结果。如需在多Ascend 910设备上进行分布式训练,请运行
# distributed training on multiple GPU/Ascend devices
mpirun -n 8 python train.py --config configs/mobilenetv1/mobilenet_v1_0.25_ascend.yaml --data_dir /path/to/imagenet如果脚本由 root 用户执行,则必须在
mpirun中添加--allow-run-as-root参数。
同样,您可以使用上述 mpirun 命令在多个 GPU 设备上训练模型。
有关所有超参数的详细说明,请参阅 config.py。
注意: 由于全局批大小(batch_size × num_devices)是一个重要的超参数,为确保复现性,建议保持全局批大小不变,或者根据新的全局批大小对学习率进行线性调整。
如果您希望在不进行分布式训练的情况下,在较小的数据集上训练或微调模型,请运行:
# standalone training on a CPU/GPU/Ascend device
python train.py --config configs/mobilenetv1/mobilenet_v1_0.25_ascend.yaml --data_dir /path/to/dataset --distribute False要验证训练模型的准确性,您可以使用 validate.py 并通过 --ckpt_path 参数解析检查点路径。
python validate.py -c configs/mobilenetv1/mobilenet_v1_0.25_ascend.yaml --data_dir /path/to/imagenet --ckpt_path /path/to/ckpt请参考 MindCV 中的部署教程。
[1] Howard A G, Zhu M, Chen B, et al. Mobilenets: Efficient convolutional neural networks for mobile vision applications[J]. arXiv preprint arXiv:1704.04861, 2017.