许可协议:apache-2.0
标签:
- 图像分类
- pytorch
- onnx
数据集:
- frgfm/imagenette
ReXNet-2.0x模型
该模型基于ImageNette预训练。ReXNet架构源自此论文。
模型描述
作者的核心思想是在残差块中加入定制化的Squeeze-Excitation层,以避免通道冗余。
安装指南
环境要求
需安装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/rexnet2_0x").eval()
img = Image.open(图片路径).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-2007-00992,
author = {Dongyoon Han and
Sangdoo Yun and
Byeongho Heo and
Young Joon Yoo},
title = {ReXNet: Diminishing Representational Bottleneck on Convolutional Neural
Network},
journal = {CoRR},
volume = {abs/2007.00992},
year = {2020},
url = {https://arxiv.org/abs/2007.00992},
eprinttype = {arXiv},
eprint = {2007.00992},
timestamp = {Mon, 06 Jul 2020 15:26:01 +0200},
biburl = {https://dblp.org/rec/journals/corr/abs-2007-00992.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}
}