Commit dff2c686 authored by renzhc's avatar renzhc
Browse files

first commit

parent 8f9dd0ed
Pipeline #1665 canceled with stages
_base_ = ['./regnetx-400mf_8xb128_in1k.py']
# model settings
model = dict(
backbone=dict(type='RegNet', arch='regnetx_3.2gf'),
head=dict(in_channels=1008, ))
# dataset settings
train_dataloader = dict(batch_size=64)
# schedule settings
# for batch_size 512, use lr = 0.4
optim_wrapper = dict(optimizer=dict(lr=0.4))
# NOTE: `auto_scale_lr` is for automatically scaling LR
# based on the actual training batch size.
# base_batch_size = (8 GPUs) x (64 samples per GPU)
auto_scale_lr = dict(base_batch_size=512)
_base_ = ['./regnetx-400mf_8xb128_in1k.py']
# model settings
model = dict(
backbone=dict(type='RegNet', arch='regnetx_4.0gf'),
head=dict(in_channels=1360, ))
# dataset settings
train_dataloader = dict(batch_size=64)
# schedule settings
# for batch_size 512, use lr = 0.4
optim_wrapper = dict(optimizer=dict(lr=0.4))
# NOTE: `auto_scale_lr` is for automatically scaling LR
# based on the actual training batch size.
# base_batch_size = (8 GPUs) x (64 samples per GPU)
auto_scale_lr = dict(base_batch_size=512)
_base_ = [
'../_base_/models/regnet/regnetx_400mf.py',
'../_base_/datasets/imagenet_bs32.py',
'../_base_/schedules/imagenet_bs1024_coslr.py',
'../_base_/default_runtime.py'
]
# dataset settings
data_preprocessor = dict(
# BGR format normalization parameters
mean=[103.53, 116.28, 123.675],
std=[57.375, 57.12, 58.395],
to_rgb=False, # The checkpoints from PyCls requires BGR format inputs.
)
# lighting params, in order of BGR, from repo. pycls
EIGVAL = [0.2175, 0.0188, 0.0045]
EIGVEC = [
[-0.5836, -0.6948, 0.4203],
[-0.5808, -0.0045, -0.814],
[-0.5675, 0.7192, 0.4009],
]
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='RandomResizedCrop', scale=224),
dict(type='RandomFlip', prob=0.5, direction='horizontal'),
dict(
type='Lighting',
eigval=EIGVAL,
eigvec=EIGVEC,
alphastd=25.5, # because the value range of images is [0,255]
to_rgb=False),
dict(type='PackInputs'),
]
train_dataloader = dict(batch_size=128, dataset=dict(pipeline=train_pipeline))
val_dataloader = dict(batch_size=128)
test_dataloader = dict(batch_size=128)
# schedule settings
# sgd with nesterov, base ls is 0.8 for batch_size 1024,
optim_wrapper = dict(optimizer=dict(lr=0.8, nesterov=True))
# runtime settings
# Precise BN hook will update the bn stats, so this hook should be executed
# before CheckpointHook(priority of 'VERY_LOW') and
# EMAHook(priority of 'NORMAL') So set the priority of PreciseBNHook to
# 'ABOVENORMAL' here.
custom_hooks = [
dict(
type='PreciseBNHook',
num_samples=8192,
interval=1,
priority='ABOVE_NORMAL')
]
_base_ = ['./regnetx-400mf_8xb128_in1k.py']
# model settings
model = dict(
backbone=dict(type='RegNet', arch='regnetx_6.4gf'),
head=dict(in_channels=1624, ))
# dataset settings
train_dataloader = dict(batch_size=64)
# schedule settings
# for batch_size 512, use lr = 0.4
optim_wrapper = dict(optimizer=dict(lr=0.4))
# NOTE: `auto_scale_lr` is for automatically scaling LR
# based on the actual training batch size.
# base_batch_size = (8 GPUs) x (64 samples per GPU)
auto_scale_lr = dict(base_batch_size=512)
_base_ = ['./regnetx-400mf_8xb128_in1k.py']
# model settings
model = dict(
backbone=dict(type='RegNet', arch='regnetx_8.0gf'),
head=dict(in_channels=1920, ))
# dataset settings
train_dataloader = dict(batch_size=64)
# schedule settings
# for batch_size 512, use lr = 0.4
optim_wrapper = dict(optimizer=dict(lr=0.4))
# NOTE: `auto_scale_lr` is for automatically scaling LR
# based on the actual training batch size.
# base_batch_size = (8 GPUs) x (64 samples per GPU)
auto_scale_lr = dict(base_batch_size=512)
_base_ = ['./regnetx-400mf_8xb128_in1k.py']
# model settings
model = dict(
backbone=dict(type='RegNet', arch='regnetx_800mf'),
head=dict(in_channels=672, ))
# RepLKNet
> [Scaling Up Your Kernels to 31x31: Revisiting Large Kernel Design in CNNs](https://arxiv.org/abs/2203.06717)
<!-- [ALGORITHM] -->
## Abstract
We revisit large kernel design in modern convolutional neural networks (CNNs). Inspired by recent advances in vision transformers (ViTs), in this paper, we demonstrate that using a few large convolutional kernels instead of a stack of small kernels could be a more powerful paradigm. We suggested five guidelines, e.g., applying re-parameterized large depth-wise convolutions, to design efficient highperformance large-kernel CNNs. Following the guidelines, we propose RepLKNet, a pure CNN architecture whose kernel size is as large as 31×31, in contrast to commonly used 3×3. RepLKNet greatly closes the performance gap between CNNs and ViTs, e.g., achieving comparable or superior results than Swin Transformer on ImageNet and a few typical downstream tasks, with lower latency. RepLKNet also shows nice scalability to big data and large models, obtaining 87.8% top-1 accuracy on ImageNet and 56.0% mIoU on ADE20K, which is very competitive among the state-of-the-arts with similar model sizes. Our study further reveals that, in contrast to small-kernel CNNs, large kernel CNNs have much larger effective receptive fields and higher shape bias rather than texture bias.
<div align=center>
<img src="https://user-images.githubusercontent.com/48375204/197546040-cdf078c3-7fbd-400f-8b27-01668c8dfebf.png" width="60%"/>
</div>
## How to use it?
<!-- [TABS-BEGIN] -->
**Predict image**
```python
from mmpretrain import inference_model, get_model
model = get_model('replknet-31B_3rdparty_in1k', pretrained=True)
model.backbone.switch_to_deploy()
predict = inference_model(model, 'demo/bird.JPEG')
print(predict['pred_class'])
print(predict['pred_score'])
```
**Use the model**
```python
import torch
from mmpretrain import get_model
model = get_model('replknet-31B_3rdparty_in1k', pretrained=True)
inputs = torch.rand(1, 3, 224, 224)
out = model(inputs)
print(type(out))
# To extract features.
feats = model.extract_feat(inputs)
print(type(feats))
```
**Test Command**
Prepare your dataset according to the [docs](https://mmpretrain.readthedocs.io/en/latest/user_guides/dataset_prepare.html#prepare-dataset).
Test:
```shell
python tools/test.py configs/replknet/replknet-31B_32xb64_in1k.py https://download.openmmlab.com/mmclassification/v0/replknet/replknet-31B_3rdparty_in1k_20221118-fd08e268.pth
```
**Reparameterization**
The checkpoints provided are all `training-time` models. Use the reparameterize tool to switch them to more efficient `inference-time` architecture, which not only has fewer parameters but also less calculations.
```bash
python tools/convert_models/reparameterize_model.py ${CFG_PATH} ${SRC_CKPT_PATH} ${TARGET_CKPT_PATH}
```
`${CFG_PATH}` is the config file, `${SRC_CKPT_PATH}` is the source chenpoint file, `${TARGET_CKPT_PATH}` is the target deploy weight file path.
To use reparameterized weights, the config file must switch to the deploy config files.
```bash
python tools/test.py ${deploy_cfg} ${deploy_checkpoint} --metrics accuracy
```
You can also use `backbone.switch_to_deploy()` to switch to the deploy mode in Python code. For example:
```python
from mmpretrain.models import RepLKNet
backbone = RepLKNet(arch='31B')
backbone.switch_to_deploy()
```
<!-- [TABS-END] -->
## Models and results
### Image Classification on ImageNet-1k
| Model | Pretrain | Params (M) | Flops (G) | Top-1 (%) | Top-5 (%) | Config | Download |
| :--------------------------------------------- | :----------: | :--------: | :-------: | :-------: | :-------: | :-----------------------------------------: | :------------------------------------------------------------: |
| `replknet-31B_3rdparty_in1k`\* | From scratch | 79.86 | 15.64 | 83.48 | 96.57 | [config](replknet-31B_32xb64_in1k.py) | [model](https://download.openmmlab.com/mmclassification/v0/replknet/replknet-31B_3rdparty_in1k_20221118-fd08e268.pth) |
| `replknet-31B_3rdparty_in1k-384px`\* | From scratch | 79.86 | 45.95 | 84.84 | 97.34 | [config](replknet-31B_32xb64_in1k-384px.py) | [model](https://download.openmmlab.com/mmclassification/v0/replknet/replknet-31B_3rdparty_in1k-384px_20221118-03a170ce.pth) |
| `replknet-31B_in21k-pre_3rdparty_in1k`\* | ImageNet-21k | 79.86 | 15.64 | 85.20 | 97.56 | [config](replknet-31B_32xb64_in1k.py) | [model](https://download.openmmlab.com/mmclassification/v0/replknet/replknet-31B_in21k-pre_3rdparty_in1k_20221118-54ed5c46.pth) |
| `replknet-31B_in21k-pre_3rdparty_in1k-384px`\* | ImageNet-21k | 79.86 | 45.95 | 85.99 | 97.75 | [config](replknet-31B_32xb64_in1k-384px.py) | [model](https://download.openmmlab.com/mmclassification/v0/replknet/replknet-31B_in21k-pre_3rdparty_in1k-384px_20221118-76c92b24.pth) |
| `replknet-31L_in21k-pre_3rdparty_in1k-384px`\* | ImageNet-21k | 172.67 | 97.24 | 86.63 | 98.00 | [config](replknet-31L_32xb64_in1k-384px.py) | [model](https://download.openmmlab.com/mmclassification/v0/replknet/replknet-31L_in21k-pre_3rdparty_in1k-384px_20221118-dc3fc07c.pth) |
| `replknet-XL_meg73m-pre_3rdparty_in1k-320px`\* | MEG73M | 335.44 | 129.57 | 87.57 | 98.39 | [config](replknet-XL_32xb64_in1k-320px.py) | [model](https://download.openmmlab.com/mmclassification/v0/replknet/replknet-XL_meg73m-pre_3rdparty_in1k-320px_20221118-88259b1d.pth) |
*Models with * are converted from the [official repo](https://github.com/DingXiaoH/RepLKNet-pytorch/blob/main/replknet.py). The config files of these models are only for inference. We haven't reproduce the training results.*
## Citation
```bibtex
@inproceedings{ding2022scaling,
title={Scaling up your kernels to 31x31: Revisiting large kernel design in cnns},
author={Ding, Xiaohan and Zhang, Xiangyu and Han, Jungong and Ding, Guiguang},
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
pages={11963--11975},
year={2022}
}
```
_base_ = '../replknet-31B_32xb64_in1k-384px.py'
model = dict(backbone=dict(small_kernel_merged=True))
_base_ = '../replknet-31B_32xb64_in1k.py'
model = dict(backbone=dict(small_kernel_merged=True))
_base_ = '../replknet-31L_32xb64_in1k-384px.py'
model = dict(backbone=dict(small_kernel_merged=True))
_base_ = '../replknet-XL_32xb64_in1k-320px.py'
model = dict(backbone=dict(small_kernel_merged=True))
Collections:
- Name: RepLKNet
Metadata:
Training Data: ImageNet-1k
Architecture:
- Large-Kernel Convolution
- VGG-style Neural Network
Paper:
URL: https://arxiv.org/abs/2203.06717
Title: 'Scaling Up Your Kernels to 31x31: Revisiting Large Kernel Design in CNNs'
README: configs/replknet/README.md
Code:
URL: https://github.com/open-mmlab/mmpretrain/blob/v1.0.0rc3/mmcls/models/backbones/replknet.py
Version: v1.0.0rc3
Models:
- Name: replknet-31B_3rdparty_in1k
In Collection: RepLKNet
Config: configs/replknet/replknet-31B_32xb64_in1k.py
Metadata:
FLOPs: 15636547584
Parameters: 79864168
Results:
- Dataset: ImageNet-1k
Task: Image Classification
Metrics:
Top 1 Accuracy: 83.48
Top 5 Accuracy: 96.57
Weights: https://download.openmmlab.com/mmclassification/v0/replknet/replknet-31B_3rdparty_in1k_20221118-fd08e268.pth
Converted From:
Weights: https://drive.google.com/u/0/uc?id=1azQUiCxK9feYVkkrPqwVPBtNsTzDrX7S&export=download
Code: https://github.com/DingXiaoH/RepLKNet-pytorch/blob/main/replknet.py
- Name: replknet-31B_3rdparty_in1k-384px
In Collection: RepLKNet
Config: configs/replknet/replknet-31B_32xb64_in1k-384px.py
Metadata:
FLOPs: 45952303104
Parameters: 79864168
Results:
- Dataset: ImageNet-1k
Task: Image Classification
Metrics:
Top 1 Accuracy: 84.84
Top 5 Accuracy: 97.34
Weights: https://download.openmmlab.com/mmclassification/v0/replknet/replknet-31B_3rdparty_in1k-384px_20221118-03a170ce.pth
Converted From:
Weights: https://drive.google.com/u/0/uc?id=1vo-P3XB6mRLUeDzmgv90dOu73uCeLfZN&export=download
Code: https://github.com/DingXiaoH/RepLKNet-pytorch/blob/main/replknet.py
- Name: replknet-31B_in21k-pre_3rdparty_in1k
In Collection: RepLKNet
Config: configs/replknet/replknet-31B_32xb64_in1k.py
Metadata:
Training Data:
- ImageNet-21k
- ImageNet-1k
FLOPs: 15636547584
Parameters: 79864168
Results:
- Dataset: ImageNet-1k
Task: Image Classification
Metrics:
Top 1 Accuracy: 85.20
Top 5 Accuracy: 97.56
Weights: https://download.openmmlab.com/mmclassification/v0/replknet/replknet-31B_in21k-pre_3rdparty_in1k_20221118-54ed5c46.pth
Converted From:
Weights: https://drive.google.com/u/0/uc?id=1DslZ2voXZQR1QoFY9KnbsHAeF84hzS0s&export=download
Code: https://github.com/DingXiaoH/RepLKNet-pytorch/blob/main/replknet.py
- Name: replknet-31B_in21k-pre_3rdparty_in1k-384px
In Collection: RepLKNet
Config: configs/replknet/replknet-31B_32xb64_in1k-384px.py
Metadata:
Training Data:
- ImageNet-21k
- ImageNet-1k
FLOPs: 45952303104
Parameters: 79864168
Results:
- Dataset: ImageNet-1k
Task: Image Classification
Metrics:
Top 1 Accuracy: 85.99
Top 5 Accuracy: 97.75
Weights: https://download.openmmlab.com/mmclassification/v0/replknet/replknet-31B_in21k-pre_3rdparty_in1k-384px_20221118-76c92b24.pth
Converted From:
Weights: https://drive.google.com/u/0/uc?id=1Sc46BWdXXm2fVP-K_hKKU_W8vAB-0duX&export=download
Code: https://github.com/DingXiaoH/RepLKNet-pytorch/blob/main/replknet.py
- Name: replknet-31L_in21k-pre_3rdparty_in1k-384px
In Collection: RepLKNet
Config: configs/replknet/replknet-31L_32xb64_in1k-384px.py
Metadata:
Training Data:
- ImageNet-21k
- ImageNet-1k
FLOPs: 97240006656
Parameters: 172671016
Results:
- Dataset: ImageNet-1k
Task: Image Classification
Metrics:
Top 1 Accuracy: 86.63
Top 5 Accuracy: 98.00
Weights: https://download.openmmlab.com/mmclassification/v0/replknet/replknet-31L_in21k-pre_3rdparty_in1k-384px_20221118-dc3fc07c.pth
Converted From:
Weights: https://drive.google.com/u/0/uc?id=1JYXoNHuRvC33QV1pmpzMTKEni1hpWfBl&export=download
Code: https://github.com/DingXiaoH/RepLKNet-pytorch/blob/main/replknet.py
- Name: replknet-XL_meg73m-pre_3rdparty_in1k-320px
In Collection: RepLKNet
Config: configs/replknet/replknet-XL_32xb64_in1k-320px.py
Metadata:
Training Data:
- MegData-73M
- ImageNet-1k
FLOPs: 129570201600
Parameters: 335435752
Results:
- Dataset: ImageNet-1k
Task: Image Classification
Metrics:
Top 1 Accuracy: 87.57
Top 5 Accuracy: 98.39
Weights: https://download.openmmlab.com/mmclassification/v0/replknet/replknet-XL_meg73m-pre_3rdparty_in1k-320px_20221118-88259b1d.pth
Converted From:
Weights: https://drive.google.com/u/0/uc?id=1tPC60El34GntXByIRHb-z-Apm4Y5LX1T&export=download
Code: https://github.com/DingXiaoH/RepLKNet-pytorch/blob/main/replknet.py
_base_ = [
'../_base_/models/replknet-31B_in1k.py',
'../_base_/datasets/imagenet_bs16_pil_bicubic_384.py',
'../_base_/schedules/imagenet_bs256_coslr.py',
'../_base_/default_runtime.py'
]
# schedule settings
param_scheduler = dict(
type='CosineAnnealingLR', T_max=300, by_epoch=True, begin=0, end=300)
train_cfg = dict(by_epoch=True, max_epochs=300)
_base_ = [
'../_base_/models/replknet-31B_in1k.py',
'../_base_/datasets/imagenet_bs32_pil_bicubic.py',
'../_base_/schedules/imagenet_bs256_coslr.py',
'../_base_/default_runtime.py'
]
# schedule settings
param_scheduler = dict(
type='CosineAnnealingLR', T_max=300, by_epoch=True, begin=0, end=300)
train_cfg = dict(by_epoch=True, max_epochs=300)
_base_ = [
'../_base_/models/replknet-31L_in1k.py',
'../_base_/datasets/imagenet_bs16_pil_bicubic_384.py',
'../_base_/schedules/imagenet_bs256_coslr.py',
'../_base_/default_runtime.py'
]
# schedule settings
param_scheduler = dict(
type='CosineAnnealingLR', T_max=300, by_epoch=True, begin=0, end=300)
train_cfg = dict(by_epoch=True, max_epochs=300)
_base_ = [
'../_base_/models/replknet-XL_in1k.py',
'../_base_/datasets/imagenet_bs8_pil_bicubic_320.py',
'../_base_/schedules/imagenet_bs256_coslr.py',
'../_base_/default_runtime.py'
]
# schedule settings
param_scheduler = dict(
type='CosineAnnealingLR', T_max=300, by_epoch=True, begin=0, end=300)
train_cfg = dict(by_epoch=True, max_epochs=300)
# RepMLP
> [RepMLP: Re-parameterizing Convolutions into Fully-connected Layers for Image Recognition](https://arxiv.org/abs/2105.01883)
<!-- [ALGORITHM] -->
## Abstract
We propose RepMLP, a multi-layer-perceptron-style neural network building block for image recognition, which is composed of a series of fully-connected (FC) layers. Compared to convolutional layers, FC layers are more efficient, better at modeling the long-range dependencies and positional patterns, but worse at capturing the local structures, hence usually less favored for image recognition. We propose a structural re-parameterization technique that adds local prior into an FC to make it powerful for image recognition. Specifically, we construct convolutional layers inside a RepMLP during training and merge them into the FC for inference. On CIFAR, a simple pure-MLP model shows performance very close to CNN. By inserting RepMLP in traditional CNN, we improve ResNets by 1.8% accuracy on ImageNet, 2.9% for face recognition, and 2.3% mIoU on Cityscapes with lower FLOPs. Our intriguing findings highlight that combining the global representational capacity and positional perception of FC with the local prior of convolution can improve the performance of neural network with faster speed on both the tasks with translation invariance (e.g., semantic segmentation) and those with aligned images and positional patterns (e.g., face recognition).
<div align=center>
<img src="https://user-images.githubusercontent.com/18586273/155455288-a17a5c48-11af-4b74-995a-cf7183f0e2d2.png" width="80%"/>
</div>
## How to use it?
<!-- [TABS-BEGIN] -->
**Predict image**
```python
from mmpretrain import inference_model, get_model
model = get_model('repmlp-base_3rdparty_8xb64_in1k', pretrained=True)
model.backbone.switch_to_deploy()
predict = inference_model(model, 'demo/bird.JPEG')
print(predict['pred_class'])
print(predict['pred_score'])
```
**Use the model**
```python
import torch
from mmpretrain import get_model
model = get_model('repmlp-base_3rdparty_8xb64_in1k', pretrained=True)
inputs = torch.rand(1, 3, 224, 224)
out = model(inputs)
print(type(out))
# To extract features.
feats = model.extract_feat(inputs)
print(type(feats))
```
**Test Command**
Prepare your dataset according to the [docs](https://mmpretrain.readthedocs.io/en/latest/user_guides/dataset_prepare.html#prepare-dataset).
Test:
```shell
python tools/test.py configs/repmlp/repmlp-base_8xb64_in1k.py https://download.openmmlab.com/mmclassification/v0/repmlp/repmlp-base_3rdparty_8xb64_in1k_20220330-1cb1f11b.pth
```
**Reparameterization**
The checkpoints provided are all `training-time` models. Use the reparameterize tool to switch them to more efficient `inference-time` architecture, which not only has fewer parameters but also less calculations.
```bash
python tools/convert_models/reparameterize_model.py ${CFG_PATH} ${SRC_CKPT_PATH} ${TARGET_CKPT_PATH}
```
`${CFG_PATH}` is the config file, `${SRC_CKPT_PATH}` is the source chenpoint file, `${TARGET_CKPT_PATH}` is the target deploy weight file path.
To use reparameterized weights, the config file must switch to the deploy config files.
```bash
python tools/test.py ${deploy_cfg} ${deploy_checkpoint} --metrics accuracy
```
You can also use `backbone.switch_to_deploy()` to switch to the deploy mode in Python code. For example:
```python
from mmpretrain.models import RepMLPNet
backbone = RepMLPNet(arch='B', img_size=224, reparam_conv_kernels=(1, 3))
backbone.switch_to_deploy()
```
<!-- [TABS-END] -->
## Models and results
### Image Classification on ImageNet-1k
| Model | Pretrain | Params (M) | Flops (G) | Top-1 (%) | Top-5 (%) | Config | Download |
| :---------------------------------------- | :----------: | :--------: | :-------: | :-------: | :-------: | :---------------------------------------: | :-------------------------------------------------------------------: |
| `repmlp-base_3rdparty_8xb64_in1k`\* | From scratch | 68.24 | 6.71 | 80.41 | 95.14 | [config](repmlp-base_8xb64_in1k.py) | [model](https://download.openmmlab.com/mmclassification/v0/repmlp/repmlp-base_3rdparty_8xb64_in1k_20220330-1cb1f11b.pth) |
| `repmlp-base_3rdparty_8xb64_in1k-256px`\* | From scratch | 96.45 | 9.69 | 81.11 | 95.50 | [config](repmlp-base_8xb64_in1k-256px.py) | [model](https://download.openmmlab.com/mmclassification/v0/repmlp/repmlp-base_3rdparty_8xb64_in1k-256px_20220330-7c5a91ce.pth) |
*Models with * are converted from the [official repo](https://github.com/DingXiaoH/RepMLP/blob/072d8516beba83d75dfe6ebb12f625abad4b53d5/repmlpnet.py#L278). The config files of these models are only for inference. We haven't reproduce the training results.*
## Citation
```bibtex
@article{ding2021repmlp,
title={Repmlp: Re-parameterizing convolutions into fully-connected layers for image recognition},
author={Ding, Xiaohan and Xia, Chunlong and Zhang, Xiangyu and Chu, Xiaojie and Han, Jungong and Ding, Guiguang},
journal={arXiv preprint arXiv:2105.01883},
year={2021}
}
```
Collections:
- Name: RepMLP
Metadata:
Training Data: ImageNet-1k
Architecture:
- Multi-layer Perceptron
- Re-parameterization Convolution
Paper:
URL: https://arxiv.org/abs/2105.01883
Title: 'RepMLP: Re-parameterizing Convolutions into Fully-connected Layers for Image Recognition'
README: configs/repmlp/README.md
Code:
URL: https://github.com/open-mmlab/mmpretrain/blob/v0.21.0/mmcls/models/backbones/repmlp.py
Version: v0.21.0
Models:
- Name: repmlp-base_3rdparty_8xb64_in1k
In Collection: RepMLP
Config: configs/repmlp/repmlp-base_8xb64_in1k.py
Metadata:
FLOPs: 6710000000 # 6.71 G
Parameters: 68240000 # 68.24 M
Results:
- Dataset: ImageNet-1k
Metrics:
Top 1 Accuracy: 80.41
Top 5 Accuracy: 95.14
Task: Image Classification
Weights: https://download.openmmlab.com/mmclassification/v0/repmlp/repmlp-base_3rdparty_8xb64_in1k_20220330-1cb1f11b.pth
Converted From:
Weights: https://github.com/DingXiaoH/RepMLP
Code: https://github.com/DingXiaoH/RepMLP/blob/072d8516beba83d75dfe6ebb12f625abad4b53d5/repmlpnet.py#L274
- Name: repmlp-base_3rdparty_8xb64_in1k-256px
In Collection: RepMLP
Config: configs/repmlp/repmlp-base_8xb64_in1k-256px.py
Metadata:
FLOPs: 9690000000 # 9.69 G
Parameters: 96450000 # 96.45M
Results:
- Dataset: ImageNet-1k
Metrics:
Top 1 Accuracy: 81.11
Top 5 Accuracy: 95.50
Task: Image Classification
Weights: https://download.openmmlab.com/mmclassification/v0/repmlp/repmlp-base_3rdparty_8xb64_in1k-256px_20220330-7c5a91ce.pth
Converted From:
Weights: https://github.com/DingXiaoH/RepMLP
Code: https://github.com/DingXiaoH/RepMLP/blob/072d8516beba83d75dfe6ebb12f625abad4b53d5/repmlpnet.py#L278
_base_ = [
'../_base_/models/repmlp-base_224.py',
'../_base_/datasets/imagenet_bs64_pil_resize.py',
'../_base_/schedules/imagenet_bs4096_AdamW.py',
'../_base_/default_runtime.py'
]
# model settings
model = dict(backbone=dict(img_size=256))
# dataset settings
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='RandomResizedCrop', scale=256),
dict(type='RandomFlip', prob=0.5, direction='horizontal'),
dict(type='PackInputs'),
]
test_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='ResizeEdge', scale=292, edge='short', backend='pillow'),
dict(type='CenterCrop', crop_size=256),
dict(type='PackInputs'),
]
train_dataloader = dict(dataset=dict(pipeline=train_pipeline))
val_dataloader = dict(dataset=dict(pipeline=test_pipeline))
test_dataloader = dict(dataset=dict(pipeline=test_pipeline))
# schedule settings
optim_wrapper = dict(clip_grad=dict(max_norm=1.0))
# NOTE: `auto_scale_lr` is for automatically scaling LR
# based on the actual training batch size.
# base_batch_size = (8 GPUs) x (64 samples per GPU)
auto_scale_lr = dict(base_batch_size=512)
_base_ = [
'../_base_/models/repmlp-base_224.py',
'../_base_/datasets/imagenet_bs64_pil_resize.py',
'../_base_/schedules/imagenet_bs1024_adamw_swin.py',
'../_base_/default_runtime.py'
]
# dataset settings
test_pipeline = [
dict(type='LoadImageFromFile'),
# resizing to (256, 256) here, different from resizing shorter edge to 256
dict(type='Resize', scale=(256, 256), backend='pillow'),
dict(type='CenterCrop', crop_size=224),
dict(type='PackInputs'),
]
val_dataloader = dict(dataset=dict(pipeline=test_pipeline))
test_dataloader = dict(dataset=dict(pipeline=test_pipeline))
# schedule settings
optim_wrapper = dict(clip_grad=dict(max_norm=5.0))
# NOTE: `auto_scale_lr` is for automatically scaling LR
# based on the actual training batch size.
# base_batch_size = (8 GPUs) x (64 samples per GPU)
auto_scale_lr = dict(base_batch_size=512)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment