模型库 / timm/mobilenetv3_small_100.lamb_in1k

mobilenetv3_small_100.lamb_in1k

timm image-classification timm
timm/mobilenetv3_small_100.lamb_in1k
18,655,969
下载量
288
收藏数
26
浏览量
apache-2.0
许可

简介

A MobileNet-v3 image classification model. Trained on ImageNet-1k in `timm` using recipe template described below.

模型卡片

许可协议 apache-2.0
框架 timm
数据集
imagenet-1k
image-classification timm transformers

模型详情

已翻译

mobilenetv3_small_100.lamb_in1k 模型卡片

一个 MobileNet-v3 图像分类模型。使用下文描述的配方模板在 timm 中的 ImageNet-1k 上训练。

配方详情:
* 基于 LAMB 优化器的配方,类似于 ResNet Strikes Back A2,但训练时长延长 50%,采用 EMA 权重平均,无 CutMix
* 阶梯式指数衰减学习率调度,带预热阶段

模型详情

  • 模型类型: 图像分类 / 特征骨干网络
  • 模型统计:
  • 参数量 (M):2.5
  • GMACs:0.1
  • 激活值 (M):1.4
  • 图像尺寸:224 x 224
  • 论文:
  • Searching for MobileNetV3:https://arxiv.org/abs/1905.02244
  • 数据集: ImageNet-1k
  • 原始来源: https://github.com/huggingface/pytorch-image-models

模型使用

图像分类

from urllib.request import urlopen
from PIL import Image
import timm

img = Image.open(urlopen(
    'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
))

model = timm.create_model('mobilenetv3_small_100.lamb_in1k', pretrained=True)
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))  # unsqueeze single image into batch of 1

top5_probabilities, top5_class_indices = torch.topk(output.softmax(dim=1) * 100, k=5)

特征图提取

from urllib.request import urlopen
from PIL import Image
import timm

img = Image.open(urlopen(
    'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
))

model = timm.create_model(
    'mobilenetv3_small_100.lamb_in1k',
    pretrained=True,
    features_only=True,
)
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))  # unsqueeze single image into batch of 1

for o in output:
    # print shape of each feature map in output
    # e.g.:
    #  torch.Size([1, 16, 112, 112])
    #  torch.Size([1, 16, 56, 56])
    #  torch.Size([1, 24, 28, 28])
    #  torch.Size([1, 48, 14, 14])
    #  torch.Size([1, 576, 7, 7])

    print(o.shape)

图像 Embeddings

from urllib.request import urlopen
from PIL import Image
import timm

img = Image.open(urlopen(
    'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
))

model = timm.create_model(
    'mobilenetv3_small_100.lamb_in1k',
    pretrained=True,
    num_classes=0,  # remove classifier nn.Linear
)
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))  # output is (batch_size, num_features) shaped tensor

# or equivalently (without needing to set num_classes=0)

output = model.forward_features(transforms(img).unsqueeze(0))
# output is unpooled, a (1, 576, 7, 7) shaped tensor

output = model.forward_head(output, pre_logits=True)
# output is a (1, num_features) shaped tensor

模型对比

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

引用

@misc{rw2019timm,
  author = {Ross Wightman},
  title = {PyTorch Image Models},
  year = {2019},
  publisher = {GitHub},
  journal = {GitHub repository},
  doi = {10.5281/zenodo.4414861},
  howpublished = {\url{https://github.com/huggingface/pytorch-image-models}}
}
@inproceedings{howard2019searching,
  title={Searching for mobilenetv3},
  author={Howard, Andrew and Sandler, Mark and Chu, Grace and Chen, Liang-Chieh and Chen, Bo and Tan, Mingxing and Wang, Weijun and Zhu, Yukun and Pang, Ruoming and Vasudevan, Vijay and others},
  booktitle={Proceedings of the IEEE/CVF international conference on computer vision},
  pages={1314--1324},
  year={2019}
}

标签

dataset:imagenet-1k arxiv:2110.00476 arxiv:1905.02244 license:apache-2.0 region:us

操作


详细信息

厂商
timm
任务
image-classification
框架
timm
许可(HF)
apache-2.0