🚀 RepVGG - A1模型
该模型在图像分类任务上表现出色,基于RepVGG架构,在ImageNette数据集上预训练,具有高效的推理性能。
🚀 快速开始
本项目的RepVGG - A1模型在 ImageNette 数据集上进行了预训练。RepVGG架构在 这篇论文 中被提出。
✨ 主要特性
作者的核心思想是将训练架构(带有捷径连接)与推理架构(纯直连网络)区分开来。通过设计残差块,训练架构可以被重新参数化为简单的卷积和非线性激活序列。
📦 安装指南
前提条件
安装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_a1").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许可证。