🚀 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許可證。