uoft-cs/cifar100
Viewer • Updated • 60k • 73k • 77
手写 AlexNet,适配 CIFAR-100 的 32x32 输入,在卷积层后加入 BatchNorm2d 与 ReLU, 并使用 Dropout 缩减全连接层容量。
kernel_size=3, stride=1, padding=1BatchNorm2d + ReLU256 * 4 * 4 = 4096(0.5071, 0.4867, 0.4408) 与标准差 (0.2675, 0.2565, 0.2761) 归一化| 配置项 | 取值 |
|---|---|
| 数据集 | CIFAR-100 |
| epochs | 40 |
| batch size | 128 |
| 优化器 | SGD(momentum=0.9, weight_decay=5e-4) |
| 初始学习率 | 0.01 |
| 学习率调度 | StepLR(step_size=15, gamma=0.1) |
| 数据增强 | RandomCrop(32, padding=4), RandomHorizontalFlip |
| Dropout | 0.5 |
| 随机种子 | 42 |
CIFAR-100 测试集 top-1 准确率:63.01% (第 36 个 epoch)。
best_model.pth:最佳测试准确率对应的权重(包含 model_state_dict、epoch、test_acc)model.py:与训练时完全一致的模型定义README.md:本模型卡import torch
from huggingface_hub import hf_hub_download
from model import AlexNetCIFAR100
repo_id = "bbbegemot/alexnet-cifar100"
weights = hf_hub_download(repo_id=repo_id, filename="best_model.pth")
checkpoint = torch.load(weights, map_location="cpu")
model = AlexNetCIFAR100(num_classes=100)
model.load_state_dict(checkpoint["model_state_dict"])
model.eval()
model.py 也可以从 Model 仓库或 GitHub 获取: