Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
deng b04879d699 | 1 year ago | |
---|---|---|
LegoNet | 1 year ago | |
README.md | 1 year ago |
本代码实现基于华为诺亚方舟实验室于ICML2019发表的论文: LegoNet: Efficient Convolutional Neural Networks with Lego Filters
LegoNet指应用乐高卷积核的高效卷积神经网络。其中乐高卷积核表示具有较小尺寸的一组卷积核,传统的卷积核可以由乐高卷积核堆叠而成。
使用的训练数据集:CIFAR-10
CIFAR-10是一个更接近普适物体的彩色图像数据集。CIFAR-10 是一个用于识别普适物体的小型数据集。一共包含10 个类别的RGB 彩色图片:飞机、汽车、鸟类、猫、鹿、狗、蛙类、马、船和卡车。每个图片的尺寸为32 × 32 ,每个类别有6000个图像,数据集中一共有50000 张训练图片和10000 张测试图片。
通过官方网站安装MindSpore后,您可以按照如下步骤进行训练和评估:
# 在单张卡上执行所有的mvtec数据
cd scripts
bash run_all_mvtec.sh [DATASET_PATH] [DEVICE_ID]
# 例如
cd scripts
bash ./run_all_mvtec.sh ../data/mvtec/ 1
# 运行评估示例
cd scripts
bash run_eval.sh [DATASET_PATH] [CKPT_PATH] [DEVICE_ID]
# 例如
cd scripts
bash run_eval.sh ../data/mvtec/ ../ckpt 1
# 单机训练运行示例
bash scripts/run_train_gpu.sh [DATASET_PATH] [DEVICE_ID]
# 运行评估示例
bash scripts/run_eval_gpu.sh [DATASET_PATH] [CKPT_PATH] [DEVICE_ID]
LegoNet
│ eval.py
│ README.md
│ README_CN.md // 描述
│ requirements.txt
│ train.py
│
├─scripts
│ run_all_mvtec.sh
│ run_eval.sh
│ run_eval_gpu.sh
│ run_train_gpu.sh
│
└─src
│ datasets.py // 数据集
│ module.py // LEGO卷积核
│ utils.py // 记录文件
│__vgg.py // 模型文件
train.py和eval.py中主要参数如下:
-- device: 可选值范围为[Ascend, GPU]. 默认Ascend.
-- device_id:用于训练或评估数据集的设备ID。当使用train.sh进行分布式训练时,忽略此参数。
-- checkpoint_path:checkpoint的输出路径。
bash scripts/run_all_mvtec.sh [DATASET_PATH] [DEVICE_NUM]
bash scripts/run_trian_gpu.sh [DATASET_PATH] [DEVICE_ID]
上述shell脚本将在后台运行训练。
bash scripts/run_eval.sh [DATASET_PATH] [CHECKPOINT_PATH] [DEVICE_ID]
bash scripts/run_eval_gpu.sh [DATASET_PATH] [CKPT_PATH] [DEVICE_ID]
上述python命令将在后台运行,您可以通过./outputs/results.txt文件查看结果。测试数据集的准确性如下:
例如:
Correct: 0.934495
参数 | Ascend | GPU |
---|---|---|
模型版本 | LegoNet | LegoNet |
资源 | Ascend 910; CPU: 2.60GHz,192内核;内存,755G | Ubuntu 18.04.6, Tesla V100 1p, CPU 2.90GHz, 64cores, RAM 252GB |
上传日期 | 2022-12-18 | 2022-12-18 |
MindSpore版本 | 1.8.1 | 1.5.0 |
数据集 | CIFAR-10 | CIFAR-10 |
训练参数 | epochs=400 | epochs=400 |
优化器 | SGD | SGD |
损失函数 | SoftmaxCrossEntropyWithLogits | SoftmaxCrossEntropyWithLogits |
输出 | 概率 | 概率 |
损失 | 0.293 | 0.29 |
速度 | 8000 毫秒/步 | 9600 毫秒/步 |
请浏览官网主页。
@inproceedings{legonet,
title={LegoNet: Efficient Convolutional Neural Networks with Lego Filters},
author={Yang, Zhaohui and Wang, Yunhe and Liu, Chuanjian and Chen, Hanting and Xu, Chunjing and Shi, Boxin and Xu, Chao and Xu, Chang},
booktitle={International Conference on Machine Learning},
pages={7005--7014},
year={2019}
}
LegoNet指应用乐高卷积核的高效卷积神经网络。其中乐高卷积核表示具有较小尺寸的一组卷积核,传统的卷积核可以由乐高卷积核堆叠而成。
Python Markdown Shell Text
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》