# SENet （旧版）

**类别：** CNN · **代码：** [`timm/models/senet.py`](https://github.com/huggingface/pytorch-image-models/blob/main/timm/models/senet.py) · **架构：** 9 · **预训练权重：** 9（9 个具有 ImageNet-1k 结果）

Cadene 预训练模型（`legacy_*`）中的 SENet、SE-ResNet 和 SE-ResNeXt。该模块已弃用，建议改用 `ResNet` 类的 SE 变体。

## 论文

* [挤压-激励网络](https://arxiv.org/abs/1709.01507)

## 用法

请参阅[快速入门](../quickstart)了解如何加载预训练权重、进行图像预处理和微调，以及参阅[特征提取](../feature_extraction)了解如何将这些模型用作骨干网络。

```py
>>> import timm
>>> model = timm.create_model('legacy_seresnext50_32x4d.in1k', pretrained=True)
>>> data_config = timm.data.resolve_model_data_config(model)
```

## 模型 API 支持

| 功能 | `SENet` |
|---|---|
| [`features_only=True` 特征图](../model_api#intermediate-features) | ✓（步长 2、4、8、16、32） |
| [`forward_intermediates()`](../model_api#intermediate-features) | ✓ |
| [`prune_intermediate_layers()`](../model_api#intermediate-features) | ✓ |
| [任意输入尺寸，无需更改](../model_api#input-size) | ✓ |
| [`set_input_size()`](../model_api#input-size) | – |
| [`dynamic_img_size=True`](../model_api#input-size) | – |
| [`set_grad_checkpointing()`](../model_api#training-hooks) | ✗ |
| [逐层学习率衰减（`group_matcher()`）](../model_api#training-hooks) | ✓ |
| [`reset_classifier()`](../model_api#classifier) | ✓ |

✓ 支持，✓ (square) 仅支持方形尺寸，✗ 不支持，– 无需支持（模型本身已接受任意输入尺寸）。通过在每个功能上运行随机初始化的模型（`SENet` 使用 `legacy_seresnet18`，尺寸为 224）进行验证，预期同一类的其他架构表现相同。详情请参阅 [模型 API](../model_api) 页面。

## 架构

| 架构 | 参数（M） | GMAC | 输入大小 | 预训练权重 |
|---|---:|---:|---:|---:|
| `legacy_senet154` | 115.09 | 20.77 | 224 | 1 |
| `legacy_seresnet18` | 11.78 | 1.82 | 224 | 1 |
| `legacy_seresnet34` | 21.96 | 3.67 | 224 | 1 |
| `legacy_seresnet50` | 28.09 | 3.88 | 224 | 1 |
| `legacy_seresnet101` | 49.33 | 7.61 | 224 | 1 |
| `legacy_seresnet152` | 66.82 | 11.33 | 224 | 1 |
| `legacy_seresnext26_32x4d` | 16.79 | 2.49 | 224 | 1 |
| `legacy_seresnext50_32x4d` | 27.56 | 4.26 | 224 | 1 |
| `legacy_seresnext101_32x4d` | 48.96 | 8.02 | 224 | 1 |

GMACs 和参数量对应于每种架构的默认输入大小和分类器，数据来自[基准测试结果](https://github.com/huggingface/pytorch-image-models/tree/main/results)。

## 预训练权重

Top-1 是在所列评估规模下，来自 [`results-imagenet.csv`](https://github.com/huggingface/pytorch-image-models/blob/main/results/results-imagenet.csv) 的 ImageNet-1k 验证准确率，- 表示该权重没有 ImageNet-1k 结果（例如预训练权重或图文权重）。Classes 是预训练分类器的大小，对于没有分类器的权重则为无。

| 权重 | 输入大小 | Top-1（%） | 评估大小 | 类 | 许可证 | Hub |
|---|---:|---:|---:|---:|---|---|
| `legacy_senet154.in1k` | 224 | 81.320 | 224 | 1000 | apache-2.0 | [原始](https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/legacy_senet154-e9eb9fe6.pth) |
| `legacy_seresnet18.in1k` | 224 | 71.742 | 224 | 1000 | apache-2.0 | [原始](https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/seresnet18-4bb0ce65.pth) |
| `legacy_seresnet34.in1k` | 224 | 74.788 | 224 | 1000 | apache-2.0 | [原始](https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/seresnet34-a4004e63.pth) |
| `legacy_seresnet50.in1k` | 224 | 77.650 | 224 | 1000 | apache-2.0 | [原始](https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-cadene/se_resnet50-ce0d4300.pth) |
| `legacy_seresnet101.in1k` | 224 | 78.370 | 224 | 1000 | apache-2.0 | [原始](https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-cadene/se_resnet101-7e38fcc6.pth) |
| `legacy_seresnet152.in1k` | 224 | 78.662 | 224 | 1000 | apache-2.0 | [原始](https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-cadene/se_resnet152-d17c99b7.pth) |
| `legacy_seresnext26_32x4d.in1k` | 224 | 77.100 | 224 | 1000 | apache-2.0 | [原始](https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/seresnext26_32x4d-65ebdb501.pth) |
| `legacy_seresnext50_32x4d.in1k` | 224 | 79.080 | 224 | 1000 | apache-2.0 | [原始](https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/legacy_se_resnext50_32x4d-f3651bad.pth) |
| `legacy_seresnext101_32x4d.in1k` | 224 | 80.274 | 224 | 1000 | apache-2.0 | [原始](https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/legacy_se_resnext101_32x4d-37725eac.pth) |

