本项目基于PaddlePaddle复现Wide Resnet,它是ResNet变体,改进了shortcut,采用更宽卷积并加dropout层。在CIFAR10测试集精度达96.6%,提供单卡和多卡训练方式,代码含模型、训练、评估等文件,依赖PaddlePaddle≥2.0.0,支持GPU和CPU运行。
☞☞☞AI 智能聊天, 问答助手, AI 智能搜索, 免费无限量使用 DeepSeek R1 模型☜☜☜

本项目基于paddlepaddle框架复现Wide Resnet,他是resnet的一种变体,主要区别在于对resnet的shortcut进行了改进,使用更“宽”的卷积以及加上了dropout层。
论文:
参考项目:
该列指标在cifar10的测试集测试
train from scratch细节:
| epoch | opt | batch_size | dataset | memory | card | precision | |
|---|---|---|---|---|---|---|---|
| 1 | 400 | SGD | 128 | CIFAR10 | 16G | 1 | 0.9660 |
模型下载 模型地址:aistudio
CIFAR10数据集。
硬件:GPU、CPU
框架:
# clone this repogit clone https://github.com/PaddlePaddle/Contrib.gitcd wide_resnetexport PYTHONPATH=./
安装依赖
PHP 5 _ MySQL Programming for the Absolute Beginner
349
python3 -m pip install -r requirements.txt
python3 train.py
如果你想分布式训练并使用多卡:
python3 -m paddle.distributed.launch --log_dir=./debug/ --gpus '0,1,2,3' train.py
此时的输出为:
Epoch 0: PiecewiseDecay set learning rate to 0.05.iter:0 loss:2.4832iter:10 loss:2.3544iter:20 loss:2.3087iter:30 loss:2.2509iter:40 loss:2.2450
python3 eval.py
此时的输出为:
acc:9660 total:10000 ratio:0.966
│ wide_resnet.py # 模型文件│ eval.py # 评估│ README.md # 英文readme│ README_cn.md # 中文readme│ requirement.txt # 依赖│ train.py # 训练
无
python3 train.py
python3 -m paddle.distributed.launch --log_dir=./debug/ --gpus '0,1,2,3' train.py
此时,程序会将每个进程的输出log导入到./debug路径下:
. ├── debug │ ├── workerlog.0│ ├── workerlog.1│ ├── workerlog.2│ └── workerlog.3├── README.md └── train.py
执行训练开始后,将得到类似如下的输出。每一轮batch训练将会打印当前epoch、step以及loss值。
Epoch 0: PiecewiseDecay set learning rate to 0.05. iter:0 loss:2.4832 iter:10 loss:2.3544 iter:20 loss:2.3087 iter:30 loss:2.2509 iter:40 loss:2.2450
python3 eval.py
此时的输出为:
acc:9660 total:10000 ratio:0.966
关于模型的其他信息,可以参考下表:
| 信息 | 说明 |
|---|---|
| 发布者 | 徐铭远 |
| 时间 | 2021.08 |
| 框架版本 | >=Paddle 2.0.2 |
| 应用场景 | 图像分类 |
| 支持硬件 | GPU、CPU |
| 下载链接 | 预训练模型 |
# 以下为在aistudio上直接运行
# 训练!python3 train.py
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/layers/utils.py:26: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information. Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations def convert_to_list(value, n, name, dtype=np.int): W0808 16:41:54.148313 32483 device_context.cc:362] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 10.1, Runtime API Version: 10.1 W0808 16:41:54.152312 32483 device_context.cc:372] device: 0, cuDNN Version: 7.6. Epoch 0: PiecewiseDecay set learning rate to 0.05. iter:0 loss:2.4279 iter:10 loss:2.3434 ^C
# 评估!python3 eval.py
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/layers/utils.py:26: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information. Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations def convert_to_list(value, n, name, dtype=np.int): W0808 16:37:21.490298 32096 device_context.cc:362] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 10.1, Runtime API Version: 10.1 W0808 16:37:21.494925 32096 device_context.cc:372] device: 0, cuDNN Version: 7.6. acc:9660 total:10000 ratio:0.966
以上就是ResNet_wide for CIFAR10的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号