HuggingFace镜像/inception_v3.gluon_in1k
模型介绍文件和版本分析

inception_v3.gluon_in1k 模型卡片

这是一个 Inception-v3 图像分类模型。由 MxNet GLUON 的作者在 ImageNet-1k 数据集上训练而成。

模型详情

  • 模型类型: 图像分类 / 特征主干网络
  • 模型统计信息:
    • 参数数量(百万):23.8
    • 吉次乘加运算(GMACs):5.7
    • 激活值数量(百万):9.0
    • 图像尺寸:299 x 299
  • 相关论文:
    • Rethinking the Inception Architecture for Computer Vision: https://arxiv.org/abs/1512.00567
  • 原始地址: https://github.com/tensorflow/models
  • 数据集: ImageNet-1k

模型用法

特征图提取

from PIL import Image
import timm
from timm.models.efficientnet import _cfg
from openmind import is_torch_npu_available
import torch_npu
import torch
import argparse

if is_torch_npu_available():
    device = "npu:0"
else:
    device = "cpu"

def parse_args():
        parser = argparse.ArgumentParser()
        parser.add_argument( "--model_name_or_path", type=str, default="inception_v3.gluon_in1k", )
        args = parser.parse_args()
        return args
args = parse_args()

model_path = args.model_name_or_path
# load tokenizer
img = Image.open('./beignets-task-guide.png')

config = _cfg(url='', file='model.safetensors')
model = timm.create_model("inception_v3.gluon_in1k", pretrained=True, pretrained_cfg=config).to(device)
model = model.eval()

# get model specific transforms (normalization, resize)
data_config = timm.data.resolve_model_data_config(model)
transforms = timm.data.create_transform(**data_config, is_training=False)

output = model(transforms(img).unsqueeze(0).npu())  # unsqueeze single image into batch of 1

for o in output:
    # print shape of each feature map in output
    # e.g.:
    #  torch.Size([1, 64, 147, 147])
    #  torch.Size([1, 192, 71, 71])
    #  torch.Size([1, 288, 35, 35])
    #  torch.Size([1, 768, 17, 17])
    #  torch.Size([1, 2048, 8, 8])

    print(o.shape)

模型对比

在 timm 模型结果 中探索此模型的数据集和运行时指标。

引用

@article{DBLP:journals/corr/SzegedyVISW15,
  author    = {Christian Szegedy and
               Vincent Vanhoucke and
               Sergey Ioffe and
               Jonathon Shlens and
               Zbigniew Wojna},
  title     = {Rethinking the Inception Architecture for Computer Vision},
  journal   = {CoRR},
  volume    = {abs/1512.00567},
  year      = {2015},
  url       = {http://arxiv.org/abs/1512.00567},
  archivePrefix = {arXiv},
  eprint    = {1512.00567},
  timestamp = {Mon, 13 Aug 2018 16:49:07 +0200},
  biburl    = {https://dblp.org/rec/journals/corr/SzegedyVISW15.bib},
  bibsource = {dblp computer science bibliography, https://dblp.org}
}
下载使用量0