🚀 RepVGG-A0模型
RepVGG-A0模型在ImageNette数据集上进行了预训练。RepVGG架构在这篇论文中被提出。该模型可用于图像分类任务,基于PyTorch和ONNX技术,为图像分类提供了高效的解决方案。
✨ 主要特性
- 作者的核心思想是将训练架构(带有捷径连接)与推理架构(纯高速公路网络)区分开来。
- 通过设计残差块,训练架构可以重新参数化为简单的卷积和非线性激活序列。
📦 安装指南
前提条件
安装Holocron需要Python 3.6(或更高版本)以及 pip/conda。
最新稳定版本
你可以使用 pypi 安装该软件包的最新稳定版本,命令如下:
pip install pylocron
或者使用 conda 进行安装:
conda install -c frgfm pylocron
开发者模式
如果你希望使用该项目中尚未发布的最新功能,可以从源代码安装该软件包(需先安装 Git):
git clone https://github.com/frgfm/Holocron.git
pip install -e Holocron/.
💻 使用示例
基础用法
from PIL import Image
from torchvision.transforms import Compose, ConvertImageDtype, Normalize, PILToTensor, Resize
from torchvision.transforms.functional import InterpolationMode
from holocron.models import model_from_hf_hub
model = model_from_hf_hub("frgfm/repvgg_a0").eval()
img = Image.open(path_to_an_image).convert("RGB")
config = model.default_cfg
transform = Compose([
Resize(config['input_shape'][1:], interpolation=InterpolationMode.BILINEAR),
PILToTensor(),
ConvertImageDtype(torch.float32),
Normalize(config['mean'], config['std'])
])
input_tensor = transform(img).unsqueeze(0)
with torch.inference_mode():
output = model(input_tensor)
probs = output.squeeze(0).softmax(dim=0)
📚 详细文档
引用信息
原论文
@article{DBLP:journals/corr/abs-2101-03697,
author = {Xiaohan Ding and
Xiangyu Zhang and
Ningning Ma and
Jungong Han and
Guiguang Ding and
Jian Sun},
title = {RepVGG: Making VGG-style ConvNets Great Again},
journal = {CoRR},
volume = {abs/2101.03697},
year = {2021},
url = {https://arxiv.org/abs/2101.03697},
eprinttype = {arXiv},
eprint = {2101.03697},
timestamp = {Tue, 09 Feb 2021 15:29:34 +0100},
biburl = {https://dblp.org/rec/journals/corr/abs-2101-03697.bib},
bibsource = {dblp computer science bibliography, https://dblp.org}
}
本实现的来源
@software{Fernandez_Holocron_2020,
author = {Fernandez, François-Guillaume},
month = {5},
title = {{Holocron}},
url = {https://github.com/frgfm/Holocron},
year = {2020}
}
📄 许可证
本项目采用Apache-2.0许可证。