# ReXNet

**Category:** Efficient/Mobile · **Code:**
[`timm/models/rexnet.py`](https://github.com/huggingface/pytorch-image-models/blob/main/timm/models/rexnet.py) ·
**Architectures:** 10 · **Pretrained weights:** 9 (7 with ImageNet-1k results)

ReXNet revises the channel configuration of inverted residual networks to reduce representational bottlenecks. The
`rexnetr_*` variants round the channels to multiples of 8.

## Papers

* [Rethinking Channel Dimensions for Efficient Model Design](https://arxiv.org/abs/2007.00992)

## Usage

See the [Quickstart](../quickstart) for loading pretrained weights, image preprocessing and fine-tuning, and [Feature
Extraction](../feature_extraction) for using the models as backbones.

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

## Model API support

| Feature | `RexNet` |
|---|---|
| [`features_only=True` feature maps](../model_api#intermediate-features) | ✓ (strides 2, 4, 8, 16, 32) |
| [`forward_intermediates()`](../model_api#intermediate-features) | ✓ |
| [`prune_intermediate_layers()`](../model_api#intermediate-features) | ✓ |
| [Any input size, no changes needed](../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) | ✓ |
| [Layer-wise LR decay (`group_matcher()`)](../model_api#training-hooks) | ✓ |
| [`reset_classifier()`](../model_api#classifier) | ✓ |

✓ supported, ✓ (square) works for square sizes only, ✗ not supported, – not needed (the model already accepts any input
size). Checked by running each feature on a randomly initialized model (`RexNet` with `rexnet_100` at 224), other
architectures of the same class are expected to behave the same. See the [Model API](../model_api) page for details.

## Architectures

| Architecture | Params (M) | GMACs | Input size | Pretrained weights |
|---|---:|---:|---:|---:|
| `rexnet_100` | 4.80 | 0.41 | 224 | 1 |
| `rexnet_130` | 7.56 | 0.68 | 224 | 1 |
| `rexnet_150` | 9.73 | 0.90 | 224 | 1 |
| `rexnet_200` | 16.37 | 1.56 | 224 | 1 |
| `rexnet_300` | 34.71 | 3.44 | 224 | 1 |
| `rexnetr_100` | 4.88 | 0.43 | 224 | 0 |
| `rexnetr_130` | 7.61 | 0.68 | 224 | 0 |
| `rexnetr_150` | 9.78 | 0.89 | 224 | 0 |
| `rexnetr_200` | 16.52 | 1.59 | 224 | 2 |
| `rexnetr_300` | 34.81 | 3.39 | 224 | 2 |

GMACs and parameter counts are for the default input size and classifier of each architecture, from the [benchmark
results](https://github.com/huggingface/pytorch-image-models/tree/main/results).

## Pretrained weights

Top-1 is ImageNet-1k validation accuracy from
[`results-imagenet.csv`](https://github.com/huggingface/pytorch-image-models/blob/main/results/results-imagenet.csv) at
the listed eval size, - if the weight has no ImageNet-1k result (e.g. pretraining or image-text weights). Classes is the
size of the pretrained classifier, none for weights without one.

Weights are grouped by source: the paper or origin given in the pretrained config, else a Hub organization other than
`timm`, else the first part of the pretrained tag (`architecture.tag`). Sources with a single weight are listed under
other.

### `nav` tags

| Weight | Input size | Top-1 (%) | Eval size | Classes | License | Hub |
|---|---:|---:|---:|---:|---|---|
| `rexnet_100.nav_in1k` | 224 | 77.862 | 224 | 1000 | mit | [timm](https://huggingface.co/timm/rexnet_100.nav_in1k) |
| `rexnet_130.nav_in1k` | 224 | 79.492 | 224 | 1000 | mit | [timm](https://huggingface.co/timm/rexnet_130.nav_in1k) |
| `rexnet_150.nav_in1k` | 224 | 80.322 | 224 | 1000 | mit | [timm](https://huggingface.co/timm/rexnet_150.nav_in1k) |
| `rexnet_200.nav_in1k` | 224 | 81.636 | 224 | 1000 | mit | [timm](https://huggingface.co/timm/rexnet_200.nav_in1k) |
| `rexnet_300.nav_in1k` | 224 | 82.780 | 224 | 1000 | mit | [timm](https://huggingface.co/timm/rexnet_300.nav_in1k) |

### `sw` tags

| Weight | Input size | Top-1 (%) | Eval size | Classes | License | Hub |
|---|---:|---:|---:|---:|---|---|
| `rexnetr_200.sw_in12k` | 224 (test 288) | - | - | 11821 | apache-2.0 | [timm](https://huggingface.co/timm/rexnetr_200.sw_in12k) |
| `rexnetr_200.sw_in12k_ft_in1k` | 224 (test 288) | 83.160 | 288 | 1000 | apache-2.0 | [timm](https://huggingface.co/timm/rexnetr_200.sw_in12k_ft_in1k) |
| `rexnetr_300.sw_in12k` | 224 (test 288) | - | - | 11821 | apache-2.0 | [timm](https://huggingface.co/timm/rexnetr_300.sw_in12k) |
| `rexnetr_300.sw_in12k_ft_in1k` | 224 (test 288) | 84.582 | 288 | 1000 | apache-2.0 | [timm](https://huggingface.co/timm/rexnetr_300.sw_in12k_ft_in1k) |

