Skip to content

Commit

Permalink
Bump version to v0.7.0 (#229)
Browse files Browse the repository at this point in the history
* [Enhance] add pre-commit hook for algo-readme and copyright (#213)

* [Enhance] add test windows in workflows (#215)

* [Enhance] add test windows in workflows

* fix lint

* add optional requirements

* add try-except judgement

* add opencv installation in windows test steps

* fix path error on windows

* update

* update path

* update

* add pytest skip for algorithm test

* update requirements/runtime.txt

* update pytest skip

* [Docs] translate 0_config.md into Chinese (#216)

* [Docs] translate 0_config.md into Chinese

* [Fix] fix format description in 0_config.md

* Update: 0_config.md

* [Fix] fix tsne 'no `init_cfg`' error (#222)

* [Fix] fix tsne 'no init_cfg' and pool_type errors

* [Refactor] fix linting of tsne vis

* [Docs] reorganizing OpenMMLab projects and update algorithms in readme (#219)

* [Docs] reorganizing OpenMMLab projects and update algorithms in readme

* using small letters

* fix typo

* [Fix] fix image channel bgr/rgb bug and update benchmarks (#210)

* [Fix] fix image channel bgr/rgb bug

* update model zoo

* update readme and metafile

* [Fix] fix typo

* [Fix] fix typo

* [Fix] fix lint

* modify Places205 directory according to the downloaded dataset

* update results

* [Fix] Fix the bug when using prefetch under multi-view methods, e.g., DenseCL (#218)

* fig bug for prefetch_loader under multi-view setting

* fix lint problem

Co-authored-by: liming <liming.ai@bytedance.com>

* [Feature]: MAE official (#221)

* [Feature]: MAE single image pre-training

* [Fix]: Fix config

* [Fix]: Fix dataset link

* [Feature]: Add run

* [Refactor]: Delete spot

* [Feature]: ignore nohup output file

* [Feature]: Add auto script to generate run cmd

* [Refactor]: Refactor mae config file

* [Feature]: sz20 settings

* [Feature]: Add auto resume

* [Fix]: Fix lint

* [Feature]: Make git ignore txt

* [Refactor]: Delete gpus in script

* [Fix]: Make generate_cmd to add --async

* [Feature]: Initial version of Vit fine-tune

* [Fix]: Add 1424 specific settings

* [Fix]: Fix missing file client bug for 1424

* [Feature]: 1424 customized settings

* [Fix]: Make drop in eval to False

* [Feature]: Change the finetune and pre-training settings

* [Feature]: Add debug setting

* [Refactor]: Refactor the model

* [Feature]: Customized settings

* [Feature]: Add A100 settings

* [Fix]: Change mae to imagenet

* [Feature]: Change mae pretrain num workers to 32

* [Feature]: Change num workers to 16

* [Feature]: Add A100 setting for pre_release ft version

* [Feature]: Add img_norm_cfg

* [Fix]: Fix mae cls test missing logits bug

* [Fix]: Fix mae cls head bias initialize to zero

* [Feature]: Rename mae config name

* [Feature]: Add MAE README.md

* [Fix]: Fix lint

* [Feature]: Fix typo

* [Fix]: Fix typo

* [Feature]: Fix invalid link

* [Fix]: Fix finetune config file name

* [Feature]: Official pretrain v1

* [Feature]: Change log interval to 100

* [Feature]: pretrain 1600 epochs

* [Fix]: Change encoder num head to 12

* [Feature]: Mix precision

* [Feature]: Add default value to random masking

* [Feature]: Official MAE finetune

* [Feature]: Finetune img per gpu 32

* [Feature]: Add multi machine training for lincls

* [Fix]: Fix lincls master port master addr

* [Feature]: Change img per gpu to 128

* [Feature]: Add linear eval and Refactor

* [Fix]: Fix debug mode

* [Fix]: Delete MAE dataset in __init__.py

* [Feature]: normalize pixel for mae

* [Fix]: Fix lint

* [Feature]: LARS for linear eval

* [Feature]: Add lars for mae linear eval

* [Feature]: Change mae linear lars num workers to 32

* [Feature]: Change mae linear lars num workers to 8

* [Feature]: log every 25 iter for mae linear eval lars

* [Feature]: Add 1600 epoch and 800 epoch pretraining

* [Fix]: Change linear eval to 902

* [Fix]: Add random flip to linear eval

* [Fix]: delete fp16 in mae

* [Refactor]: Change backbone to mmcls

* [Fix]: Align finetune settings

* [Fix]: replace timm trunc_normal with mmcv trunc_normal

* [Fix]: Change finetune layer_decay to 0.65

* [Fix]: Delete pretrain last norm when global_pooling

* [Fix]: set requires_grad of norm1 to False

* [Fix]: delete norm1

* [Fix]: Fix docstring bug

* [Fix]: Fix lint

* [Fix]: Add external link

* [Fix]: Delete auto_resume and reformat config readme.

* [Fix]: Fix pytest bug

* [Fix]: Fix lint

* [Refactor]: Rename filename

* [Feature]: Add docstring

* [Fix]: Rename config file name

* [Fix]: Fix name inconsistency bug

* [Fix]: Change the default value of persistent_worker in builder to True

* [Fix]: Change the default value of CPUS_PER_TASK to 5

* [Fix]: Add a blank line to line136 in tools/train.py

* [Fix]: Fix MAE algorithm docstring format and add paper name and url

* [Feature]: Add MAE paper name and link, and store mae teaser on github

* [Refactor]: Delete mae.png

* [Fix]: Fix config file name”

* [Fix]: Fix name bug

* [Refactor]: Change default GPUS to 8

* [Fix]: Abandon change to drop_last

* [Fix]: Fix docstring in mae algorithm

* [Fix]: Fix lint

* [Fix]: Fix lint

* [Fix]: Fix mae finetune algo type bug

* [Feature]: Add unit test for algorithm

* [Feature]: Add unit test for remaining parts

* [Fix]: Fix lint

* [Fix]: Fix typo

* [Fix]: Delete some unnecessary modification in gitignore

* [Feature]: Change finetune setting in mae algo to mixup setting

* [Fix]: Change norm_pix_loss to norm_pix in pretrain head

* [Fix]: Delete modification in dist_train_linear.sh

* [Refactor]: Delete global pool in mae_cls_vit.py

* [Fix]: Change finetune param to mixup in test_mae_classification

* [Fix]: Change norm_pix_loss to norm_pix of mae_pretrain_head in unit test

* [Fix]: Change norm_pix_loss to norm_pix in unit test

* [Refactor]: Create init_weights for mae_finetune_head and mae_linprobe_head

* [Refactor]: Construct 2d sin-cosine position embedding using torch

* [Refactor]: Using classification and using mixup from mmcls

* [Fix]: Fix lint

* [Fix]: Add False to finetune mae linprobe‘
“

* [Fix]: Set drop_last to False

* [Fix]: Fix MAE finetune layerwise lr bug

* [Refactor]: Delete redundant MAE when registering MAE

* [Refactor]: Split initialize_weights in MAE to submodules

* [Fix]: Change the min_lr of mae pretrain to 0.0

* [Refactor]: Delete  unused _init_weights in mae_cls_vit

* [Refactor]: Change MAE cls vit to a more general name

* [Feature]: Add Epoch Fix cosine annealing lr updater

* [Fix]: Fix lint

* [Feature]: Add layer wise lr decay in optimizer constructor

* [Fix]: Fix lint

* [Fix]: Fix set layer wise lr decay bug

* [Fix]: Fix UT for MAE

* [Fix]: Fix lint

* [Fix]: update algorithm readme format for MAE

* [Fix]: Fix isort

* [Fix]: Add Returns inmae_pretrain_vit

* [Fix]: Change bgr to rgb

* [Fix]: Change norm pix to True

* [Fix]: Use cls_token to linear prob

* [Fix]: Delete mixup.py

* [Fix]: Fix MAE readme

* [Feature]: Delete linprobe

* [Refactor]: Merge MAE head into one file

* [Fix]: Fix lint

* [Fix]: rename mae_pretrain_head to mae_head

* [Fix]: Fix import error in __init__.py

* [Feature]: skip MAE algo UT when running on windows

* [Fix]: Fix UT bug

* [Feature]: Update model_zoo

* [Fix]: Rename MAE pretrain model name

* [Fix]: Delete mae ft prefix

* [Feature]: Change b to base

* [Refactor]: Change b in MAE pt config to base

* [Fix]: Fix typo in docstring

* [Fix]: Fix name bug

* [Feature]: Add new constructor for MAE finetune

* [Fix]: Fix model_zoo link

* [Fix]: Skip UT for MAE

* [Fix]: Change fixed channel order to param

Co-authored-by: LIU Yuan <liuyuuan@pjlab.org.cn>
Co-authored-by: liu yuan <liuyuan@pjlab.org.cn>

* [Feature]: Add diff seeds to diff ranks and set torch seed in worker_init_fn (#228)

* [Feature]: Add set diff seeds to diff ranks

* [Fix]: Set diff seed to diff workers

* Bump version to v0.7.0 (#227)

* Bump version to v0.7.0

* [Docs] update readme

Co-authored-by: wang11wang <95845452+wang11wang@users.noreply.github.com>
Co-authored-by: Liangyu Chen <45140242+c-liangyu@users.noreply.github.com>
Co-authored-by: Ming Li <73068772+mitming@users.noreply.github.com>
Co-authored-by: liming <liming.ai@bytedance.com>
Co-authored-by: Yuan Liu <30762564+YuanLiuuuuuu@users.noreply.github.com>
Co-authored-by: LIU Yuan <liuyuuan@pjlab.org.cn>
Co-authored-by: liu yuan <liuyuan@pjlab.org.cn>
  • Loading branch information
8 people committed Mar 4, 2022
1 parent af331b0 commit 47f6feb
Show file tree
Hide file tree
Showing 110 changed files with 2,095 additions and 611 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,40 @@ jobs:
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false

test_windows:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2022]
python: [3.8]
platform: [cpu, cu111]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Upgrade pip
run: pip install pip --upgrade --user
- name: Install PyTorch
# As a complement to Linux CI, we test on PyTorch LTS version
run: pip install torch==1.8.2+${{ matrix.platform }} torchvision==0.9.2+${{ matrix.platform }} -f https://download.pytorch.org/whl/lts/1.8/torch_lts.html
- name: Install OpenCV
run: |
pip install opencv-python>=3
- name: Install MMCV
run: |
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.8/index.html --only-binary mmcv-full
- name: Install unittest dependencies
run: |
pip install -r requirements.txt
- name: Build and install
run: pip install -e .
- name: Run unittests
run: |
coverage run --branch --source mmselfsup -m pytest tests/
- name: Generate coverage report
run: |
coverage xml
coverage report -m --omit="mmselfsup/apis/*"
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,9 @@ repos:
hooks:
- id: docformatter
args: ["--in-place", "--wrap-descriptions", "79"]
- repo: https://github.com/open-mmlab/pre-commit-hooks
rev: v0.2.0
hooks:
- id: check-algo-readme
- id: check-copyright
args: ["mmselfsup", "tools", "tests"]
26 changes: 17 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ This project is released under the [Apache 2.0 license](LICENSE).

## ChangeLog

MMSelfSup **v0.6.0** was released in 02/02/2022.
MMSelfSup **v0.7.0** was released in 03/03/2022.

Highlights of the new version:

* Support **MAE**
* Add **Places205** benchmarks
* Add test Windows in workflows

Please refer to [changelog.md](docs/en/changelog.md) for details and release history.

Expand All @@ -92,6 +98,7 @@ Supported algorithms:
- [x] [DenseCL (CVPR'2021)](https://arxiv.org/abs/2011.09157)
- [x] [SimSiam (CVPR'2021)](https://arxiv.org/abs/2011.10566)
- [x] [MoCo v3 (ICCV'2021)](https://arxiv.org/abs/2104.02057)
- [x] [MAE](https://arxiv.org/abs/2111.06377)

More algorithms are in our plan.

Expand Down Expand Up @@ -158,20 +165,21 @@ Remarks:
## Projects in OpenMMLab

- [MMCV](https://github.com/open-mmlab/mmcv): OpenMMLab foundational library for computer vision.
- [MIM](https://github.com/open-mmlab/mim): MIM Installs OpenMMLab Packages.
- [MIM](https://github.com/open-mmlab/mim): MIM installs OpenMMLab packages.
- [MMClassification](https://github.com/open-mmlab/mmclassification): OpenMMLab image classification toolbox and benchmark.
- [MMDetection](https://github.com/open-mmlab/mmdetection): OpenMMLab detection toolbox and benchmark.
- [MMDetection3D](https://github.com/open-mmlab/mmdetection3d): OpenMMLab's next-generation platform for general 3D object detection.
- [MMRotate](https://github.com/open-mmlab/mmrotate): OpenMMLab rotated object detection toolbox and benchmark.
- [MMSegmentation](https://github.com/open-mmlab/mmsegmentation): OpenMMLab semantic segmentation toolbox and benchmark.
- [MMAction2](https://github.com/open-mmlab/mmaction2): OpenMMLab's next-generation action understanding toolbox and benchmark.
- [MMTracking](https://github.com/open-mmlab/mmtracking): OpenMMLab video perception toolbox and benchmark.
- [MMOCR](https://github.com/open-mmlab/mmocr): OpenMMLab text detection, recognition, and understanding toolbox.
- [MMPose](https://github.com/open-mmlab/mmpose): OpenMMLab pose estimation toolbox and benchmark.
- [MMEditing](https://github.com/open-mmlab/mmediting): OpenMMLab image and video editing toolbox.
- [MMOCR](https://github.com/open-mmlab/mmocr): OpenMMLab toolbox for text detection, recognition and understanding.
- [MMGeneration](https://github.com/open-mmlab/mmgeneration): OpenMMlab toolkit for generative models.
- [MMFlow](https://github.com/open-mmlab/mmflow): OpenMMLab optical flow toolbox and benchmark.
- [MMFewShot](https://github.com/open-mmlab/mmfewshot): OpenMMLab few shot learning toolbox and benchmark.
- [MMHuman3D](https://github.com/open-mmlab/mmhuman3d): OpenMMLab 3D human parametric model toolbox and benchmark.
- [MMSelfSup](https://github.com/open-mmlab/mmselfsup): OpenMMLab self-supervised learning toolbox and benchmark.
- [MMRazor](https://github.com/open-mmlab/mmrazor): OpenMMLab model compression toolbox and benchmark.
- [MMFewShot](https://github.com/open-mmlab/mmfewshot): OpenMMLab fewshot learning toolbox and benchmark.
- [MMAction2](https://github.com/open-mmlab/mmaction2): OpenMMLab's next-generation action understanding toolbox and benchmark.
- [MMTracking](https://github.com/open-mmlab/mmtracking): OpenMMLab video perception toolbox and benchmark.
- [MMFlow](https://github.com/open-mmlab/mmflow): OpenMMLab optical flow toolbox and benchmark.
- [MMEditing](https://github.com/open-mmlab/mmediting): OpenMMLab image and video editing toolbox.
- [MMGeneration](https://github.com/open-mmlab/mmgeneration): OpenMMLab image and video generative models toolbox.
- [MMDeploy](https://github.com/open-mmlab/mmdeploy): OpenMMLab model deployment framework.
36 changes: 22 additions & 14 deletions README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@ MMSelfSup 是一个基于 PyTorch 实现的开源自监督表征学习工具箱

## 更新日志

最新的 **v0.6.0** 版本已经在 2022.02.02 发布。
最新的 **v0.7.0** 版本已经在 2022.03.03 发布。

新版本亮点:

* 支持 **MAE**
* 增加 **Places205** 下游基准测试
* 增加 Windows 测试

请参考 [更新日志](docs/zh_cn/changelog.md) 获取更多细节和历史版本信息。

Expand All @@ -91,6 +97,7 @@ MMSelfSup 和 OpenSelfSup 的不同点写在 [对比文档](docs/en/compatibilit
- [x] [DenseCL (CVPR'2021)](https://arxiv.org/abs/2011.09157)
- [x] [SimSiam (CVPR'2021)](https://arxiv.org/abs/2011.10566)
- [x] [MoCo v3 (ICCV'2021)](https://arxiv.org/abs/2104.02057)
- [x] [MAE](https://arxiv.org/abs/2111.06377)

更多的算法实现已经在我们的计划中。

Expand Down Expand Up @@ -152,22 +159,23 @@ MMSelfSup 是一款由不同学校和公司共同贡献的开源项目,我们
## OpenMMLab 的其他项目

- [MMCV](https://github.com/open-mmlab/mmcv): OpenMMLab 计算机视觉基础库
- [MIM](https://github.com/open-mmlab/mim): MIM 是 OpenMMLab 项目、算法、模型的统一入口
- [MMClassification](https://github.com/open-mmlab/mmclassification): OpenMMLab 图像分类工具箱与测试基准
- [MMDetection](https://github.com/open-mmlab/mmdetection): OpenMMLab 检测工具箱与测试基准
- [MMDetection3D](https://github.com/open-mmlab/mmdetection3d): OpenMMLab 新一代通用3D目标检测平台
- [MMSegmentation](https://github.com/open-mmlab/mmsegmentation): OpenMMLab 语义分割工具箱与测试基准
- [MMAction2](https://github.com/open-mmlab/mmaction2): OpenMMLab 新一代视频理解工具箱与测试基准
- [MMTracking](https://github.com/open-mmlab/mmtracking): OpenMMLab 一体化视频目标感知平台
- [MMPose](https://github.com/open-mmlab/mmpose): OpenMMLab 姿态估计工具箱与测试基准
- [MMEditing](https://github.com/open-mmlab/mmediting): OpenMMLab 图像视频编辑工具箱
- [MMOCR](https://github.com/open-mmlab/mmocr): OpenMMLab 全流程文字检测识别理解工具包
- [MMGeneration](https://github.com/open-mmlab/mmgeneration): OpenMMLab 新一代生成模型工具箱
- [MMFlow](https://github.com/open-mmlab/mmflow): OpenMMLab 光流估计工具箱与测试基准
- [MMFewShot](https://github.com/open-mmlab/mmfewshot): OpenMMLab 少样本学习工具箱与测试基准
- [MIM](https://github.com/open-mmlab/mim): MIM 是 OpenMMlab 项目、算法、模型的统一入口
- [MMClassification](https://github.com/open-mmlab/mmclassification): OpenMMLab 图像分类工具箱
- [MMDetection](https://github.com/open-mmlab/mmdetection): OpenMMLab 目标检测工具箱
- [MMDetection3D](https://github.com/open-mmlab/mmdetection3d): OpenMMLab 新一代通用 3D 目标检测平台
- [MMRotate](https://github.com/open-mmlab/mmrotate): OpenMMLab 旋转框检测工具箱与测试基准
- [MMSegmentation](https://github.com/open-mmlab/mmsegmentation): OpenMMLab 语义分割工具箱
- [MMOCR](https://github.com/open-mmlab/mmocr): OpenMMLab 全流程文字检测识别理解工具箱
- [MMPose](https://github.com/open-mmlab/mmpose): OpenMMLab 姿态估计工具箱
- [MMHuman3D](https://github.com/open-mmlab/mmhuman3d): OpenMMLab 人体参数化模型工具箱与测试基准
- [MMSelfSup](https://github.com/open-mmlab/mmselfsup): OpenMMLab 自监督学习工具箱与测试基准
- [MMRazor](https://github.com/open-mmlab/mmrazor): OpenMMLab 模型压缩工具箱与测试基准
- [MMFewShot](https://github.com/open-mmlab/mmfewshot): OpenMMLab 少样本学习工具箱与测试基准
- [MMAction2](https://github.com/open-mmlab/mmaction2): OpenMMLab 新一代视频理解工具箱
- [MMTracking](https://github.com/open-mmlab/mmtracking): OpenMMLab 一体化视频目标感知平台
- [MMFlow](https://github.com/open-mmlab/mmflow): OpenMMLab 光流估计工具箱与测试基准
- [MMEditing](https://github.com/open-mmlab/mmediting): OpenMMLab 图像视频编辑工具箱
- [MMGeneration](https://github.com/open-mmlab/mmgeneration): OpenMMLab 图片视频生成模型工具箱
- [MMDeploy](https://github.com/open-mmlab/mmdeploy): OpenMMLab 模型部署框架

## 欢迎加入 OpenMMLab 社区
Expand Down
12 changes: 8 additions & 4 deletions configs/benchmarks/classification/_base_/datasets/places205.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,21 @@
type=dataset_type,
data_source=dict(
type=data_source,
data_prefix='data/Places205/train',
ann_file='data/Places205/meta/train.txt',
data_prefix= # noqa: E251
'data/Places205/data/vision/torralba/deeplearning/images256/',
ann_file= # noqa: E251
'data/Places205/trainvalsplit_places205/train_places205.csv',
),
pipeline=train_pipeline,
prefetch=prefetch),
val=dict(
type=dataset_type,
data_source=dict(
type=data_source,
data_prefix='data/Places205/val',
ann_file='data/Places205/meta/val.txt',
data_prefix= # noqa: E251
'data/Places205/data/vision/torralba/deeplearning/images256/',
ann_file= # noqa: E251
'data/Places205/trainvalsplit_places205/val_places205.csv',
),
pipeline=test_pipeline,
prefetch=prefetch))
Expand Down
17 changes: 17 additions & 0 deletions configs/benchmarks/classification/_base_/models/vit-base-p16_ft.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
model = dict(
type='Classification',
backbone=dict(
type='MIMVisionTransformer',
arch='b',
patch_size=16,
drop_path_rate=0.1,
final_norm=False),
head=dict(
type='MAEFinetuneHead',
num_classes=1000,
embed_dim=768,
label_smooth_val=0.1),
train_cfg=dict(augments=[
dict(type='BatchMixup', alpha=0.8, num_classes=1000, prob=0.5),
dict(type='BatchCutMix', alpha=1.0, num_classes=1000, prob=0.5)
]))
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
model = dict(
type='Classification',
backbone=dict(
type='MIMVisionTransformer',
arch='b',
patch_size=16,
final_norm=True,
finetune=False),
head=dict(type='MAELinprobeHead', num_classes=1000, embed_dim=768))
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# optimizer
optimizer = dict(type='AdamW', lr=1e-3, betas=(0.9, 0.999), weight_decay=0.05)

# learning policy
lr_config = dict(
policy='CosineAnnealing',
min_lr=0.,
warmup='linear',
warmup_iters=5,
warmup_ratio=1e-4, # cannot be 0
warmup_by_epoch=True)

# runtime settings
runner = dict(type='EpochBasedRunner', max_epochs=100)
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
_base_ = [
'../_base_/models/vit-base-p16_ft.py',
'../_base_/datasets/imagenet.py',
'../_base_/schedules/adamw_coslr-100e_in1k.py',
'../_base_/default_runtime.py',
]

# dataset
img_norm_cfg = dict(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
train_pipeline = [
dict(
type='RandomAug',
input_size=224,
color_jitter=None,
auto_augment='rand-m9-mstd0.5-inc1',
interpolation='bicubic',
re_prob=0.25,
re_mode='pixel',
re_count=1,
mean=(0.485, 0.456, 0.406),
std=(0.229, 0.224, 0.225))
]
test_pipeline = [
dict(type='Resize', size=256, interpolation=3),
dict(type='CenterCrop', size=224),
dict(type='ToTensor'),
dict(type='Normalize', **img_norm_cfg)
]
data = dict(
samples_per_gpu=128,
drop_last=False,
workers_per_gpu=32,
train=dict(pipeline=train_pipeline),
val=dict(pipeline=test_pipeline))

# model
model = dict(backbone=dict(init_cfg=dict()))

# optimizer
optimizer = dict(
lr=1e-3 * 1024 / 256,
paramwise_options={
'norm': dict(weight_decay=0.),
'bias': dict(weight_decay=0.),
'pos_embed': dict(weight_decay=0.),
'cls_token': dict(weight_decay=0.)
},
constructor='MAEFtOptimizerConstructor',
layer_decay=0.65)

# learning policy
lr_config = dict(
policy='StepFixCosineAnnealing',
min_lr=1e-6,
warmup='linear',
warmup_iters=5,
warmup_ratio=1e-4,
warmup_by_epoch=True,
by_epoch=False)

# runtime
checkpoint_config = dict(interval=1, max_keep_ckpts=3, out_dir='')
persistent_workers = True
log_config = dict(
interval=100, hooks=[
dict(type='TextLoggerHook'),
])
30 changes: 30 additions & 0 deletions configs/selfsup/_base_/datasets/imagenet_mae.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# dataset settings
data_source = 'ImageNet'
dataset_type = 'SingleViewDataset'
img_norm_cfg = dict(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
train_pipeline = [
dict(
type='RandomResizedCrop', size=224, scale=(0.2, 1.0), interpolation=3),
dict(type='RandomHorizontalFlip')
]

# prefetch
prefetch = False
if not prefetch:
train_pipeline.extend(
[dict(type='ToTensor'),
dict(type='Normalize', **img_norm_cfg)])

# dataset summary
data = dict(
imgs_per_gpu=128,
workers_per_gpu=8,
train=dict(
type=dataset_type,
data_source=dict(
type=data_source,
data_prefix='data/imagenet/train',
ann_file='data/imagenet/meta/train.txt',
),
pipeline=train_pipeline,
prefetch=prefetch))
15 changes: 15 additions & 0 deletions configs/selfsup/_base_/models/mae_vit-base-p16.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# model settings
model = dict(
type='MAE',
backbone=dict(type='MAEViT', arch='b', patch_size=16, mask_ratio=0.75),
neck=dict(
type='MAEPretrainDecoder',
patch_size=16,
in_chans=3,
embed_dim=768,
decoder_embed_dim=512,
decoder_depth=8,
decoder_num_heads=16,
mlp_ratio=4.,
),
head=dict(type='MAEPretrainHead', norm_pix=True, patch_size=16))
15 changes: 15 additions & 0 deletions configs/selfsup/_base_/schedules/adamw_coslr-200e_in1k.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# optimizer
optimizer = dict(type='AdamW', lr=1.5e-4, betas=(0.9, 0.95), weight_decay=0.05)
optimizer_config = dict() # grad_clip, coalesce, bucket_size_mb

# learning policy
lr_config = dict(
policy='CosineAnnealing',
min_lr=0.,
warmup='linear',
warmup_iters=40,
warmup_ratio=1e-4, # cannot be 0
warmup_by_epoch=True)

# runtime settings
runner = dict(type='EpochBasedRunner', max_epochs=300)

0 comments on commit 47f6feb

Please sign in to comment.