From 84e45eff0e097bedd8b3250dca4565294e277c73 Mon Sep 17 00:00:00 2001 From: BIGWangYuDong Date: Wed, 18 May 2022 21:17:24 +0800 Subject: [PATCH 1/2] mdformat --- .pre-commit-config.yaml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c2ddeaf..51bf3c2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,5 @@ repos: - - repo: https://gitlab.com/pycqa/flake8.git + - repo: https://github.com/PyCQA/flake8 rev: 3.8.3 hooks: - id: flake8 @@ -24,11 +24,6 @@ repos: args: ["--remove"] - id: mixed-line-ending args: ["--fix=lf"] - - repo: https://github.com/markdownlint/markdownlint - rev: v0.11.0 - hooks: - - id: markdownlint - args: ["-r", "~MD002,~MD013,~MD024,~MD029,~MD033,~MD034,~MD036", "-t", "allow_different_nesting"] - repo: https://github.com/myint/docformatter rev: v1.3.1 hooks: @@ -45,3 +40,12 @@ repos: - id: check-algo-readme - id: check-copyright args: [ "mmfewshot", "tools" ] # replace the dir_to_check with your expected directory to check + - repo: https://github.com/executablebooks/mdformat + rev: 0.7.14 + hooks: + - id: mdformat + args: ["--number"] + additional_dependencies: + - mdformat-gfm + - mdformat_frontmatter + - linkify-it-py From 7a9609e19e986ecf64dff438a5c0354df3140283 Mon Sep 17 00:00:00 2001 From: BIGWangYuDong Date: Wed, 18 May 2022 21:19:07 +0800 Subject: [PATCH 2/2] fix markdown files lints --- .github/CODE_OF_CONDUCT.md | 30 ++--- .github/ISSUE_TEMPLATE/error-report.md | 5 +- .github/ISSUE_TEMPLATE/feature_request.md | 5 +- .github/ISSUE_TEMPLATE/general_questions.md | 1 - .../reimplementation_questions.md | 5 +- .github/pull_request_template.md | 4 + README.md | 30 +++-- README_zh-CN.md | 32 +++--- configs/classification/README.md | 3 +- configs/classification/baseline/README.md | 55 ++++----- .../classification/baseline_plus/README.md | 53 ++++----- configs/classification/maml/README.md | 55 ++++----- configs/classification/matching_net/README.md | 53 ++++----- .../classification/meta_baseline/README.md | 58 +++++----- configs/classification/neg_margin/README.md | 52 ++++----- configs/classification/proto_net/README.md | 55 ++++----- configs/classification/relation_net/README.md | 54 ++++----- configs/detection/README.md | 2 + configs/detection/attention_rpn/README.md | 88 +++++++-------- configs/detection/fsce/README.md | 105 +++++++++--------- configs/detection/fsdetview/README.md | 80 +++++++------ configs/detection/meta_rcnn/README.md | 80 +++++++------ configs/detection/mpsr/README.md | 88 ++++++++------- configs/detection/tfa/README.md | 88 +++++++-------- demo/README.md | 2 +- docs/en/classification/customize_config.md | 9 +- docs/en/classification/customize_dataset.md | 5 +- docs/en/classification/customize_models.md | 1 - docs/en/classification/customize_runtime.md | 80 +++++++------ docs/en/classification/overview.md | 10 +- docs/en/detection/customize_config.md | 5 +- docs/en/detection/customize_dataset.md | 74 +++++++----- docs/en/detection/customize_models.md | 5 +- docs/en/detection/customize_runtime.md | 75 +++++++------ docs/en/detection/overview.md | 7 +- docs/en/faq.md | 90 ++++++++------- docs/en/get_started.md | 5 +- docs/en/install.md | 94 ++++++++-------- docs/en/intro.md | 40 ++++--- docs/en/model_zoo.md | 4 - docs/zh_cn/classification/customize_config.md | 9 +- .../zh_cn/classification/customize_dataset.md | 5 +- docs/zh_cn/classification/customize_models.md | 1 - .../zh_cn/classification/customize_runtime.md | 80 +++++++------ docs/zh_cn/classification/overview.md | 10 +- docs/zh_cn/detection/customize_config.md | 5 +- docs/zh_cn/detection/customize_dataset.md | 74 +++++++----- docs/zh_cn/detection/customize_models.md | 5 +- docs/zh_cn/detection/customize_runtime.md | 75 +++++++------ docs/zh_cn/detection/overview.md | 7 +- docs/zh_cn/faq.md | 97 ++++++++-------- docs/zh_cn/get_started.md | 5 +- docs/zh_cn/install.md | 86 +++++++------- docs/zh_cn/model_zoo.md | 4 - tools/data/README.md | 1 - tools/data/classification/cub/README.md | 1 + .../classification/mini-imagenet/README.md | 1 + .../classification/tiered-imagenet/README.md | 1 + tools/data/detection/README.md | 1 + tools/data/detection/coco/README.md | 4 + tools/data/detection/voc/README.md | 6 +- 61 files changed, 1062 insertions(+), 1003 deletions(-) diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md index efd4305..92afad1 100644 --- a/.github/CODE_OF_CONDUCT.md +++ b/.github/CODE_OF_CONDUCT.md @@ -14,22 +14,22 @@ appearance, race, religion, or sexual identity and orientation. Examples of behavior that contributes to creating a positive environment include: -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members Examples of unacceptable behavior by participants include: -* The use of sexualized language or imagery and unwelcome sexual attention or - advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic - address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting +- The use of sexualized language or imagery and unwelcome sexual attention or + advances +- Trolling, insulting/derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or electronic + address, without explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting ## Our Responsibilities @@ -70,7 +70,7 @@ members of the project's leadership. This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html -[homepage]: https://www.contributor-covenant.org - For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq + +[homepage]: https://www.contributor-covenant.org diff --git a/.github/ISSUE_TEMPLATE/error-report.md b/.github/ISSUE_TEMPLATE/error-report.md index a508c0a..2308d6e 100644 --- a/.github/ISSUE_TEMPLATE/error-report.md +++ b/.github/ISSUE_TEMPLATE/error-report.md @@ -4,7 +4,6 @@ about: Create a report to help us improve title: '' labels: '' assignees: '' - --- Thanks for your error report and we appreciate it a lot. @@ -33,8 +32,8 @@ A placeholder for the command. 1. Please run `python mmfewshot/utils/collect_env.py` to collect necessary environment information and paste it here. 2. You may add addition that may be helpful for locating the problem, such as - - How you installed PyTorch [e.g., pip, conda, source] - - Other environment variables that may be related (such as `$PATH`, `$LD_LIBRARY_PATH`, `$PYTHONPATH`, etc.) + - How you installed PyTorch \[e.g., pip, conda, source\] + - Other environment variables that may be related (such as `$PATH`, `$LD_LIBRARY_PATH`, `$PYTHONPATH`, etc.) **Error traceback** If applicable, paste the error trackback here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 33f9d5f..7bf92e8 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -4,15 +4,14 @@ about: Suggest an idea for this project title: '' labels: '' assignees: '' - --- **Describe the feature** **Motivation** A clear and concise description of the motivation of the feature. -Ex1. It is inconvenient when [....]. -Ex2. There is a recent paper [....], which is very helpful for [....]. +Ex1. It is inconvenient when \[....\]. +Ex2. There is a recent paper \[....\], which is very helpful for \[....\]. **Related resources** If there is an official code release or third-party implementations, please also provide the information here, which would be very helpful. diff --git a/.github/ISSUE_TEMPLATE/general_questions.md b/.github/ISSUE_TEMPLATE/general_questions.md index b5a6451..f02dd63 100644 --- a/.github/ISSUE_TEMPLATE/general_questions.md +++ b/.github/ISSUE_TEMPLATE/general_questions.md @@ -4,5 +4,4 @@ about: Ask general questions to get help title: '' labels: '' assignees: '' - --- diff --git a/.github/ISSUE_TEMPLATE/reimplementation_questions.md b/.github/ISSUE_TEMPLATE/reimplementation_questions.md index 61ed1bf..9f921b6 100644 --- a/.github/ISSUE_TEMPLATE/reimplementation_questions.md +++ b/.github/ISSUE_TEMPLATE/reimplementation_questions.md @@ -2,9 +2,8 @@ name: Reimplementation Questions about: Ask about questions during model reimplementation title: '' -labels: 'reimplementation' +labels: reimplementation assignees: '' - --- **Notice** @@ -52,7 +51,7 @@ A placeholder for the config. 1. Please run `python mmfewshot/utils/collect_env.py` to collect necessary environment information and paste it here. 2. You may add addition that may be helpful for locating the problem, such as - 1. How you installed PyTorch [e.g., pip, conda, source] + 1. How you installed PyTorch \[e.g., pip, conda, source\] 2. Other environment variables that may be related (such as `$PATH`, `$LD_LIBRARY_PATH`, `$PYTHONPATH`, etc.) **Results** diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index f1685da..d54c0a2 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,16 +1,20 @@ Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers. ## Motivation + Please describe the motivation of this PR and the goal you want to achieve through this PR. ## Modification + Please briefly describe what modification is made in this PR. ## BC-breaking (Optional) + Does the modification introduce changes that break the back-compatibility of the downstream repos? If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR. ## Use cases (Optional) + If this PR introduces a new feature, it is better to list some use cases here, and update the documentation. ## Checklist diff --git a/README.md b/README.md index 784219d..57dbba9 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,6 @@ English | [简体中文](README_zh-CN.md) [![Average time to resolve an issue](https://isitmaintained.com/badge/resolution/open-mmlab/mmfewshot.svg)](https://github.com/open-mmlab/mmfewshot/issues) [![Percentage of issues still open](https://isitmaintained.com/badge/open/open-mmlab/mmfewshot.svg)](https://github.com/open-mmlab/mmfewshot/issues) - mmfewshot is an open source few shot learning toolbox based on PyTorch. It is a part of the [OpenMMLab](https://open-mmlab.github.io/) project. The master branch works with **PyTorch 1.5+**. @@ -44,6 +43,7 @@ Documentation: https://mmfewshot.readthedocs.io/en/latest/. ### Major features + - **Support multiple tasks in Few Shot Learning** MMFewShot provides unified implementation and evaluation of few shot classification and detection. @@ -57,12 +57,10 @@ Documentation: https://mmfewshot.readthedocs.io/en/latest/. The toolbox provides strong baselines and state-of-the-art methods in few shot classification and detection. - ## License This project is released under the [Apache 2.0 license](LICENSE). - ## Model Zoo Supported algorithms: @@ -93,10 +91,8 @@ Supported algorithms: - ## Changelog - ## Installation & Dataset Preparation MMFewShot depends on [PyTorch](https://pytorch.org/) and [MMCV](https://github.com/open-mmlab/mmcv). @@ -107,22 +103,23 @@ Please refer to [install.md](/docs/en/install.md) for installation of MMFewShot If you are new of few shot learning, you can start with [learn the basics](docs/en/intro.md). If you are familiar with it, check out [getting_started.md](docs/en/get_started.md) for the basic usage of mmfewshot. - Refer to the below tutorials to dive deeper: - Few Shot Classification - - [Overview](docs/classification/overview.md) - - [Config](docs/classification/customize_config.md) - - [Customize Dataset](docs/classification/customize_dataset.md) - - [Customize Model](docs/classification/customize_models.md) - - [Customize Runtime](docs/classification/customize_runtime.md) + + - [Overview](docs/classification/overview.md) + - [Config](docs/classification/customize_config.md) + - [Customize Dataset](docs/classification/customize_dataset.md) + - [Customize Model](docs/classification/customize_models.md) + - [Customize Runtime](docs/classification/customize_runtime.md) - Few Shot Detection - - [Overview](docs/detection/overview.md) - - [Config](docs/detection/customize_config.md) - - [Customize Dataset](docs/detection/customize_dataset.md) - - [Customize Model](docs/detection/customize_models.md) - - [Customize Runtime](docs/detection/customize_runtime.md) + + - [Overview](docs/detection/overview.md) + - [Config](docs/detection/customize_config.md) + - [Customize Dataset](docs/detection/customize_dataset.md) + - [Customize Model](docs/detection/customize_models.md) + - [Customize Runtime](docs/detection/customize_runtime.md) ## Citation @@ -137,7 +134,6 @@ If you find this project useful in your research, please consider cite: } ``` - ## Contributing We appreciate all contributions to improve mmfewshot. Please refer to [CONTRIBUTING.md](https://github.com/open-mmlab/mmfewshot/blob/main/.github/CONTRIBUTING.md) in MMFewShot for the contributing guideline. diff --git a/README_zh-CN.md b/README_zh-CN.md index d078188..f429d1b 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -53,14 +53,10 @@ MMFewShot 是一款基于 PyTorch 的少样本学习代码库,是 [OpenMMLab]( - - ## 开源许可证 该项目采用 [Apache 2.0 开源许可证](LICENSE) - - ## 基准测试和模型库 测试结果和模型可以在[模型库](docs/model_zoo.md)中找到。 @@ -101,39 +97,40 @@ MMFewShot 依赖 [PyTorch](https://pytorch.org/) 和 [MMCV](https://github.com/o 请参考[安装文档](docs/zh_cn/install.md)进行安装和参考[数据准备](tools/data/README.md)准备数据集。 ## 快速入门 + 如果初次了解少样本学习,你可以从[基础介绍](docs/en/intro.md)开始了解少样本学习的基本概念和 MMFewShot 的框架。 如果对少样本学习很熟悉,请参考[使用教程](docs/en/get_started.md)获取MMFewShot的基本用法。 MMFewShot 也提供了其他更详细的教程,包括: - 少样本分类 - - [概览](docs/classification/overview.md) - - [配置文件](docs/classification/customize_config.md) - - [添加数据集](docs/classification/customize_dataset.md) - - [添加新模型](docs/classification/customize_models.md) - - [自定义模型运行环境](docs/classification/customize_runtime.md)。 + + - [概览](docs/classification/overview.md) + - [配置文件](docs/classification/customize_config.md) + - [添加数据集](docs/classification/customize_dataset.md) + - [添加新模型](docs/classification/customize_models.md) + - [自定义模型运行环境](docs/classification/customize_runtime.md)。 - 少样本检测 - - [概览](docs/detection/overview.md) - - [配置文件](docs/detection/customize_config.md) - - [添加数据集](docs/detection/customize_dataset.md) - - [添加新模型](docs/detection/customize_models.md) - - [自定义模型运行环境](docs/detection/customize_runtime.md)。 + - [概览](docs/detection/overview.md) + - [配置文件](docs/detection/customize_config.md) + - [添加数据集](docs/detection/customize_dataset.md) + - [添加新模型](docs/detection/customize_models.md) + - [自定义模型运行环境](docs/detection/customize_runtime.md)。 ## 贡献指南 我们感谢所有的贡献者为改进和提升 MMFewShot 所作出的努力。请参考[贡献指南](https://github.com/open-mmlab/mmfewshot/blob/main/.github/CONTRIBUTING.md)来了解参与项目贡献的相关指引。 - ## 致谢 MMFewShot 是一款由不同学校和公司共同贡献的开源项目。我们感谢所有为项目提供算法复现和新功能支持的贡献者,以及提供宝贵反馈的用户。 我们希望该工具箱和基准测试可以为社区提供灵活的代码工具,供用户复现现有算法并开发自己的新模型,从而不断为开源社区提供贡献。 - ## 引用 + 如果您发现此项目对您的研究有用,请考虑引用: ```bibtex @@ -145,7 +142,6 @@ MMFewShot 是一款由不同学校和公司共同贡献的开源项目。我们 } ``` - ## OpenMMLab 的其他项目 - [MIM](https://github.com/open-mmlab/mim): MIM 是 OpenMMlab 项目、算法、模型的统一入口 @@ -169,7 +165,7 @@ MMFewShot 是一款由不同学校和公司共同贡献的开源项目。我们 ## 欢迎加入 OpenMMLab 社区 - 扫描下方的二维码可关注 OpenMMLab 团队的 [知乎官方账号](https://www.zhihu.com/people/openmmlab),加入 OpenMMLab 团队的 [官方交流 QQ 群](https://jq.qq.com/?_wv=1027&k=aCvMxdr3) +扫描下方的二维码可关注 OpenMMLab 团队的 [知乎官方账号](https://www.zhihu.com/people/openmmlab),加入 OpenMMLab 团队的 [官方交流 QQ 群](https://jq.qq.com/?_wv=1027&k=aCvMxdr3)
diff --git a/configs/classification/README.md b/configs/classification/README.md index a23d89c..2ac5b34 100644 --- a/configs/classification/README.md +++ b/configs/classification/README.md @@ -1,9 +1,10 @@ # Few Shot Classification - ## Get Started + If you're new of mmfewshot, you can check out [Get Started](https://mmfewshot.readthedocs.io/en/latest/index.html) and [Classification Tutorials](https://mmfewshot.readthedocs.io/en/latest/classification/index.html) to try out MMFewShot. ## Data Preparation + Please follow [DATA Preparation](https://github.com/open-mmlab/mmfewshot/tree/main/tools/data/classification) to prepare data. diff --git a/configs/classification/baseline/README.md b/configs/classification/baseline/README.md index c4f689b..02bceb1 100644 --- a/configs/classification/baseline/README.md +++ b/configs/classification/baseline/README.md @@ -3,6 +3,7 @@ ## Abstract + Few-shot classification aims to learn a classifier to recognize unseen classes during training with limited labeled examples. While significant progress has been made, the growing complexity of network designs, meta-learning algorithms, and differences @@ -21,16 +22,15 @@ a standard fine-tuning practice compares favorably against other state-of-the-ar few-shot learning algorithms. +
- - ## Citation - + ```bibtex @inproceedings{chen2019closerfewshot, title={A Closer Look at Few-shot Classification}, @@ -43,15 +43,18 @@ few-shot learning algorithms. ## How to Reproduce Baseline It consists of two steps: + - **Step1: Base training** - - use all the images of base classes to train a base model. - - conduct meta testing on validation set to select the best model. + + - use all the images of base classes to train a base model. + - conduct meta testing on validation set to select the best model. - **Step2: Meta Testing**: - - use best model from step1, the best model are saved into `${WORK_DIR}/${CONFIG}/best_accuracy_mean.pth` in default. + - use best model from step1, the best model are saved into `${WORK_DIR}/${CONFIG}/best_accuracy_mean.pth` in default. ### An example of CUB dataset with Conv4 + ```bash # base training python ./tools/classification/train.py \ @@ -64,6 +67,7 @@ python ./tools/classification/test.py \ ``` **Note**: + - All the result are trained with single gpu. - The config of 1 shot and 5 shot use same training setting, but different meta test setting on validation set and test set. @@ -73,30 +77,29 @@ python ./tools/classification/test.py \ feel free to tone and try different configurations. For example, try different learning rate or validation episodes for each setting. - - ## Results on CUB dataset with 2000 episodes -| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | -| :-------------- | :-----------: | :------: | :------: | :------: | :------: | :------: |:------: |:------: | -| [conv4](/configs/classification/baseline/cub/baseline_conv4_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 47.73 | 0.41 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/baseline/cub/baseline_conv4_1xb64_cub_5way-1shot_20211120_095923-3a346523.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/baseline/cub/baseline_conv4_1xb64_cub_5way-1shot20211120_095923.log.json) | -| [conv4](/configs/classification/baseline/cub/baseline_conv4_1xb64_cub_5way-5shot.py) | 84x84 | 64 | 5 | 5 | 68.77 | 0.38 | ⇑ | ⇑ | -| [resnet12](/configs/classification/baseline/cub/baseline_resnet12_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 71.85 | 0.46 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/baseline/cub/baseline_resnet12_1xb64_cub_5way-1shot_20211120_095923-f1d13cf6.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/baseline/cub/baseline_resnet12_1xb64_cub_5way-1shot20211120_095923.log.json) | -| [resnet12](/configs/classification/baseline/cub/baseline_resnet12_1xb64_cub_5way-5shot.py) | 84x84 | 64 | 5 | 5 | 88.09 | 0.25 | ⇑ | ⇑ | +| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | +| :----------------------------------------------------------------------------------------- | :--------: | :--------: | :-: | :--: | :------: | :--: | :----------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------: | +| [conv4](/configs/classification/baseline/cub/baseline_conv4_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 47.73 | 0.41 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/baseline/cub/baseline_conv4_1xb64_cub_5way-1shot_20211120_095923-3a346523.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/baseline/cub/baseline_conv4_1xb64_cub_5way-1shot20211120_095923.log.json) | +| [conv4](/configs/classification/baseline/cub/baseline_conv4_1xb64_cub_5way-5shot.py) | 84x84 | 64 | 5 | 5 | 68.77 | 0.38 | ⇑ | ⇑ | +| [resnet12](/configs/classification/baseline/cub/baseline_resnet12_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 71.85 | 0.46 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/baseline/cub/baseline_resnet12_1xb64_cub_5way-1shot_20211120_095923-f1d13cf6.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/baseline/cub/baseline_resnet12_1xb64_cub_5way-1shot20211120_095923.log.json) | +| [resnet12](/configs/classification/baseline/cub/baseline_resnet12_1xb64_cub_5way-5shot.py) | 84x84 | 64 | 5 | 5 | 88.09 | 0.25 | ⇑ | ⇑ | ## Results on Mini-ImageNet dataset with 2000 episodes -| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | -| :-------------- | :-----------: | :------: | :------: | :------: | :------: | :------: |:------: |:------: | -| [conv4](/configs/classification/baseline/mini_imagenet/baseline_conv4_1xb64_mini-imagenet_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 46.06 | 0.39 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/baseline/mini_imagenet/baseline_conv4_1xb64_mini-imagenet_5way-1shot_20211120_095923-78b96fd7.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/baseline/mini_imagenet/baseline_conv4_1xb64_mini-imagenet_5way-1shot.log.json) | -| [conv4](/configs/classification/baseline/mini_imagenet/baseline_conv4_1xb64_mini-imagenet_5way-5shot.py) | 84x84 | 64 | 5 | 5 | 65.83 | 0.35 | ⇑ | ⇑ | -| [resnet12](/configs/classification/baseline/mini_imagenet/baseline_resnet12_1xb64_mini-imagenet_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 60.0 | 0.44 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/baseline/mini_imagenet/baseline_resnet12_1xb64_mini-imagenet_5way-1shot_20211120_095923-26863e78.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/baseline/mini_imagenet/baseline_resnet12_1xb64_mini-imagenet_5way-1shot.log.json) | -| [resnet12](/configs/classification/baseline/mini_imagenet/baseline_resnet12_1xb64_mini-imagenet_5way-5shot.py) | 84x84 | 64 | 5 | 5 | 80.55 | 0.31 | ⇑ | ⇑ | +| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | +| :------------------------------------------------------------------------------------------------------------- | :--------: | :--------: | :-: | :--: | :------: | :--: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------: | +| [conv4](/configs/classification/baseline/mini_imagenet/baseline_conv4_1xb64_mini-imagenet_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 46.06 | 0.39 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/baseline/mini_imagenet/baseline_conv4_1xb64_mini-imagenet_5way-1shot_20211120_095923-78b96fd7.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/baseline/mini_imagenet/baseline_conv4_1xb64_mini-imagenet_5way-1shot.log.json) | +| [conv4](/configs/classification/baseline/mini_imagenet/baseline_conv4_1xb64_mini-imagenet_5way-5shot.py) | 84x84 | 64 | 5 | 5 | 65.83 | 0.35 | ⇑ | ⇑ | +| [resnet12](/configs/classification/baseline/mini_imagenet/baseline_resnet12_1xb64_mini-imagenet_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 60.0 | 0.44 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/baseline/mini_imagenet/baseline_resnet12_1xb64_mini-imagenet_5way-1shot_20211120_095923-26863e78.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/baseline/mini_imagenet/baseline_resnet12_1xb64_mini-imagenet_5way-1shot.log.json) | +| [resnet12](/configs/classification/baseline/mini_imagenet/baseline_resnet12_1xb64_mini-imagenet_5way-5shot.py) | 84x84 | 64 | 5 | 5 | 80.55 | 0.31 | ⇑ | ⇑ | + ## Results on Tiered-ImageNet dataset with 2000 episodes -| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | -| :-------------- | :-----------: | :------: | :------: | :------: | :------: | :------: |:------: |:------: | -| [conv4](/configs/classification/baseline/tiered_imagenet/baseline_conv4_1xb64_tiered-imagenet_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 45.49 | 0.41 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/baseline/tiered_imagenet/baseline_conv4_1xb64_tiered-imagenet_5way-1shot_20211120_095923-e0b2cc06.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/baseline/tiered_imagenet/baseline_conv4_1xb64_tiered-imagenet_5way-1shot.log.json) | -| [conv4](/configs/classification/baseline/tiered_imagenet/baseline_conv4_1xb64_tiered-imagenet_5way-5shot.py) | 84x84 | 64 | 5 | 5 | 66.48 | 0.4 | ⇑ | ⇑ | -| [resnet12](/configs/classification/baseline/tiered_imagenet/baseline_resnet12_1xb64_tiered-imagenet_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 66.11 | 0.49 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/baseline/tiered_imagenet/baseline_resnet12_1xb64_tiered-imagenet_5way-1shot_20211120_095923-17c5cf85.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/baseline/tiered_imagenet/baseline_resnet12_1xb64_tiered-imagenet_5way-1shot.log.json) | -| [resnet12](/configs/classification/baseline/tiered_imagenet/baseline_resnet12_1xb64_tiered-imagenet_5way-5shot.py) | 84x84 | 64 | 5 | 5 | 83.86 | 0.35 | ⇑ | ⇑ | +| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | +| :----------------------------------------------------------------------------------------------------------------- | :--------: | :--------: | :-: | :--: | :------: | :--: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------: | +| [conv4](/configs/classification/baseline/tiered_imagenet/baseline_conv4_1xb64_tiered-imagenet_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 45.49 | 0.41 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/baseline/tiered_imagenet/baseline_conv4_1xb64_tiered-imagenet_5way-1shot_20211120_095923-e0b2cc06.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/baseline/tiered_imagenet/baseline_conv4_1xb64_tiered-imagenet_5way-1shot.log.json) | +| [conv4](/configs/classification/baseline/tiered_imagenet/baseline_conv4_1xb64_tiered-imagenet_5way-5shot.py) | 84x84 | 64 | 5 | 5 | 66.48 | 0.4 | ⇑ | ⇑ | +| [resnet12](/configs/classification/baseline/tiered_imagenet/baseline_resnet12_1xb64_tiered-imagenet_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 66.11 | 0.49 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/baseline/tiered_imagenet/baseline_resnet12_1xb64_tiered-imagenet_5way-1shot_20211120_095923-17c5cf85.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/baseline/tiered_imagenet/baseline_resnet12_1xb64_tiered-imagenet_5way-1shot.log.json) | +| [resnet12](/configs/classification/baseline/tiered_imagenet/baseline_resnet12_1xb64_tiered-imagenet_5way-5shot.py) | 84x84 | 64 | 5 | 5 | 83.86 | 0.35 | ⇑ | ⇑ | diff --git a/configs/classification/baseline_plus/README.md b/configs/classification/baseline_plus/README.md index 19427f0..c7a69aa 100644 --- a/configs/classification/baseline_plus/README.md +++ b/configs/classification/baseline_plus/README.md @@ -3,6 +3,7 @@ ## Abstract + Few-shot classification aims to learn a classifier to recognize unseen classes during training with limited labeled examples. While significant progress has been made, the growing complexity of network designs, meta-learning algorithms, and differences @@ -21,16 +22,15 @@ a standard fine-tuning practice compares favorably against other state-of-the-ar few-shot learning algorithms. +
- - ## Citation - + ```bibtex @inproceedings{chen2019closerfewshot, title={A Closer Look at Few-shot Classification}, @@ -43,15 +43,18 @@ few-shot learning algorithms. ## How to Reproduce Baseline++ It consists of two steps: + - **Step1: Base training** - - use all the images of base classes to train a base model. - - conduct meta testing on validation set to select the best model. + + - use all the images of base classes to train a base model. + - conduct meta testing on validation set to select the best model. - **Step2: Meta Testing**: - - use best model from step1, the best model are saved into `${WORK_DIR}/${CONFIG}/best_accuracy_mean.pth` in default. + - use best model from step1, the best model are saved into `${WORK_DIR}/${CONFIG}/best_accuracy_mean.pth` in default. ### An example of CUB dataset with Conv4 + ```bash # base training python ./tools/classification/train.py \ @@ -64,6 +67,7 @@ python ./tools/classification/test.py \ ``` **Note**: + - All the result are trained with single gpu. - The configs of 1 shot and 5 shot use same training setting, but different meta test setting on validation set and test set. @@ -74,30 +78,29 @@ python ./tools/classification/test.py \ For example, try different learning rate or validation episodes for each setting. Anyway, we will continue to improve it. - ## Results on CUB dataset with 2000 episodes -| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | -| :-------------- | :-----------: | :------: | :------: | :------: | :------: | :------: |:------: |:------: | -| [conv4](/configs/classification/baseline_plus/cub/baseline-plus_conv4_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 62.01 | 0.49 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/baseline_plus/cub/baseline-plus_conv4_1xb64_cub_5way-1shot_20211120_100254-9d2e9021.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/baseline_plus/cub/baseline-plus_conv4_1xb64_cub_5way-1shot.log.json) | -| [conv4](/configs/classification/baseline_plus/cub/baseline-plus_conv4_1xb64_cub_5way-5shot.py) | 84x84 | 64 | 5 | 5 | 77.72 | 0.36 | ⇑ | ⇑ | -| [resnet12](/configs/classification/baseline_plus/cub/baseline-plus_resnet12_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 75.25 | 0.45 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/baseline_plus/cub/baseline-plus_resnet12_1xb64_cub_5way-1shot_20211120_100254-143f4d7a.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/baseline_plus/cub/baseline-plus_resnet12_1xb64_cub_5way-1shot.log.json) | -| [resnet12](/configs/classification/baseline_plus/cub/baseline-plus_resnet12_1xb64_cub_5way-5shot.py) | 84x84 | 64 | 5 | 5 | 89.85 | 0.23 | ⇑ | ⇑ | +| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | +| :--------------------------------------------------------------------------------------------------- | :--------: | :--------: | :-: | :--: | :------: | :--: | :--------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------: | +| [conv4](/configs/classification/baseline_plus/cub/baseline-plus_conv4_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 62.01 | 0.49 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/baseline_plus/cub/baseline-plus_conv4_1xb64_cub_5way-1shot_20211120_100254-9d2e9021.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/baseline_plus/cub/baseline-plus_conv4_1xb64_cub_5way-1shot.log.json) | +| [conv4](/configs/classification/baseline_plus/cub/baseline-plus_conv4_1xb64_cub_5way-5shot.py) | 84x84 | 64 | 5 | 5 | 77.72 | 0.36 | ⇑ | ⇑ | +| [resnet12](/configs/classification/baseline_plus/cub/baseline-plus_resnet12_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 75.25 | 0.45 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/baseline_plus/cub/baseline-plus_resnet12_1xb64_cub_5way-1shot_20211120_100254-143f4d7a.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/baseline_plus/cub/baseline-plus_resnet12_1xb64_cub_5way-1shot.log.json) | +| [resnet12](/configs/classification/baseline_plus/cub/baseline-plus_resnet12_1xb64_cub_5way-5shot.py) | 84x84 | 64 | 5 | 5 | 89.85 | 0.23 | ⇑ | ⇑ | ## Results on Mini-ImageNet dataset with 2000 episodes -| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | -| :-------------- | :-----------: | :------: | :------: | :------: | :------: | :------: |:------: |:------: | -| [conv4](/configs/classification/baseline_plus/mini_imagenet/baseline-plus_conv4_1xb64_mini-imagenet_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 51.16 | 0.43 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/baseline_plus/mini_imagenet/baseline-plus_conv4_1xb64_mini-imagenet_5way-1shot_20211120_100254-55e103d4.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/baseline_plus/mini_imagenet/baseline-plus_conv4_1xb64_mini-imagenet_5way-1shot.log.json) | -| [conv4](/configs/classification/baseline_plus/mini_imagenet/baseline-plus_conv4_1xb64_mini-imagenet_5way-5shot.py) | 84x84 | 64 | 5 | 5 | 67.99 | 0.36 | ⇑ | ⇑ | -| [resnet12](/configs/classification/baseline_plus/mini_imagenet/baseline-plus_resnet12_1xb64_mini-imagenet_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 63.25 | 0.44 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/baseline_plus/mini_imagenet/baseline-plus_resnet12_1xb64_mini-imagenet_5way-1shot_20211120_100254-3c89d8e1.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/baseline_plus/mini_imagenet/baseline-plus_resnet12_1xb64_mini-imagenet_5way-1shot.log.json) | -| [resnet12](/configs/classification/baseline_plus/mini_imagenet/baseline-plus_resnet12_1xb64_mini-imagenet_5way-5shot.py) | 84x84 | 64 | 5 | 5 | 81.67 | 0.3 | ⇑ | ⇑ | +| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | +| :----------------------------------------------------------------------------------------------------------------------- | :--------: | :--------: | :-: | :--: | :------: | :--: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------: | +| [conv4](/configs/classification/baseline_plus/mini_imagenet/baseline-plus_conv4_1xb64_mini-imagenet_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 51.16 | 0.43 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/baseline_plus/mini_imagenet/baseline-plus_conv4_1xb64_mini-imagenet_5way-1shot_20211120_100254-55e103d4.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/baseline_plus/mini_imagenet/baseline-plus_conv4_1xb64_mini-imagenet_5way-1shot.log.json) | +| [conv4](/configs/classification/baseline_plus/mini_imagenet/baseline-plus_conv4_1xb64_mini-imagenet_5way-5shot.py) | 84x84 | 64 | 5 | 5 | 67.99 | 0.36 | ⇑ | ⇑ | +| [resnet12](/configs/classification/baseline_plus/mini_imagenet/baseline-plus_resnet12_1xb64_mini-imagenet_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 63.25 | 0.44 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/baseline_plus/mini_imagenet/baseline-plus_resnet12_1xb64_mini-imagenet_5way-1shot_20211120_100254-3c89d8e1.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/baseline_plus/mini_imagenet/baseline-plus_resnet12_1xb64_mini-imagenet_5way-1shot.log.json) | +| [resnet12](/configs/classification/baseline_plus/mini_imagenet/baseline-plus_resnet12_1xb64_mini-imagenet_5way-5shot.py) | 84x84 | 64 | 5 | 5 | 81.67 | 0.3 | ⇑ | ⇑ | ## Results on Tiered-ImageNet dataset with 2000 episodes -| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | -| :-------------- | :-----------: | :------: | :------: | :------: | :------: | :------: |:------: |:------: | -| [conv4](/configs/classification/baseline_plus/tiered_imagenet/baseline-plus_conv4_1xb64_tiered-imagenet_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 51.49 | 0.45 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/baseline_plus/tiered_imagenet/baseline-plus_conv4_1xb64_tiered-imagenet_5way-1shot_20211120_100254-85eb4e29.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/baseline_plus/tiered_imagenet/baseline-plus_conv4_1xb64_tiered-imagenet_5way-1shot.log.json) | -| [conv4](/configs/classification/baseline_plus/tiered_imagenet/baseline-plus_conv4_1xb64_tiered-imagenet_5way-5shot.py) | 84x84 | 64 | 5 | 5 | 70.96 | 0.40 | ⇑ | ⇑ | -| [resnet12](/configs/classification/baseline_plus/tiered_imagenet/baseline-plus_resnet12_1xb64_tiered-imagenet_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 67.26 | 0.5 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/baseline_plus/tiered_imagenet/baseline-plus_resnet12_1xb64_tiered-imagenet_5way-1shot_20211120_100254-5fbf7c45.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/baseline_plus/tiered_imagenet/baseline-plus_resnet12_1xb64_tiered-imagenet_5way-1shot.log.json) | -| [resnet12](/configs/classification/baseline_plus/tiered_imagenet/baseline-plus_resnet12_1xb64_tiered-imagenet_5way-5shot.py) | 84x84 | 64 | 5 | 5 | 84.4 | 0.35 | ⇑ | ⇑ | +| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | +| :--------------------------------------------------------------------------------------------------------------------------- | :--------: | :--------: | :-: | :--: | :------: | :--: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------: | +| [conv4](/configs/classification/baseline_plus/tiered_imagenet/baseline-plus_conv4_1xb64_tiered-imagenet_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 51.49 | 0.45 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/baseline_plus/tiered_imagenet/baseline-plus_conv4_1xb64_tiered-imagenet_5way-1shot_20211120_100254-85eb4e29.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/baseline_plus/tiered_imagenet/baseline-plus_conv4_1xb64_tiered-imagenet_5way-1shot.log.json) | +| [conv4](/configs/classification/baseline_plus/tiered_imagenet/baseline-plus_conv4_1xb64_tiered-imagenet_5way-5shot.py) | 84x84 | 64 | 5 | 5 | 70.96 | 0.40 | ⇑ | ⇑ | +| [resnet12](/configs/classification/baseline_plus/tiered_imagenet/baseline-plus_resnet12_1xb64_tiered-imagenet_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 67.26 | 0.5 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/baseline_plus/tiered_imagenet/baseline-plus_resnet12_1xb64_tiered-imagenet_5way-1shot_20211120_100254-5fbf7c45.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/baseline_plus/tiered_imagenet/baseline-plus_resnet12_1xb64_tiered-imagenet_5way-1shot.log.json) | +| [resnet12](/configs/classification/baseline_plus/tiered_imagenet/baseline-plus_resnet12_1xb64_tiered-imagenet_5way-5shot.py) | 84x84 | 64 | 5 | 5 | 84.4 | 0.35 | ⇑ | ⇑ | diff --git a/configs/classification/maml/README.md b/configs/classification/maml/README.md index cb57d2a..160784d 100644 --- a/configs/classification/maml/README.md +++ b/configs/classification/maml/README.md @@ -1,9 +1,9 @@ # Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networks (ICML'2017) - ## Abstract + We propose an algorithm for meta-learning that is model-agnostic, in the sense that it is compatible with any model trained with gradient descent @@ -27,12 +27,11 @@ fine-tuning for policy gradient reinforcement learning with neural network policies. +
- - ## Citation @@ -45,19 +44,22 @@ learning with neural network policies. year={2017} } ``` + ## How to Reproduce MAML It consists of two steps: + - **Step1: Base training** - - use all the images of base classes to train a base model. - - conduct meta testing on validation set to select the best model. -- **Step2: Meta Testing**: - - use best model from step1, the best model are saved into `${WORK_DIR}/${CONFIG}/best_accuracy_mean.pth` in default. + - use all the images of base classes to train a base model. + - conduct meta testing on validation set to select the best model. +- **Step2: Meta Testing**: + - use best model from step1, the best model are saved into `${WORK_DIR}/${CONFIG}/best_accuracy_mean.pth` in default. ### An example of CUB dataset with Conv4 + ```bash # base training python ./tools/classification/train.py \ @@ -70,6 +72,7 @@ python ./tools/classification/test.py \ ``` **Note**: + - All the result are trained with single gpu. - The configs of 1 shot and 5 shot use same training setting, but different meta test setting on validation set and test set. @@ -80,29 +83,27 @@ python ./tools/classification/test.py \ ## Results on CUB dataset with 2000 episodes -| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | -| :-------------- | :-----------: | :------: | :------: | :------: | :------: | :------: |:------: |:------: | -| [conv4](/configs/classification/maml/cub/maml_conv4_1xb105_cub_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 60.32 | 0.5 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/maml/cub/maml_conv4_1xb105_cub_5way-1shot_20211031_125617-c00d532b.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/maml/cub/maml_conv4_1xb105_cub_5way-1shot.log.json) | -| [conv4](/configs/classification/maml/cub/maml_conv4_1xb105_cub_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 77.03 | 0.39 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/maml/cub/maml_conv4_1xb105_cub_5way-5shot_20211031_125919-48d15b7a.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/maml/cub/maml_conv4_1xb105_cub_5way-5shot.log.json) | -| [resnet12](/configs/classification/maml/cub/maml_resnet12_1xb105_cub_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 70.44 | 0.55 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/maml/cub/maml_resnet12_1xb105_cub_5way-1shot_20211031_130240-542c4387.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/maml/cub/maml_resnet12_1xb105_cub_5way-1shot.log.json) | -| [resnet12](/configs/classification/maml/cub/maml_resnet12_1xb105_cub_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 85.5 | 0.33 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/maml/cub/maml_resnet12_1xb105_cub_5way-5shot_20211031_130534-1de7c6d3.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/maml/cub/maml_resnet12_1xb105_cub_5way-5shot.log.json) | - +| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | +| :---------------------------------------------------------------------------------- | :--------: | :--------: | :-: | :--: | :------: | :--: | :---------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------: | +| [conv4](/configs/classification/maml/cub/maml_conv4_1xb105_cub_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 60.32 | 0.5 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/maml/cub/maml_conv4_1xb105_cub_5way-1shot_20211031_125617-c00d532b.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/maml/cub/maml_conv4_1xb105_cub_5way-1shot.log.json) | +| [conv4](/configs/classification/maml/cub/maml_conv4_1xb105_cub_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 77.03 | 0.39 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/maml/cub/maml_conv4_1xb105_cub_5way-5shot_20211031_125919-48d15b7a.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/maml/cub/maml_conv4_1xb105_cub_5way-5shot.log.json) | +| [resnet12](/configs/classification/maml/cub/maml_resnet12_1xb105_cub_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 70.44 | 0.55 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/maml/cub/maml_resnet12_1xb105_cub_5way-1shot_20211031_130240-542c4387.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/maml/cub/maml_resnet12_1xb105_cub_5way-1shot.log.json) | +| [resnet12](/configs/classification/maml/cub/maml_resnet12_1xb105_cub_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 85.5 | 0.33 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/maml/cub/maml_resnet12_1xb105_cub_5way-5shot_20211031_130534-1de7c6d3.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/maml/cub/maml_resnet12_1xb105_cub_5way-5shot.log.json) | ## Results on Mini-ImageNet dataset with 2000 episodes -| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | -| :-------------- | :-----------: | :------: | :------: | :------: | :------: | :------: |:------: |:------: | -| [conv4](/configs/classification/maml/mini_imagenet/maml_conv4_1xb105_mini-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 46.76 | 0.42 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/maml/mini_imagenet/maml_conv4_1xb105_mini-imagenet_5way-1shot_20211104_072004-02e6c7a7.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/maml/mini_imagenet/maml_conv4_1xb105_mini-imagenet_5way-1shot.log.json) | -| [conv4](/configs/classification/maml/mini_imagenet/maml_conv4_1xb105_mini-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 63.88 | 0.39 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/maml/mini_imagenet/maml_conv4_1xb105_mini-imagenet_5way-5shot_20211104_072004-4c336eec.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/maml/mini_imagenet/maml_conv4_1xb105_mini-imagenet_5way-5shot.log.json) | -| [resnet12](/configs/classification/maml/mini_imagenet/maml_resnet12_1xb105_mini-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 57.4 | 0.47 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/maml/mini_imagenet/maml_resnet12_1xb105_mini-imagenet_5way-1shot_20211104_105317-d1628e14.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/maml/mini_imagenet/maml_resnet12_1xb105_mini-imagenet_5way-1shot.log.json) | -| [resnet12](/configs/classification/maml/mini_imagenet/maml_resnet12_1xb105_mini-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 72.42 | 0.38 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/maml/mini_imagenet/maml_resnet12_1xb105_mini-imagenet_5way-5shot_20211104_105516-13547c7b.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/maml/mini_imagenet/maml_resnet12_1xb105_mini-imagenet_5way-5shot.log.json) | - +| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | +| :------------------------------------------------------------------------------------------------------ | :--------: | :--------: | :-: | :--: | :------: | :--: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------: | +| [conv4](/configs/classification/maml/mini_imagenet/maml_conv4_1xb105_mini-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 46.76 | 0.42 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/maml/mini_imagenet/maml_conv4_1xb105_mini-imagenet_5way-1shot_20211104_072004-02e6c7a7.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/maml/mini_imagenet/maml_conv4_1xb105_mini-imagenet_5way-1shot.log.json) | +| [conv4](/configs/classification/maml/mini_imagenet/maml_conv4_1xb105_mini-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 63.88 | 0.39 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/maml/mini_imagenet/maml_conv4_1xb105_mini-imagenet_5way-5shot_20211104_072004-4c336eec.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/maml/mini_imagenet/maml_conv4_1xb105_mini-imagenet_5way-5shot.log.json) | +| [resnet12](/configs/classification/maml/mini_imagenet/maml_resnet12_1xb105_mini-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 57.4 | 0.47 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/maml/mini_imagenet/maml_resnet12_1xb105_mini-imagenet_5way-1shot_20211104_105317-d1628e14.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/maml/mini_imagenet/maml_resnet12_1xb105_mini-imagenet_5way-1shot.log.json) | +| [resnet12](/configs/classification/maml/mini_imagenet/maml_resnet12_1xb105_mini-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 72.42 | 0.38 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/maml/mini_imagenet/maml_resnet12_1xb105_mini-imagenet_5way-5shot_20211104_105516-13547c7b.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/maml/mini_imagenet/maml_resnet12_1xb105_mini-imagenet_5way-5shot.log.json) | ## Results on Tiered-ImageNet dataset with 2000 episodes -| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | -| :-------------- | :-----------: | :------: | :------: | :------: | :------: | :------: |:------: |:------: | -| [conv4](/configs/classification/maml/tiered_imagenet/maml_conv4_1xb105_tiered-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 45.56 | 0.49 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/maml/tiered_imagenet/maml_conv4_1xb105_tiered-imagenet_5way-1shot_20211104_110055-a08f6d09.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/maml/tiered_imagenet/maml_conv4_1xb105_tiered-imagenet_5way-1shot.log.json) | -| [conv4](/configs/classification/maml/tiered_imagenet/maml_conv4_1xb105_tiered-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 60.2 | 0.43 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/maml/tiered_imagenet/maml_conv4_1xb105_tiered-imagenet_5way-5shot_20211104_110734-88a559bc.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/maml/tiered_imagenet/maml_conv4_1xb105_tiered-imagenet_5way-5shot.log.json) | -| [resnet12](/configs/classification/maml/tiered_imagenet/maml_resnet12_1xb105_tiered-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 57.63 | 0.53 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/maml/tiered_imagenet/maml_resnet12_1xb105_tiered-imagenet_5way-1shot_20211104_115442-340cb23f.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/maml/tiered_imagenet/maml_resnet12_1xb105_tiered-imagenet_5way-1shot.log.json) | -| [resnet12](/configs/classification/maml/tiered_imagenet/maml_resnet12_1xb105_tiered-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 72.3 | 0.43 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/maml/tiered_imagenet/maml_resnet12_1xb105_tiered-imagenet_5way-5shot_20211104_115442-95920719.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/maml/tiered_imagenet/maml_resnet12_1xb105_tiered-imagenet_5way-5shot.log.json) | +| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | +| :---------------------------------------------------------------------------------------------------------- | :--------: | :--------: | :-: | :--: | :------: | :--: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------: | +| [conv4](/configs/classification/maml/tiered_imagenet/maml_conv4_1xb105_tiered-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 45.56 | 0.49 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/maml/tiered_imagenet/maml_conv4_1xb105_tiered-imagenet_5way-1shot_20211104_110055-a08f6d09.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/maml/tiered_imagenet/maml_conv4_1xb105_tiered-imagenet_5way-1shot.log.json) | +| [conv4](/configs/classification/maml/tiered_imagenet/maml_conv4_1xb105_tiered-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 60.2 | 0.43 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/maml/tiered_imagenet/maml_conv4_1xb105_tiered-imagenet_5way-5shot_20211104_110734-88a559bc.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/maml/tiered_imagenet/maml_conv4_1xb105_tiered-imagenet_5way-5shot.log.json) | +| [resnet12](/configs/classification/maml/tiered_imagenet/maml_resnet12_1xb105_tiered-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 57.63 | 0.53 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/maml/tiered_imagenet/maml_resnet12_1xb105_tiered-imagenet_5way-1shot_20211104_115442-340cb23f.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/maml/tiered_imagenet/maml_resnet12_1xb105_tiered-imagenet_5way-1shot.log.json) | +| [resnet12](/configs/classification/maml/tiered_imagenet/maml_resnet12_1xb105_tiered-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 72.3 | 0.43 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/maml/tiered_imagenet/maml_resnet12_1xb105_tiered-imagenet_5way-5shot_20211104_115442-95920719.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/maml/tiered_imagenet/maml_resnet12_1xb105_tiered-imagenet_5way-5shot.log.json) | diff --git a/configs/classification/matching_net/README.md b/configs/classification/matching_net/README.md index e8f0153..864c1fe 100644 --- a/configs/classification/matching_net/README.md +++ b/configs/classification/matching_net/README.md @@ -3,6 +3,7 @@ ## Abstract + Learning from a few examples remains a key challenge in machine learning. Despite recent advances in important domains such as vision and language, the standard supervised deep learning paradigm does not offer a satisfactory solution @@ -18,12 +19,11 @@ We also demonstrate the usefulness of the same model on language modeling by introducing a one-shot task on the Penn Treebank. +
- - ## Citation @@ -37,19 +37,22 @@ introducing a one-shot task on the Penn Treebank. year={2016} } ``` + ## How to Reproduce MatchingNet It consists of two steps: + - **Step1: Base training** - - use all the images of base classes to train a base model. - - conduct meta testing on validation set to select the best model. -- **Step2: Meta Testing**: - - use best model from step1, the best model are saved into `${WORK_DIR}/${CONFIG}/best_accuracy_mean.pth` in default. + - use all the images of base classes to train a base model. + - conduct meta testing on validation set to select the best model. +- **Step2: Meta Testing**: + - use best model from step1, the best model are saved into `${WORK_DIR}/${CONFIG}/best_accuracy_mean.pth` in default. ### An example of CUB dataset with Conv4 + ```bash # base training python ./tools/classification/train.py \ @@ -62,6 +65,7 @@ python ./tools/classification/test.py \ ``` **Note**: + - All the result are trained with single gpu. - The configs of 1 shot and 5 shot use same training setting, but different meta test setting on validation set and test set. @@ -73,30 +77,29 @@ python ./tools/classification/test.py \ Anyway, we will continue to improve it. - The training batch size is calculated by `num_support_way` * (`num_support_shots` + `num_query_shots`) - ## Results on CUB dataset with 2000 episodes -| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | -| :-------------- | :-----------: | :------: | :------: | :------: | :------: | :------: |:------: |:------: | -| [conv4](/configs/classification/matching_net/cub/matching-net_conv4_1xb105_cub_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 63.65 | 0.5 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/matching_net/cub/matching-net_conv4_1xb105_cub_5way-1shot_20211120_100611-dfc09deb.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/matching_net/cub/matching-net_conv4_1xb105_cub_5way-1shot.log.json) | -| [conv4](/configs/classification/matching_net/cub/matching-net_conv4_1xb105_cub_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 76.88 | 0.39 | ⇑ | ⇑ | -| [resnet12](/configs/classification/matching_net/cub/matching-net_resnet12_1xb105_cub_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 78.33 | 0.45 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/matching_net/cub/matching-net_resnet12_1xb105_cub_5way-1shot_20211120_100611-d396459d.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/matching_net/cub/matching-net_resnet12_1xb105_cub_5way-1shot.log.json) | -| [resnet12](/configs/classification/matching_net/cub/matching-net_resnet12_1xb105_cub_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 88.98 | 0.26 | ⇑ | ⇑ | +| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | +| :-------------------------------------------------------------------------------------------------- | :--------: | :--------: | :-: | :--: | :------: | :--: | :-------------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------: | +| [conv4](/configs/classification/matching_net/cub/matching-net_conv4_1xb105_cub_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 63.65 | 0.5 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/matching_net/cub/matching-net_conv4_1xb105_cub_5way-1shot_20211120_100611-dfc09deb.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/matching_net/cub/matching-net_conv4_1xb105_cub_5way-1shot.log.json) | +| [conv4](/configs/classification/matching_net/cub/matching-net_conv4_1xb105_cub_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 76.88 | 0.39 | ⇑ | ⇑ | +| [resnet12](/configs/classification/matching_net/cub/matching-net_resnet12_1xb105_cub_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 78.33 | 0.45 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/matching_net/cub/matching-net_resnet12_1xb105_cub_5way-1shot_20211120_100611-d396459d.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/matching_net/cub/matching-net_resnet12_1xb105_cub_5way-1shot.log.json) | +| [resnet12](/configs/classification/matching_net/cub/matching-net_resnet12_1xb105_cub_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 88.98 | 0.26 | ⇑ | ⇑ | ## Results on Mini-ImageNet dataset with 2000 episodes -| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | -| :-------------- | :-----------: | :------: | :------: | :------: | :------: | :------: |:------: |:------: | -| [conv4](/configs/classification/matching_net/mini_imagenet/matching-net_conv4_1xb105_mini-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 53.35 | 0.44 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/matching_net/mini_imagenet/matching-net_conv4_1xb105_mini-imagenet_5way-1shot_20211120_100611-cfc24845.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/matching_net/mini_imagenet/matching-net_conv4_1xb105_mini-imagenet_5way-1shot.log.json) | -| [conv4](/configs/classification/matching_net/mini_imagenet/matching-net_conv4_1xb105_mini-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 66.3 | 0.38 | ⇑ | ⇑ | -| [resnet12](/configs/classification/matching_net/mini_imagenet/matching-net_resnet12_1xb105_mini-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 59.3 | 0.45 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/matching_net/mini_imagenet/matching-net_resnet12_1xb105_mini-imagenet_5way-1shot_20211120_100611-62e83016.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/matching_net/mini_imagenet/matching-net_resnet12_1xb105_mini-imagenet_5way-1shot.log.json) | -| [resnet12](/configs/classification/matching_net/mini_imagenet/matching-net_resnet12_1xb105_mini-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 72.63 | 0.36 | ⇑ | ⇑ | +| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | +| :---------------------------------------------------------------------------------------------------------------------- | :--------: | :--------: | :-: | :--: | :------: | :--: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------: | +| [conv4](/configs/classification/matching_net/mini_imagenet/matching-net_conv4_1xb105_mini-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 53.35 | 0.44 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/matching_net/mini_imagenet/matching-net_conv4_1xb105_mini-imagenet_5way-1shot_20211120_100611-cfc24845.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/matching_net/mini_imagenet/matching-net_conv4_1xb105_mini-imagenet_5way-1shot.log.json) | +| [conv4](/configs/classification/matching_net/mini_imagenet/matching-net_conv4_1xb105_mini-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 66.3 | 0.38 | ⇑ | ⇑ | +| [resnet12](/configs/classification/matching_net/mini_imagenet/matching-net_resnet12_1xb105_mini-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 59.3 | 0.45 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/matching_net/mini_imagenet/matching-net_resnet12_1xb105_mini-imagenet_5way-1shot_20211120_100611-62e83016.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/matching_net/mini_imagenet/matching-net_resnet12_1xb105_mini-imagenet_5way-1shot.log.json) | +| [resnet12](/configs/classification/matching_net/mini_imagenet/matching-net_resnet12_1xb105_mini-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 72.63 | 0.36 | ⇑ | ⇑ | ## Results on Tiered-ImageNet dataset with 2000 episodes -| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | -| :-------------- | :-----------: | :------: | :------: | :------: | :------: | :------: |:------: |:------: | -| [conv4](/configs/classification/matching_net/tiered_imagenet/matching-net_conv4_1xb105_tiered-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 48.20 | 0.48 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/matching_net/tiered_imagenet/matching-net_conv4_1xb105_tiered-imagenet_5way-1shot_20211120_100611-e70e9548.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/matching_net/tiered_imagenet/matching-net_conv4_1xb105_tiered-imagenet_5way-1shot.log.json) | -| [conv4](/configs/classification/matching_net/tiered_imagenet/matching-net_conv4_1xb105_tiered-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 61.19 | 0.43 | ⇑ | ⇑ | -| [resnet12](/configs/classification/matching_net/tiered_imagenet/matching-net_resnet12_1xb105_tiered-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 58.97 | 0.52 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/matching_net/tiered_imagenet/matching-net_resnet12_1xb105_tiered-imagenet_5way-1shot_20211120_100611-90c3124c.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/matching_net/tiered_imagenet/matching-net_resnet12_1xb105_tiered-imagenet_5way-1shot.log.json) | -| [resnet12](/configs/classification/matching_net/tiered_imagenet/matching-net_resnet12_1xb105_tiered-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 72.1 | 0.45 | ⇑ | ⇑ | +| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | +| :-------------------------------------------------------------------------------------------------------------------------- | :--------: | :--------: | :-: | :--: | :------: | :--: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------: | +| [conv4](/configs/classification/matching_net/tiered_imagenet/matching-net_conv4_1xb105_tiered-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 48.20 | 0.48 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/matching_net/tiered_imagenet/matching-net_conv4_1xb105_tiered-imagenet_5way-1shot_20211120_100611-e70e9548.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/matching_net/tiered_imagenet/matching-net_conv4_1xb105_tiered-imagenet_5way-1shot.log.json) | +| [conv4](/configs/classification/matching_net/tiered_imagenet/matching-net_conv4_1xb105_tiered-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 61.19 | 0.43 | ⇑ | ⇑ | +| [resnet12](/configs/classification/matching_net/tiered_imagenet/matching-net_resnet12_1xb105_tiered-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 58.97 | 0.52 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/matching_net/tiered_imagenet/matching-net_resnet12_1xb105_tiered-imagenet_5way-1shot_20211120_100611-90c3124c.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/matching_net/tiered_imagenet/matching-net_resnet12_1xb105_tiered-imagenet_5way-1shot.log.json) | +| [resnet12](/configs/classification/matching_net/tiered_imagenet/matching-net_resnet12_1xb105_tiered-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 72.1 | 0.45 | ⇑ | ⇑ | diff --git a/configs/classification/meta_baseline/README.md b/configs/classification/meta_baseline/README.md index 5cb2513..ec2f389 100644 --- a/configs/classification/meta_baseline/README.md +++ b/configs/classification/meta_baseline/README.md @@ -3,6 +3,7 @@ ## Abstract + Meta-learning has been the most common framework for few-shot learning in recent years. It learns the model from collections of few-shot classification tasks, which is believed @@ -23,17 +24,16 @@ the trade-offs between the meta-learning objective and the whole-classification objective in few-shot learning. Our code is available at https://github.com/yinboc/few-shot-meta-baseline. - +
- - ## Citation + ```bibtex @inproceedings{chen2021meta, title={Meta-Baseline: Exploring Simple Meta-Learning for Few-Shot Learning}, @@ -47,17 +47,18 @@ code is available at https://github.com/yinboc/few-shot-meta-baseline. ## How to Reproduce Meta Baseline It consists of three steps: + - **Step1: Baseline Base training** - - use all the images of base classes to train a base model with linear head. - - conduct meta testing on validation set to select the best model. + - use all the images of base classes to train a base model with linear head. + - conduct meta testing on validation set to select the best model. - **Step2: Meta Baseline Base training** - - use all the images of base classes to train a base model with meta metric. - - conduct meta testing on validation set to select the best model. + - use all the images of base classes to train a base model with meta metric. + - conduct meta testing on validation set to select the best model. - **Step3: Meta Testing**: - - use best model from step1. - + - use best model from step1. ### An example of CUB dataset with Conv4 + ```bash # baseline base training python ./tools/classification/train.py \ @@ -75,6 +76,7 @@ python ./tools/classification/test.py \ ``` **Note**: + - All the result are trained with single gpu. - The configs of 1 shot and 5 shot use same training setting, but different meta test setting on validation set and test set. @@ -86,31 +88,29 @@ python ./tools/classification/test.py \ Anyway, we will continue to improve it. - The training batch size is calculated by `num_support_way` * (`num_support_shots` + `num_query_shots`) - - ## Results on CUB dataset with 2000 episodes -| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | -| :-------------- | :-----------: | :------: | :------: | :------: | :------: | :------: |:------: |:------: | -| [conv4](/configs/classification/meta_baseline/cub/meta-baseline_conv4_1xb100_cub_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 58.98 | 0.47 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/meta_baseline/cub/meta-baseline_conv4_1xb100_cub_5way-1shot_20211120_191622-bd94fc3c.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/meta_baseline/cub/meta-baseline_conv4_1xb100_cub_5way-1shot20211120_191622.log.json) | -| [conv4](/configs/classification/meta_baseline/cub/meta-baseline_conv4_1xb100_cub_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 75.77 | 0.37 | ⇑ | ⇑ | -| [resnet12](/configs/classification/meta_baseline/cub/meta-baseline_resnet12_1xb100_cub_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 78.16 | 0.43 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/meta_baseline/cub/meta-baseline_resnet12_1xb100_cub_5way-1shot_20211120_191622-8978c781.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/meta_baseline/cub/meta-baseline_resnet12_1xb100_cub_5way-1shot20211120_191622.log.json) | -| [resnet12](/configs/classification/meta_baseline/cub/meta-baseline_resnet12_1xb100_cub_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 90.4 | 0.23 | ⇑ | ⇑ | +| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | +| :---------------------------------------------------------------------------------------------------- | :--------: | :--------: | :-: | :--: | :------: | :--: | :---------------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------: | +| [conv4](/configs/classification/meta_baseline/cub/meta-baseline_conv4_1xb100_cub_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 58.98 | 0.47 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/meta_baseline/cub/meta-baseline_conv4_1xb100_cub_5way-1shot_20211120_191622-bd94fc3c.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/meta_baseline/cub/meta-baseline_conv4_1xb100_cub_5way-1shot20211120_191622.log.json) | +| [conv4](/configs/classification/meta_baseline/cub/meta-baseline_conv4_1xb100_cub_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 75.77 | 0.37 | ⇑ | ⇑ | +| [resnet12](/configs/classification/meta_baseline/cub/meta-baseline_resnet12_1xb100_cub_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 78.16 | 0.43 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/meta_baseline/cub/meta-baseline_resnet12_1xb100_cub_5way-1shot_20211120_191622-8978c781.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/meta_baseline/cub/meta-baseline_resnet12_1xb100_cub_5way-1shot20211120_191622.log.json) | +| [resnet12](/configs/classification/meta_baseline/cub/meta-baseline_resnet12_1xb100_cub_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 90.4 | 0.23 | ⇑ | ⇑ | ## Results on Mini-ImageNet dataset with 2000 episodes -| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | -| :-------------- | :-----------: | :------: | :------: | :------: | :------: | :------: |:------: |:------: | -| [conv4](/configs/classification/meta_baseline/mini_imagenet/meta-baseline_conv4_1xb100_mini-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 51.35 | 0.42 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/meta_baseline/mini_imagenet/meta-baseline_conv4_1xb100_mini-imagenet_5way-1shot_20211120_191622-3ff1f837.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/meta_baseline/mini_imagenet/meta-baseline_conv4_1xb100_mini-imagenet_5way-1shot.log.json) | -| [conv4](/configs/classification/meta_baseline/mini_imagenet/meta-baseline_conv4_1xb100_mini-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 66.99 | 0.37 | ⇑ | ⇑ | -| [resnet12](/configs/classification/meta_baseline/mini_imagenet/meta-baseline_resnet12_1xb100_mini-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 64.53 | 0.45 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/meta_baseline/mini_imagenet/meta-baseline_resnet12_1xb100_mini-imagenet_5way-1shot_20211120_191622-70ecdc79.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/meta_baseline/mini_imagenet/meta-baseline_resnet12_1xb100_mini-imagenet_5way-1shot.log.json) | -| [resnet12](/configs/classification/meta_baseline/mini_imagenet/meta-baseline_resnet12_1xb100_mini-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 81.41 | 0.31 | ⇑ | ⇑ | +| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | +| :------------------------------------------------------------------------------------------------------------------------ | :--------: | :--------: | :-: | :--: | :------: | :--: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------: | +| [conv4](/configs/classification/meta_baseline/mini_imagenet/meta-baseline_conv4_1xb100_mini-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 51.35 | 0.42 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/meta_baseline/mini_imagenet/meta-baseline_conv4_1xb100_mini-imagenet_5way-1shot_20211120_191622-3ff1f837.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/meta_baseline/mini_imagenet/meta-baseline_conv4_1xb100_mini-imagenet_5way-1shot.log.json) | +| [conv4](/configs/classification/meta_baseline/mini_imagenet/meta-baseline_conv4_1xb100_mini-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 66.99 | 0.37 | ⇑ | ⇑ | +| [resnet12](/configs/classification/meta_baseline/mini_imagenet/meta-baseline_resnet12_1xb100_mini-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 64.53 | 0.45 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/meta_baseline/mini_imagenet/meta-baseline_resnet12_1xb100_mini-imagenet_5way-1shot_20211120_191622-70ecdc79.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/meta_baseline/mini_imagenet/meta-baseline_resnet12_1xb100_mini-imagenet_5way-1shot.log.json) | +| [resnet12](/configs/classification/meta_baseline/mini_imagenet/meta-baseline_resnet12_1xb100_mini-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 81.41 | 0.31 | ⇑ | ⇑ | ## Results on Tiered-ImageNet dataset with 2000 episodes -| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | -| :-------------- | :-----------: | :------: | :------: | :------: | :------: | :------: |:------: |:------: | -| [conv4](/configs/classification/meta_baseline/tiered_imagenet/meta-baseline_conv4_1xb100_tiered-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 53.09 | 0.48 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/meta_baseline/tiered_imagenet/meta-baseline_conv4_1xb100_tiered-imagenet_5way-1shot_20211120_230843-e9c196e3.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/meta_baseline/tiered_imagenet/meta-baseline_conv4_1xb100_tiered-imagenet_5way-1shot.log.json) | -| [conv4](/configs/classification/meta_baseline/tiered_imagenet/meta-baseline_conv4_1xb100_tiered-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 67.85 | 0.43 | ⇑ | ⇑ | -| [resnet12](/configs/classification/meta_baseline/tiered_imagenet/meta-baseline_resnet12_1xb100_tiered-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 65.59 | 0.52 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/meta_baseline/tiered_imagenet/meta-baseline_resnet12_1xb100_tiered-imagenet_5way-1shot_20211120_230843-6f3a6e7e.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/meta_baseline/tiered_imagenet/meta-baseline_resnet12_1xb100_tiered-imagenet_5way-1shot.log.json) | -| [resnet12](/configs/classification/meta_baseline/tiered_imagenet/meta-baseline_resnet12_1xb100_tiered-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 79.13 | 0.41 | ⇑ | ⇑ | +| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | +| :---------------------------------------------------------------------------------------------------------------------------- | :--------: | :--------: | :-: | :--: | :------: | :--: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------: | +| [conv4](/configs/classification/meta_baseline/tiered_imagenet/meta-baseline_conv4_1xb100_tiered-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 53.09 | 0.48 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/meta_baseline/tiered_imagenet/meta-baseline_conv4_1xb100_tiered-imagenet_5way-1shot_20211120_230843-e9c196e3.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/meta_baseline/tiered_imagenet/meta-baseline_conv4_1xb100_tiered-imagenet_5way-1shot.log.json) | +| [conv4](/configs/classification/meta_baseline/tiered_imagenet/meta-baseline_conv4_1xb100_tiered-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 67.85 | 0.43 | ⇑ | ⇑ | +| [resnet12](/configs/classification/meta_baseline/tiered_imagenet/meta-baseline_resnet12_1xb100_tiered-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 65.59 | 0.52 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/meta_baseline/tiered_imagenet/meta-baseline_resnet12_1xb100_tiered-imagenet_5way-1shot_20211120_230843-6f3a6e7e.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/meta_baseline/tiered_imagenet/meta-baseline_resnet12_1xb100_tiered-imagenet_5way-1shot.log.json) | +| [resnet12](/configs/classification/meta_baseline/tiered_imagenet/meta-baseline_resnet12_1xb100_tiered-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 79.13 | 0.41 | ⇑ | ⇑ | diff --git a/configs/classification/neg_margin/README.md b/configs/classification/neg_margin/README.md index 3386f3f..87c3f01 100644 --- a/configs/classification/neg_margin/README.md +++ b/configs/classification/neg_margin/README.md @@ -14,17 +14,16 @@ theoretically. We find that although negative margin reduces the feature discrim thus benefit the discrimination of novel classes. Code is available at https://github.com/bl0/negative-margin.few-shot. - +
- - ## Citation + ```bibtex @inproceedings{liu2020negative, title={Negative margin matters: Understanding margin in few-shot classification}, @@ -38,16 +37,18 @@ https://github.com/bl0/negative-margin.few-shot. ## How to Reproduce Neg-Margin It consists of two steps: + - **Step1: Base training** - - use all the images of base classes to train a base model. - - conduct meta testing on validation set to select the best model. -- **Step2: Meta Testing**: - - use best model from step1, the best model are saved into `${WORK_DIR}/${CONFIG}/best_accuracy_mean.pth` in default. + - use all the images of base classes to train a base model. + - conduct meta testing on validation set to select the best model. +- **Step2: Meta Testing**: + - use best model from step1, the best model are saved into `${WORK_DIR}/${CONFIG}/best_accuracy_mean.pth` in default. ### An example of CUB dataset with Conv4 + ```bash # base training python ./tools/classification/train.py \ @@ -60,6 +61,7 @@ python ./tools/classification/test.py \ ``` **Note**: + - All the result are trained with single gpu. - The configs of 1 shot and 5 shot use same training setting, but different meta test setting on validation set and test set. @@ -72,27 +74,27 @@ python ./tools/classification/test.py \ ## Results on CUB dataset with 2000 episodes -| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | -| :-------------- | :-----------: | :------: | :------: | :------: | :------: | :------: |:------: |:------: | -| [conv4](/configs/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 64.08 | 0.48 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot_20211120_100620-5415a152.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot.log.json) | -| [conv4](/configs/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 5 | 80.69 | 0.34 | ⇑ | ⇑ | -| [resnet12](/configs/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 78.54 | 0.46 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/neg_margin/cub/neg-margin_cosine_resnet12_1xb64_cub_5way-1shot_20211120_100620-b4ab9cc1.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/neg_margin/cub/neg-margin_cosine_resnet12_1xb64_cub_5way-1shot.log.json) | -| [resnet12](/configs/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 5 | 90.19 | 0.24 | ⇑ | ⇑ | +| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | +| :------------------------------------------------------------------------------------------------- | :--------: | :--------: | :-: | :--: | :------: | :--: | :---------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------: | +| [conv4](/configs/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 64.08 | 0.48 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot_20211120_100620-5415a152.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot.log.json) | +| [conv4](/configs/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 5 | 80.69 | 0.34 | ⇑ | ⇑ | +| [resnet12](/configs/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 78.54 | 0.46 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/neg_margin/cub/neg-margin_cosine_resnet12_1xb64_cub_5way-1shot_20211120_100620-b4ab9cc1.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/neg_margin/cub/neg-margin_cosine_resnet12_1xb64_cub_5way-1shot.log.json) | +| [resnet12](/configs/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 5 | 90.19 | 0.24 | ⇑ | ⇑ | ## Results on Mini ImageNet dataset with 2000 episodes -| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | -| :-------------- | :-----------: | :------: | :------: | :------: | :------: | :------: |:------: |:------: | -| [conv4](/configs/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 51.15 | 0.42 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/neg_margin/mini_imagenet/neg-margin_cosine_conv4_1xb64_mini-imagenet_5way-1shot_20211120_104933-8a1340d3.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/neg_margin/mini_imagenet/neg-margin_cosine_conv4_1xb64_mini-imagenet_5way-1shot.log.json) | -| [conv4](/configs/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 5 | 67.32 | 0.37 | ⇑ | ⇑ | -| [resnet12](/configs/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 61.7 | 0.46 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/neg_margin/mini_imagenet/neg-margin_cosine_resnet12_1xb64_mini-imagenet_5way-1shot_20211120_110018-e3aae9b5.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/neg_margin/mini_imagenet/neg-margin_cosine_resnet12_1xb64_mini-imagenet_5way-1shot.log.json) | -| [resnet12](/configs/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 5 | 78.03 | 0.33 | ⇑ | ⇑ | +| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | +| :------------------------------------------------------------------------------------------------- | :--------: | :--------: | :-: | :--: | :------: | :--: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------: | +| [conv4](/configs/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 51.15 | 0.42 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/neg_margin/mini_imagenet/neg-margin_cosine_conv4_1xb64_mini-imagenet_5way-1shot_20211120_104933-8a1340d3.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/neg_margin/mini_imagenet/neg-margin_cosine_conv4_1xb64_mini-imagenet_5way-1shot.log.json) | +| [conv4](/configs/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 5 | 67.32 | 0.37 | ⇑ | ⇑ | +| [resnet12](/configs/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 61.7 | 0.46 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/neg_margin/mini_imagenet/neg-margin_cosine_resnet12_1xb64_mini-imagenet_5way-1shot_20211120_110018-e3aae9b5.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/neg_margin/mini_imagenet/neg-margin_cosine_resnet12_1xb64_mini-imagenet_5way-1shot.log.json) | +| [resnet12](/configs/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 5 | 78.03 | 0.33 | ⇑ | ⇑ | ## Results on Tiered ImageNet dataset with 2000 episodes -| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | -| :-------------- | :-----------: | :------: | :------: | :------: | :------: | :------: |:------: |:------: | -| [conv4](/configs/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 54.07 | 0.49 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/neg_margin/tiered_imagenet/neg-margin_cosine_conv4_1xb64_tiered-imagenet_5way-1shot_20211120_110238-7a81ac2a.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/neg_margin/tiered_imagenet/neg-margin_cosine_conv4_1xb64_tiered-imagenet_5way-1shot.log.json) | -| [conv4](/configs/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 5 | 70.25 | 0.41 | ⇑ | ⇑ | -| [resnet12](/configs/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 65.88 | 0.53 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/neg_margin/tiered_imagenet/neg-margin_cosine_resnet12_1xb64_tiered-imagenet_5way-1shot_20211120_111912-344342e6.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/neg_margin/tiered_imagenet/neg-margin_cosine_resnet12_1xb64_tiered-imagenet_5way-1shot.log.json) | -| [resnet12](/configs/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 5 | 81.06 | 0.39 | ⇑ | ⇑ | +| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | +| :------------------------------------------------------------------------------------------------- | :--------: | :--------: | :-: | :--: | :------: | :--: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------: | +| [conv4](/configs/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 54.07 | 0.49 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/neg_margin/tiered_imagenet/neg-margin_cosine_conv4_1xb64_tiered-imagenet_5way-1shot_20211120_110238-7a81ac2a.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/neg_margin/tiered_imagenet/neg-margin_cosine_conv4_1xb64_tiered-imagenet_5way-1shot.log.json) | +| [conv4](/configs/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 5 | 70.25 | 0.41 | ⇑ | ⇑ | +| [resnet12](/configs/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 1 | 65.88 | 0.53 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/neg_margin/tiered_imagenet/neg-margin_cosine_resnet12_1xb64_tiered-imagenet_5way-1shot_20211120_111912-344342e6.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/neg_margin/tiered_imagenet/neg-margin_cosine_resnet12_1xb64_tiered-imagenet_5way-1shot.log.json) | +| [resnet12](/configs/classification/neg_margin/cub/neg-margin_cosine_conv4_1xb64_cub_5way-1shot.py) | 84x84 | 64 | 5 | 5 | 81.06 | 0.39 | ⇑ | ⇑ | diff --git a/configs/classification/proto_net/README.md b/configs/classification/proto_net/README.md index c0beab4..c03edf1 100644 --- a/configs/classification/proto_net/README.md +++ b/configs/classification/proto_net/README.md @@ -15,16 +15,15 @@ further extend prototypical networks to zero-shot learning and achieve state-of- results on the CU-Birds dataset. +
- - ## Citation - + ```bibtex @inproceedings{snell2017prototypical, title={Prototypical networks for few-shot learning}, @@ -34,19 +33,22 @@ results on the CU-Birds dataset. year={2017} } ``` + ## How to Reproduce ProtoNet It consists of two steps: + - **Step1: Base training** - - use all the images of base classes to train a base model. - - conduct meta testing on validation set to select the best model. -- **Step2: Meta Testing**: - - use best model from step1, the best model are saved into `${WORK_DIR}/${CONFIG}/best_accuracy_mean.pth` in default. + - use all the images of base classes to train a base model. + - conduct meta testing on validation set to select the best model. +- **Step2: Meta Testing**: + - use best model from step1, the best model are saved into `${WORK_DIR}/${CONFIG}/best_accuracy_mean.pth` in default. ### An example of CUB dataset with Conv4 + ```bash # base training python ./tools/classification/train.py \ @@ -59,6 +61,7 @@ python ./tools/classification/test.py \ ``` **Note**: + - All the result are trained with single gpu. - The config of 1 shot and 5 shot use same training setting, but different meta test setting on validation set and test set. @@ -70,31 +73,29 @@ python ./tools/classification/test.py \ Anyway, we will continue to improve it. - The training batch size is calculated by `num_support_way` * (`num_support_shots` + `num_query_shots`) - - ## Results on CUB dataset with 2000 episodes -| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | -| :-------------- | :-----------: | :------: | :------: | :------: | :------: | :------: |:------: |:------: | -| [conv4](/configs/classification/proto_net/cub/proto-net_conv4_1xb105_cub_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 58.86 | 0.52 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/proto_net/cub/proto-net_conv4_1xb105_cub_5way-1shot_20211120_101211-9ab530c3.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/proto_net/cub/proto-net_conv4_1xb105_cub_5way-1shot.log.json) | -| [conv4](/configs/classification/proto_net/cub/proto-net_conv4_1xb105_cub_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 80.77 | 0.34 | ⇑ | ⇑ | -| [resnet12](/configs/classification/proto_net/cub/proto-net_resnet12_1xb105_cub_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 74.35 | 0.48 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/proto_net/cub/proto-net_resnet12_1xb105_cub_5way-1shot_20211120_101211-da5bfb99.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/proto_net/cub/proto-net_resnet12_1xb105_cub_5way-1shot.log.json) | -| [resnet12](/configs/classification/proto_net/cub/proto-net_resnet12_1xb105_cub_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 88.5 | 0.25 | ⇑ | ⇑ | +| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | +| :-------------------------------------------------------------------------------------------- | :--------: | :--------: | :-: | :--: | :------: | :--: | :-------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------: | +| [conv4](/configs/classification/proto_net/cub/proto-net_conv4_1xb105_cub_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 58.86 | 0.52 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/proto_net/cub/proto-net_conv4_1xb105_cub_5way-1shot_20211120_101211-9ab530c3.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/proto_net/cub/proto-net_conv4_1xb105_cub_5way-1shot.log.json) | +| [conv4](/configs/classification/proto_net/cub/proto-net_conv4_1xb105_cub_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 80.77 | 0.34 | ⇑ | ⇑ | +| [resnet12](/configs/classification/proto_net/cub/proto-net_resnet12_1xb105_cub_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 74.35 | 0.48 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/proto_net/cub/proto-net_resnet12_1xb105_cub_5way-1shot_20211120_101211-da5bfb99.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/proto_net/cub/proto-net_resnet12_1xb105_cub_5way-1shot.log.json) | +| [resnet12](/configs/classification/proto_net/cub/proto-net_resnet12_1xb105_cub_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 88.5 | 0.25 | ⇑ | ⇑ | ## Results on Mini-ImageNet dataset with 2000 episodes -| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | -| :-------------- | :-----------: | :------: | :------: | :------: | :------: | :------: |:------: |:------: | -| [conv4](/configs/classification/proto_net/mini_imagenet/proto-net_conv4_1xb105_mini-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 48.11 | 0.43 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/proto_net/mini_imagenet/proto-net_conv4_1xb105_mini-imagenet_5way-1shot_20211120_134319-646809cf.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/proto_net/mini_imagenet/proto-net_conv4_1xb105_mini-imagenet_5way-1shot.log.json) | -| [conv4](/configs/classification/proto_net/mini_imagenet/proto-net_conv4_1xb105_mini-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 68.51 | 0.37 | ⇑ | ⇑ | -| [resnet12](/configs/classification/proto_net/mini_imagenet/proto-net_resnet12_1xb105_mini-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 56.13 | 0.45 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/proto_net/mini_imagenet/proto-net_resnet12_1xb105_mini-imagenet_5way-1shot_20211120_134319-73173bee.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/proto_net/mini_imagenet/proto-net_resnet12_1xb105_mini-imagenet_5way-1shot.log.json) | -| [resnet12](/configs/classification/proto_net/mini_imagenet/proto-net_resnet12_1xb105_mini-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 75.7 | 0.33 | ⇑ | ⇑ | +| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | +| :---------------------------------------------------------------------------------------------------------------- | :--------: | :--------: | :-: | :--: | :------: | :--: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------: | +| [conv4](/configs/classification/proto_net/mini_imagenet/proto-net_conv4_1xb105_mini-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 48.11 | 0.43 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/proto_net/mini_imagenet/proto-net_conv4_1xb105_mini-imagenet_5way-1shot_20211120_134319-646809cf.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/proto_net/mini_imagenet/proto-net_conv4_1xb105_mini-imagenet_5way-1shot.log.json) | +| [conv4](/configs/classification/proto_net/mini_imagenet/proto-net_conv4_1xb105_mini-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 68.51 | 0.37 | ⇑ | ⇑ | +| [resnet12](/configs/classification/proto_net/mini_imagenet/proto-net_resnet12_1xb105_mini-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 56.13 | 0.45 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/proto_net/mini_imagenet/proto-net_resnet12_1xb105_mini-imagenet_5way-1shot_20211120_134319-73173bee.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/proto_net/mini_imagenet/proto-net_resnet12_1xb105_mini-imagenet_5way-1shot.log.json) | +| [resnet12](/configs/classification/proto_net/mini_imagenet/proto-net_resnet12_1xb105_mini-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 75.7 | 0.33 | ⇑ | ⇑ | ## Results on Tiered-ImageNet dataset with 2000 episodes -| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | -| :-------------- | :-----------: | :------: | :------: | :------: | :------: | :------: |:------: |:------: | -| [conv4](/configs/classification/proto_net/tiered_imagenet/proto-net_conv4_1xb105_tiered-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 45.5 | 0.46 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/proto_net/tiered_imagenet/proto-net_conv4_1xb105_tiered-imagenet_5way-1shot_20211120_134742-26520ca8.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/proto_net/tiered_imagenet/proto-net_conv4_1xb105_tiered-imagenet_5way-1shot.log.json) | -| [conv4](/configs/classification/proto_net/tiered_imagenet/proto-net_conv4_1xb105_tiered-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 62.89 | 0.43 | ⇑ | ⇑ | -| [resnet12](/configs/classification/proto_net/tiered_imagenet/proto-net_resnet12_1xb105_tiered-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 59.11 | 0.52 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/proto_net/tiered_imagenet/proto-net_resnet12_1xb105_tiered-imagenet_5way-1shot_20211120_153230-eb72884e.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/proto_net/tiered_imagenet/proto-net_resnet12_1xb105_tiered-imagenet_5way-1shot.log.json) | -| [resnet12](/configs/classification/proto_net/tiered_imagenet/proto-net_resnet12_1xb105_tiered-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 75.3 | 0.42 | ⇑ | ⇑ | +| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | +| :-------------------------------------------------------------------------------------------------------------------- | :--------: | :--------: | :-: | :--: | :------: | :--: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------: | +| [conv4](/configs/classification/proto_net/tiered_imagenet/proto-net_conv4_1xb105_tiered-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 45.5 | 0.46 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/proto_net/tiered_imagenet/proto-net_conv4_1xb105_tiered-imagenet_5way-1shot_20211120_134742-26520ca8.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/proto_net/tiered_imagenet/proto-net_conv4_1xb105_tiered-imagenet_5way-1shot.log.json) | +| [conv4](/configs/classification/proto_net/tiered_imagenet/proto-net_conv4_1xb105_tiered-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 62.89 | 0.43 | ⇑ | ⇑ | +| [resnet12](/configs/classification/proto_net/tiered_imagenet/proto-net_resnet12_1xb105_tiered-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 59.11 | 0.52 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/proto_net/tiered_imagenet/proto-net_resnet12_1xb105_tiered-imagenet_5way-1shot_20211120_153230-eb72884e.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/proto_net/tiered_imagenet/proto-net_resnet12_1xb105_tiered-imagenet_5way-1shot.log.json) | +| [resnet12](/configs/classification/proto_net/tiered_imagenet/proto-net_resnet12_1xb105_tiered-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 75.3 | 0.42 | ⇑ | ⇑ | diff --git a/configs/classification/relation_net/README.md b/configs/classification/relation_net/README.md index e16f3d3..7fef41c 100644 --- a/configs/classification/relation_net/README.md +++ b/configs/classification/relation_net/README.md @@ -18,16 +18,15 @@ Extensive experiments on five benchmarks demonstrate that our simple approach provides a unified and effective approach for both of these two tasks. +
- - ## Citation - + ```bibtex @inproceedings{sung2018learning, title={Learning to compare: Relation network for few-shot learning}, @@ -41,16 +40,18 @@ our simple approach provides a unified and effective approach for both of these ## How to Reproduce RelationNet It consists of two steps: + - **Step1: Base training** - - use all the images of base classes to train a base model. - - conduct meta testing on validation set to select the best model. -- **Step2: Meta Testing**: - - use best model from step1, the best model are saved into `${WORK_DIR}/${CONFIG}/best_accuracy_mean.pth` in default. + - use all the images of base classes to train a base model. + - conduct meta testing on validation set to select the best model. +- **Step2: Meta Testing**: + - use best model from step1, the best model are saved into `${WORK_DIR}/${CONFIG}/best_accuracy_mean.pth` in default. ### An example of CUB dataset with Conv4 + ```bash # base training python ./tools/classification/train.py \ @@ -63,6 +64,7 @@ python ./tools/classification/test.py \ ``` **Note**: + - All the result are trained with single gpu. - The config of 1 shot and 5 shot use same training setting, but different meta test setting on validation set and test set. @@ -74,31 +76,29 @@ python ./tools/classification/test.py \ Anyway, we will continue to improve it. - The training batch size is calculated by `num_support_way` * (`num_support_shots` + `num_query_shots`) - - ## Results on CUB dataset with 2000 episodes -| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | -| :-------------- | :-----------: | :------: | :------: | :------: | :------: | :------: |:------: |:------: | -| [conv4](/configs/classification/relation_net/cub/relation-net_conv4_1xb105_cub_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 65.53 | 0.51 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/relation_net/cub/relation-net_conv4_1xb105_cub_5way-1shot_20211120_101425-63bfa087.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/relation_net/cub/relation-net_conv4_1xb105_cub_5way-1shot.log.json) | -| [conv4](/configs/classification/relation_net/cub/relation-net_conv4_1xb105_cub_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 82.05 | 0.34 | ⇑ | ⇑ | -| [resnet12](/configs/classification/relation_net/cub/relation-net_resnet12_1xb105_cub_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 73.22 | 0.48 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/relation_net/cub/relation-net_resnet12_1xb105_cub_5way-1shot_20211120_101425-d67efa62.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/relation_net/cub/relation-net_resnet12_1xb105_cub_5way-1shot.log.json) | -| [resnet12](/configs/classification/relation_net/cub/relation-net_resnet12_1xb105_cub_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 86.94 | 0.28 | ⇑ | ⇑ | +| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | +| :-------------------------------------------------------------------------------------------------- | :--------: | :--------: | :-: | :--: | :------: | :--: | :-------------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------: | +| [conv4](/configs/classification/relation_net/cub/relation-net_conv4_1xb105_cub_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 65.53 | 0.51 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/relation_net/cub/relation-net_conv4_1xb105_cub_5way-1shot_20211120_101425-63bfa087.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/relation_net/cub/relation-net_conv4_1xb105_cub_5way-1shot.log.json) | +| [conv4](/configs/classification/relation_net/cub/relation-net_conv4_1xb105_cub_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 82.05 | 0.34 | ⇑ | ⇑ | +| [resnet12](/configs/classification/relation_net/cub/relation-net_resnet12_1xb105_cub_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 73.22 | 0.48 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/relation_net/cub/relation-net_resnet12_1xb105_cub_5way-1shot_20211120_101425-d67efa62.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/relation_net/cub/relation-net_resnet12_1xb105_cub_5way-1shot.log.json) | +| [resnet12](/configs/classification/relation_net/cub/relation-net_resnet12_1xb105_cub_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 86.94 | 0.28 | ⇑ | ⇑ | ## Results on Mini-ImageNet dataset with 2000 episodes -| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | -| :-------------- | :-----------: | :------: | :------: | :------: | :------: | :------: |:------: |:------: | -| [conv4](/configs/classification/relation_net/mini_imagenet/relation-net_conv4_1xb105_mini-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 49.69 | 0.43 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/relation_net/mini_imagenet/relation-net_conv4_1xb105_mini-imagenet_5way-1shot_20211120_105359-c4256d35.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/relation_net/mini_imagenet/relation-net_conv4_1xb105_mini-imagenet_5way-1shot.log.json) | -| [conv4](/configs/classification/relation_net/mini_imagenet/relation-net_conv4_1xb105_mini-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 68.14 | 0.37 | ⇑ | ⇑ | -| [resnet12](/configs/classification/relation_net/mini_imagenet/relation-net_resnet12_1xb105_mini-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 54.12 | 0.46 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/relation_net/mini_imagenet/relation-net_resnet12_1xb105_mini-imagenet_5way-1shot_20211120_110716-c73a3f81.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/relation_net/mini_imagenet/relation-net_resnet12_1xb105_mini-imagenet_5way-1shot.log.json) | -| [resnet12](/configs/classification/relation_net/mini_imagenet/relation-net_resnet12_1xb105_mini-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 71.31 | 0.37 | ⇑ | ⇑ | +| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | +| :---------------------------------------------------------------------------------------------------------------------- | :--------: | :--------: | :-: | :--: | :------: | :--: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------: | +| [conv4](/configs/classification/relation_net/mini_imagenet/relation-net_conv4_1xb105_mini-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 49.69 | 0.43 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/relation_net/mini_imagenet/relation-net_conv4_1xb105_mini-imagenet_5way-1shot_20211120_105359-c4256d35.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/relation_net/mini_imagenet/relation-net_conv4_1xb105_mini-imagenet_5way-1shot.log.json) | +| [conv4](/configs/classification/relation_net/mini_imagenet/relation-net_conv4_1xb105_mini-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 68.14 | 0.37 | ⇑ | ⇑ | +| [resnet12](/configs/classification/relation_net/mini_imagenet/relation-net_resnet12_1xb105_mini-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 54.12 | 0.46 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/relation_net/mini_imagenet/relation-net_resnet12_1xb105_mini-imagenet_5way-1shot_20211120_110716-c73a3f81.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/relation_net/mini_imagenet/relation-net_resnet12_1xb105_mini-imagenet_5way-1shot.log.json) | +| [resnet12](/configs/classification/relation_net/mini_imagenet/relation-net_resnet12_1xb105_mini-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 71.31 | 0.37 | ⇑ | ⇑ | ## Results on Tiered-ImageNet dataset with 2000 episodes -| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | -| :-------------- | :-----------: | :------: | :------: | :------: | :------: | :------: |:------: |:------: | -| [conv4](/configs/classification/relation_net/tiered_imagenet/relation-net_conv4_1xb105_tiered-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 47.6 | 0.48 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/relation_net/tiered_imagenet/relation-net_conv4_1xb105_tiered-imagenet_5way-1shot_20211120_141404-b41abf4d.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/relation_net/tiered_imagenet/relation-net_conv4_1xb105_tiered-imagenet_5way-1shot.log.json) | -| [conv4](/configs/classification/relation_net/tiered_imagenet/relation-net_conv4_1xb105_tiered-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 64.09 | 0.43 | ⇑ | ⇑ | -| [resnet12](/configs/classification/relation_net/tiered_imagenet/relation-net_resnet12_1xb105_tiered-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 57.46 | 0.52 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/relation_net/tiered_imagenet/relation-net_resnet12_1xb105_tiered-imagenet_5way-1shot_20211120_145035-7df8c4d3.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/relation_net/tiered_imagenet/relation-net_resnet12_1xb105_tiered-imagenet_5way-1shot.log.json) | -| [resnet12](/configs/classification/relation_net/tiered_imagenet/relation-net_resnet12_1xb105_tiered-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 72.84 | 0.43 | ⇑ | ⇑ | +| Arch | Input Size | Batch Size | way | shot | mean Acc | std | ckpt | log | +| :-------------------------------------------------------------------------------------------------------------------------- | :--------: | :--------: | :-: | :--: | :------: | :--: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------: | +| [conv4](/configs/classification/relation_net/tiered_imagenet/relation-net_conv4_1xb105_tiered-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 47.6 | 0.48 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/relation_net/tiered_imagenet/relation-net_conv4_1xb105_tiered-imagenet_5way-1shot_20211120_141404-b41abf4d.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/relation_net/tiered_imagenet/relation-net_conv4_1xb105_tiered-imagenet_5way-1shot.log.json) | +| [conv4](/configs/classification/relation_net/tiered_imagenet/relation-net_conv4_1xb105_tiered-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 64.09 | 0.43 | ⇑ | ⇑ | +| [resnet12](/configs/classification/relation_net/tiered_imagenet/relation-net_resnet12_1xb105_tiered-imagenet_5way-1shot.py) | 84x84 | 105 | 5 | 1 | 57.46 | 0.52 | [ckpt](https://download.openmmlab.com/mmfewshot/classification/relation_net/tiered_imagenet/relation-net_resnet12_1xb105_tiered-imagenet_5way-1shot_20211120_145035-7df8c4d3.pth) | [log](https://download.openmmlab.com/mmfewshot/classification/relation_net/tiered_imagenet/relation-net_resnet12_1xb105_tiered-imagenet_5way-1shot.log.json) | +| [resnet12](/configs/classification/relation_net/tiered_imagenet/relation-net_resnet12_1xb105_tiered-imagenet_5way-5shot.py) | 84x84 | 105 | 5 | 5 | 72.84 | 0.43 | ⇑ | ⇑ | diff --git a/configs/detection/README.md b/configs/detection/README.md index 2d59157..e758d31 100644 --- a/configs/detection/README.md +++ b/configs/detection/README.md @@ -1,8 +1,10 @@ # Few Shot Detection ## Get Started + If you're new of mmfewshot, you can check out [Get Started](https://mmfewshot.readthedocs.io/en/latest/index.html) and [Detection Tutorials](https://mmfewshot.readthedocs.io/en/latest/detection/index.html) to try out MMFewShot. ## Data Preparation + Please follow [DATA Preparation](https://github.com/open-mmlab/mmfewshot/tree/main/tools/data/detection) to prepare data. diff --git a/configs/detection/attention_rpn/README.md b/configs/detection/attention_rpn/README.md index 8f2a170..dfe1c55 100644 --- a/configs/detection/attention_rpn/README.md +++ b/configs/detection/attention_rpn/README.md @@ -1,6 +1,5 @@ # Few-Shot Object Detection with Attention-RPN and Multi-Relation Detector (CVPR'2020) - ## Abstract @@ -27,16 +26,15 @@ on different datasets in the few-shot setting. The dataset link is https://github.com/fanq15/Few-Shot-Object-Detection-Dataset. +
- - ## Citation - + ```bibtex @inproceedings{fan2020fsod, title={Few-Shot Object Detection with Attention-RPN and Multi-Relation Detector}, @@ -50,18 +48,17 @@ dataset link is https://github.com/fanq15/Few-Shot-Object-Detection-Dataset. Currently, each setting is only evaluated with one fixed few shot dataset. Please refer to [DATA Preparation](https://github.com/open-mmlab/mmfewshot/tree/main/tools/data/detection) to get more details about the dataset and data preparation. - - ## How to reproduce Attention RPN - Following the original implementation, it consists of 2 steps: + - **Step1: Base training** - - use all the images and annotations of base classes to train a base model. + + - use all the images and annotations of base classes to train a base model. - **Step2: Few shot fine-tuning**: - - use the base model from step1 as model initialization and further fine tune the model with few shot datasets. + - use the base model from step1 as model initialization and further fine tune the model with few shot datasets. ### An example of VOC split1 1 shot setting with 8 gpus @@ -76,16 +73,16 @@ bash ./tools/detection/dist_train.sh \ ``` **Note**: + - The default output path of base model in step1 is set to `work_dirs/{BASE TRAINING CONFIG}/latest.pth`. When the model is saved to different path, please update the argument `load_from` in step2 few shot fine-tune configs instead of using `resume_from`. - To use pre-trained checkpoint, please set the `load_from` to the downloaded checkpoint path. - - ## Results on VOC dataset **Note**: + - The paper doesn't conduct experiments of VOC dataset. Therefore, we use the VOC setting of [TFA](https://github.com/ucbdrive/few-shot-object-detection/blob/main/datasets/README.md) to evaluate the method. - Some implementation details should be noticed: @@ -96,42 +93,38 @@ bash ./tools/detection/dist_train.sh \ To reproduce the reported few shot results, it is highly recommended using the released model for few shot fine-tuning. - The difficult samples will not be used in base training or few shot setting. - ### Base Training -| Arch | Split | Base AP50 | ckpt | log | -| :------: | :-----------: | :------: | :------: |:------: | -| [r50 c4](/configs/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_base-training.py) | 1 | 71.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_base-training_20211101_003606-58a8f413.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_base-training.log.json) | -| [r50 c4](/configs/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_base-training.py) | 2 | 73.5 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_base-training_20211101_040647-04570ae0.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_base-training.log.json) | -| [r50 c4](/configs/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_base-training.py) | 3 | 73.4 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_base-training_20211101_073701-5672bea8.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_base-training.log.json) | - - +| Arch | Split | Base AP50 | ckpt | log | +| :----------------------------------------------------------------------------------------------------: | :---: | :-------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------: | +| [r50 c4](/configs/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_base-training.py) | 1 | 71.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_base-training_20211101_003606-58a8f413.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_base-training.log.json) | +| [r50 c4](/configs/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_base-training.py) | 2 | 73.5 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_base-training_20211101_040647-04570ae0.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_base-training.log.json) | +| [r50 c4](/configs/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_base-training.py) | 3 | 73.4 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_base-training_20211101_073701-5672bea8.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_base-training.log.json) | ### Few Shot Finetuning -| Arch | Split | Shot | Novel AP50 | ckpt | log | -| :--------------: | :-----------: | :------: | :------: |:------: |:------: | -| [r50 c4](/configs/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_1shot-fine-tuning.py) | 1 | 1 | 35.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_1shot-fine-tuning_20211107_224317-45e76f46.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_1shot-fine-tuning.log.json) | -| [r50 c4](/configs/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_2shot-fine-tuning.py) | 1 | 2 | 36.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_2shot-fine-tuning_20211107_231154-e6209cb6.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_2shot-fine-tuning.log.json) | -| [r50 c4](/configs/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_3shot-fine-tuning.py) | 1 | 3 | 39.1 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_3shot-fine-tuning_20211107_234134-ca895b22.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_3shot-fine-tuning.log.json) | -| [r50 c4](/configs/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_5shot-fine-tuning.py) | 1 | 5 | 51.7 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_5shot-fine-tuning_20211108_001145-457dd542.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_5shot-fine-tuning.log.json) | -| [r50 c4](/configs/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_10shot-fine-tuning.py) | 1 | 10 | 55.7 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_10shot-fine-tuning_20211108_004314-7c558c09.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_10shot-fine-tuning.log.json) | -| [r50 c4](/configs/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_1shot-fine-tuning.py) | 2 | 1 | 20.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_1shot-fine-tuning_20211108_011609-87114fa4.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_1shot-fine-tuning.log.json) | -| [r50 c4](/configs/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_2shot-fine-tuning.py) | 2 | 2 | 23.4 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_2shot-fine-tuning_20211108_014442-9043a914.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_2shot-fine-tuning.log.json) | -| [r50 c4](/configs/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_3shot-fine-tuning.py) | 2 | 3 | 35.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_3shot-fine-tuning_20211102_004726-dfd9d7bb.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_3shot-fine-tuning.log.json) | -| [r50 c4](/configs/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_5shot-fine-tuning.py) | 2 | 5 | 37.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_5shot-fine-tuning_20211102_011753-2ec1f244.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_5shot-fine-tuning.log.json) | -| [r50 c4](/configs/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_10shot-fine-tuning.py) | 2 | 10 | 43.3 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_10shot-fine-tuning_20211102_015202-e914016b.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_10shot-fine-tuning.log.json) | -| [r50 c4](/configs/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_1shot-fine-tuning.py) | 3 | 1 | 31.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_1shot-fine-tuning_20211102_022503-b47a5610.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_1shot-fine-tuning.log.json) | -| [r50 c4](/configs/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_2shot-fine-tuning.py) | 3 | 2 | 30.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_2shot-fine-tuning_20211102_025331-7a4d4e9b.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_2shot-fine-tuning.log.json) | -| [r50 c4](/configs/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_3shot-fine-tuning.py) | 3 | 3 | 38.2 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_3shot-fine-tuning_20211102_032300-6a3c6fb4.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_3shot-fine-tuning.log.json) | -| [r50 c4](/configs/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_5shot-fine-tuning.py) | 3 | 5 | 48.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_5shot-fine-tuning_20211102_035311-1420872c.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_5shot-fine-tuning.log.json) | -| [r50 c4](/configs/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_10shot-fine-tuning.py) | 3 | 10 | 51.6 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_10shot-fine-tuning_20211102_042423-6724602a.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_10shot-fine-tuning.log.json) | - - +| Arch | Split | Shot | Novel AP50 | ckpt | log | +| :---------------------------------------------------------------------------------------------------------: | :---: | :--: | :--------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------: | +| [r50 c4](/configs/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_1shot-fine-tuning.py) | 1 | 1 | 35.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_1shot-fine-tuning_20211107_224317-45e76f46.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_1shot-fine-tuning.log.json) | +| [r50 c4](/configs/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_2shot-fine-tuning.py) | 1 | 2 | 36.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_2shot-fine-tuning_20211107_231154-e6209cb6.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_2shot-fine-tuning.log.json) | +| [r50 c4](/configs/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_3shot-fine-tuning.py) | 1 | 3 | 39.1 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_3shot-fine-tuning_20211107_234134-ca895b22.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_3shot-fine-tuning.log.json) | +| [r50 c4](/configs/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_5shot-fine-tuning.py) | 1 | 5 | 51.7 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_5shot-fine-tuning_20211108_001145-457dd542.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_5shot-fine-tuning.log.json) | +| [r50 c4](/configs/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_10shot-fine-tuning.py) | 1 | 10 | 55.7 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_10shot-fine-tuning_20211108_004314-7c558c09.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split1/attention-rpn_r50_c4_voc-split1_10shot-fine-tuning.log.json) | +| [r50 c4](/configs/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_1shot-fine-tuning.py) | 2 | 1 | 20.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_1shot-fine-tuning_20211108_011609-87114fa4.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_1shot-fine-tuning.log.json) | +| [r50 c4](/configs/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_2shot-fine-tuning.py) | 2 | 2 | 23.4 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_2shot-fine-tuning_20211108_014442-9043a914.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_2shot-fine-tuning.log.json) | +| [r50 c4](/configs/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_3shot-fine-tuning.py) | 2 | 3 | 35.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_3shot-fine-tuning_20211102_004726-dfd9d7bb.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_3shot-fine-tuning.log.json) | +| [r50 c4](/configs/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_5shot-fine-tuning.py) | 2 | 5 | 37.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_5shot-fine-tuning_20211102_011753-2ec1f244.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_5shot-fine-tuning.log.json) | +| [r50 c4](/configs/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_10shot-fine-tuning.py) | 2 | 10 | 43.3 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_10shot-fine-tuning_20211102_015202-e914016b.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split2/attention-rpn_r50_c4_voc-split2_10shot-fine-tuning.log.json) | +| [r50 c4](/configs/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_1shot-fine-tuning.py) | 3 | 1 | 31.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_1shot-fine-tuning_20211102_022503-b47a5610.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_1shot-fine-tuning.log.json) | +| [r50 c4](/configs/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_2shot-fine-tuning.py) | 3 | 2 | 30.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_2shot-fine-tuning_20211102_025331-7a4d4e9b.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_2shot-fine-tuning.log.json) | +| [r50 c4](/configs/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_3shot-fine-tuning.py) | 3 | 3 | 38.2 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_3shot-fine-tuning_20211102_032300-6a3c6fb4.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_3shot-fine-tuning.log.json) | +| [r50 c4](/configs/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_5shot-fine-tuning.py) | 3 | 5 | 48.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_5shot-fine-tuning_20211102_035311-1420872c.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_5shot-fine-tuning.log.json) | +| [r50 c4](/configs/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_10shot-fine-tuning.py) | 3 | 10 | 51.6 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_10shot-fine-tuning_20211102_042423-6724602a.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/voc/split3/attention-rpn_r50_c4_voc-split3_10shot-fine-tuning.log.json) | ## Results on COCO dataset **Note**: + - Following the original implementation, the training batch size are 4x2 for all the COCO experiments. - The official implementation use different COCO data split from TFA, and we report the results of both setting. To reproduce the result following official data split (coco 17), please refer to [Data Preparation](https://github.com/open-mmlab/mmfewshot/tree/main/tools/data/detection/coco) to get more details about data preparation. @@ -140,16 +133,15 @@ bash ./tools/detection/dist_train.sh \ ### Base Training -| Arch | data source| Base mAP | ckpt | log | -| :------: | :-----------: | :------: | :------: |:------: | -| [r50 c4](/configs/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_base-training.py) | [TFA](https://github.com/ucbdrive/few-shot-object-detection/blob/master/datasets/README.md) | 23.6 |[ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_base-training_20211102_003348-da28cdfd.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_base-training.log.json) | -| [r50 c4](/configs/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_official-base-training.py) | [official repo](https://github.com/fanq15/FewX/tree/master/datasets) | 24.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_official-base-training_20211102_003347-f9e2dab0.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_official-base-training.log.json) | - +| Arch | data source | Base mAP | ckpt | log | +| :------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------: | :------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------: | +| [r50 c4](/configs/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_base-training.py) | [TFA](https://github.com/ucbdrive/few-shot-object-detection/blob/master/datasets/README.md) | 23.6 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_base-training_20211102_003348-da28cdfd.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_base-training.log.json) | +| [r50 c4](/configs/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_official-base-training.py) | [official repo](https://github.com/fanq15/FewX/tree/master/datasets) | 24.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_official-base-training_20211102_003347-f9e2dab0.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_official-base-training.log.json) | ### Few Shot Finetuning -| Arch | data source| Shot | Novel mAP | ckpt | log | -| :--------------: | :--------------: | :-----------: | :------: |:------: |:------: | -| [r50 c4](/configs/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_10shot-fine-tuning.py) | [TFA](https://github.com/ucbdrive/few-shot-object-detection/blob/master/datasets/README.md) | 10 | 9.2 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_10shot-fine-tuning_20211103_003801-94ec8ada.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_10shot-fine-tuning.log.json) | -| [r50 c4](/configs/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_30shot-fine-tuning.py) | [TFA](https://github.com/ucbdrive/few-shot-object-detection/blob/master/datasets/README.md) | 30 | 14.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_30shot-fine-tuning_20211103_010800-50611991.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_30shot-fine-tuning.log.json) | -| [r50 c4](/configs/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_10shot-fine-tuning.py) | [official repo](https://github.com/fanq15/FewX/tree/master/datasets) | 10 | 11.6 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_official-10shot-fine-tuning_20211107_214729-6d046301.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_official-10shot-fine-tuning.log.json) | +| Arch | data source | Shot | Novel mAP | ckpt | log | +| :--------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------: | :--: | :-------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------: | +| [r50 c4](/configs/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_10shot-fine-tuning.py) | [TFA](https://github.com/ucbdrive/few-shot-object-detection/blob/master/datasets/README.md) | 10 | 9.2 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_10shot-fine-tuning_20211103_003801-94ec8ada.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_10shot-fine-tuning.log.json) | +| [r50 c4](/configs/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_30shot-fine-tuning.py) | [TFA](https://github.com/ucbdrive/few-shot-object-detection/blob/master/datasets/README.md) | 30 | 14.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_30shot-fine-tuning_20211103_010800-50611991.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_30shot-fine-tuning.log.json) | +| [r50 c4](/configs/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_10shot-fine-tuning.py) | [official repo](https://github.com/fanq15/FewX/tree/master/datasets) | 10 | 11.6 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_official-10shot-fine-tuning_20211107_214729-6d046301.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_official-10shot-fine-tuning.log.json) | diff --git a/configs/detection/fsce/README.md b/configs/detection/fsce/README.md index b6777fe..e34cc34 100644 --- a/configs/detection/fsce/README.md +++ b/configs/detection/fsce/README.md @@ -1,10 +1,9 @@ # FSCE: Few-Shot Object Detection via Contrastive Proposal Encoding (CVPR'2021) - - ## Abstract + Emerging interests have been brought to recognize previously unseen objects given very few training examples, known as few-shot object detection (FSOD). Recent researches demonstrate that good feature embedding is the key to reach favorable few-shot learning performance. @@ -24,15 +23,15 @@ loss (CPE loss). Our design outperforms current state-ofthe-art works in any sho +8.8% on standard benchmark PASCAL VOC and +2.7% on challenging COCO benchmark. Code is available at: https://github.com/bsun0802/FSCE.git +
- - ## Citation + ```bibteN @inproceedings{sun2021fsce, title={FSCE: Few-Shot Object Detection via Contrastive Proposal Encoding}, @@ -46,22 +45,23 @@ loss (CPE loss). Our design outperforms current state-ofthe-art works in any sho Currently, each setting is only evaluated with one fiNed few shot dataset. Please refer to [here](https://github.com/open-mmlab/mmfewshot/tree/main/tools/data/detection) to get more details about the dataset and data preparation. - ## How to reproduce FSCE - Following the original implementation, it consists of 3 steps: + - **Step1: Base training** - - use all the images and annotations of base classes to train a base model. + + - use all the images and annotations of base classes to train a base model. - **Step2: Reshape the bbox head of base model**: - - create a new bbox head for all classes fine-tuning (base classes + novel classes) - - the weights of base class in new bbox head directly use the original one as initialization. - - the weights of novel class in new bbox head use random initialization. + + - create a new bbox head for all classes fine-tuning (base classes + novel classes) + - the weights of base class in new bbox head directly use the original one as initialization. + - the weights of novel class in new bbox head use random initialization. - **Step3: Few shot fine-tuning**: - - use the base model from step2 as model initialization and further fine tune the bbox head with few shot datasets. + - use the base model from step2 as model initialization and further fine tune the bbox head with few shot datasets. ### An example of VOC split1 1 shot setting with 8 gpus @@ -82,24 +82,24 @@ bash ./tools/detection/dist_train.sh \ ``` **Note**: + - The default output path of the reshaped base model in step2 is set to `work_dirs/{BASE TRAINING CONFIG}/base_model_random_init_bbox_head.pth`. When the model is saved to different path, please update the argument `load_from` in step3 few shot fine-tune configs instead of using `resume_from`. - To use pre-trained checkpoint, please set the `load_from` to the downloaded checkpoint path. - ## Results on VOC dataset ### Base Training -| arch | contrastive loss| Split | Base AP50 | ckpt(step1) | ckpt(step2) | log | -| :------: | :-----------: | :-----------: | :------: | :------: | :------: |:------: | -| [r101_fpn](/configs/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_base-training.py) | N | 1 | 80.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_base-training_20211031_114821-efbd13e9.pth) | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_base-training_20211031_114821_random-init-bbox-head-1e681852.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_base-training.log.json) | -| [r101_fpn](/configs/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_base-training.py) | N | 2 | 82.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_base-training_20211031_114820-d47f8ef9.pth) | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_base-training_20211031_114820_random-init-bbox-head-3d4c632c.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_base-training.log.json) | -| [r101_fpn](/configs/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_base-training.py) | N | 3 | 82.1 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_base-training_20211031_114840-fd8a9864.pth) | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_base-training_20211031_114840_random-init-bbox-head-9bb8c09b.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_base-training.log.json) | - +| arch | contrastive loss | Split | Base AP50 | ckpt(step1) | ckpt(step2) | log | +| :--------------------------------------------------------------------------------------: | :--------------: | :---: | :-------: | :------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | +| [r101_fpn](/configs/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_base-training.py) | N | 1 | 80.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_base-training_20211031_114821-efbd13e9.pth) | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_base-training_20211031_114821_random-init-bbox-head-1e681852.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_base-training.log.json) | +| [r101_fpn](/configs/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_base-training.py) | N | 2 | 82.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_base-training_20211031_114820-d47f8ef9.pth) | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_base-training_20211031_114820_random-init-bbox-head-3d4c632c.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_base-training.log.json) | +| [r101_fpn](/configs/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_base-training.py) | N | 3 | 82.1 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_base-training_20211031_114840-fd8a9864.pth) | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_base-training_20211031_114840_random-init-bbox-head-9bb8c09b.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_base-training.log.json) | **Note**: + - All the base training configs is the same as [TFA](https://github.com/open-mmlab/mmfewshot/tree/main/configs/detection/fsce/README.md). Therefore, the few shot fine-tuning can directly reuse the reshaped base model of fsce by creating a symlink or copying the whole checkpoint to the corresponding folder. @@ -114,37 +114,37 @@ bash ./tools/detection/dist_train.sh \ - To reproduce the reported few shot results, it is highly recommended using the released step2 model for few shot fine-tuning. - The difficult samples will be used in base training, but not be used in few shot setting. - ### Few Shot Fine-tuning -| arch | contrastive loss| Split | Shot | Base AP50 | Novel AP50 | ckpt | log | -| :--------------: | :-----------: | :-----------: | :------: | :------: | :------: |:------: |:------: | -| [r101_fpn](/configs/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_1shot-fine-tuning.py) | N | 1 | 1 | 78.4 | 41.2 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_1shot-fine-tuning_20211101_145649-fa1f3164.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_1shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_2shot-fine-tuning.py) | N | 1 | 2 | 77.8 | 51.1 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_2shot-fine-tuning_20211101_151949-cc763dba.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_2shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_3shot-fine-tuning.py) | N | 1 | 3 | 76.1 | 49.3 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_3shot-fine-tuning_20211101_174521-2d12c41b.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_3shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_5shot-fine-tuning.py) | N | 1 | 5 | 75.9 | 59.4 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_5shot-fine-tuning_20211101_181628-3e6bb8fe.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_5shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_10shot-fine-tuning.py) | N | 1 | 10| 76.4 | 62.6 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_10shot-fine-tuning_20211101_185037-b8635ce5.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_10shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/fsce/voc/split1/fsce_r101_fpn_contrastive-loss_voc-split1_3shot-fine-tuning.py) | Y | 1 | 3 | 75.0 | 48.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_contrastive-loss_voc-split1_3shot-fine-tuning_20211101_154514-59838a14.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_contrastive-loss_voc-split1_3shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/fsce/voc/split1/fsce_r101_fpn_contrastive-loss_voc-split1_5shot-fine-tuning.py) | Y | 1 | 5 | 75.0 | 58.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_contrastive-loss_voc-split1_5shot-fine-tuning_20211101_161702-67cc5b36.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_contrastive-loss_voc-split1_5shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/fsce/voc/split1/fsce_r101_fpn_contrastive-loss_voc-split1_10shot-fine-tuning.py) | Y | 1 | 10| 75.5 | 63.3 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_contrastive-loss_voc-split1_10shot-fine-tuning_20211101_165137-833012d3.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_contrastive-loss_voc-split1_10shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_1shot-fine-tuning.py) | N | 2 | 1 | 79.8 | 25.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_1shot-fine-tuning_20211101_194330-9aca29bf.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_1shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_2shot-fine-tuning.py) | N | 2 | 2 | 78.0 | 30.6 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_2shot-fine-tuning_20211101_195856-3e4cbf81.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_2shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_3shot-fine-tuning.py) | N | 2 | 3 | 76.4 | 43.4 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_3shot-fine-tuning_20211101_221253-c3cb1bc5.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_3shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_5shot-fine-tuning.py) | N | 2 | 5 | 77.2 | 45.3 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_5shot-fine-tuning_20211101_224701-36a1b478.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_5shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_10shot-fine-tuning.py) | N | 2 | 10| 77.5 | 50.4 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_10shot-fine-tuning_20211101_232105-3f91d0cc.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_10shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/fsce/voc/split2/fsce_r101_fpn_contrastive-loss_voc-split2_3shot-fine-tuning.py) | Y | 2 | 3 | 76.3 | 43.3 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_contrastive-loss_voc-split2_3shot-fine-tuning_20211101_201853-665e5ffb.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_contrastive-loss_voc-split2_3shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/fsce/voc/split2/fsce_r101_fpn_contrastive-loss_voc-split2_5shot-fine-tuning.py) | Y | 2 | 5 | 76.6 | 45.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_contrastive-loss_voc-split2_5shot-fine-tuning_20211101_205345-cfedd8c2.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_contrastive-loss_voc-split2_5shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/fsce/voc/split2/fsce_r101_fpn_contrastive-loss_voc-split2_10shot-fine-tuning.py) | Y | 2 | 10| 76.8 | 50.4 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_contrastive-loss_voc-split2_10shot-fine-tuning_20211101_212829-afca4e8e.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_contrastive-loss_voc-split2_10shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_1shot-fine-tuning.py) | N | 3 | 1 | 79.0 | 39.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_1shot-fine-tuning_20211101_145152-5ad96c55.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_1shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_2shot-fine-tuning.py) | N | 3 | 2 | 78.4 | 41.5 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_2shot-fine-tuning_20211101_151930-77eb48e7.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_2shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_3shot-fine-tuning.py) | N | 3 | 3 | 76.1 | 47.1 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_3shot-fine-tuning_20211101_180143-0e3f0471.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_3shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_5shot-fine-tuning.py) | N | 3 | 5 | 77.4 | 54.1 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_5shot-fine-tuning_20211101_183836-b25db64d.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_5shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_10shot-fine-tuning.py) | N | 3 | 10| 77.7 | 57.4 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_10shot-fine-tuning_20211101_192133-f56834f6.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_10shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/fsce/voc/split3/fsce_r101_fpn_contrastive-loss_voc-split3_3shot-fine-tuning.py) | Y | 3 | 3 | 75.6 | 48.1 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_contrastive-loss_voc-split3_3shot-fine-tuning_20211101_154634-4ba95ebb.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_contrastive-loss_voc-split3_3shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/fsce/voc/split3/fsce_r101_fpn_contrastive-loss_voc-split3_5shot-fine-tuning.py) | Y | 3 | 5 | 76.2 | 55.7 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_contrastive-loss_voc-split3_5shot-fine-tuning_20211101_162401-7b4ebf9a.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_contrastive-loss_voc-split3_5shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/fsce/voc/split3/fsce_r101_fpn_contrastive-loss_voc-split3_10shot-fine-tuning.py) | Y | 3 | 10| 77.0 | 57.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_contrastive-loss_voc-split3_10shot-fine-tuning_20211101_170749-f73f7a10.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_contrastive-loss_voc-split3_10shot-fine-tuning.log.json) | +| arch | contrastive loss | Split | Shot | Base AP50 | Novel AP50 | ckpt | log | +| :------------------------------------------------------------------------------------------------------------: | :--------------: | :---: | :--: | :-------: | :--------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------: | +| [r101_fpn](/configs/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_1shot-fine-tuning.py) | N | 1 | 1 | 78.4 | 41.2 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_1shot-fine-tuning_20211101_145649-fa1f3164.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_1shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_2shot-fine-tuning.py) | N | 1 | 2 | 77.8 | 51.1 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_2shot-fine-tuning_20211101_151949-cc763dba.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_2shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_3shot-fine-tuning.py) | N | 1 | 3 | 76.1 | 49.3 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_3shot-fine-tuning_20211101_174521-2d12c41b.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_3shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_5shot-fine-tuning.py) | N | 1 | 5 | 75.9 | 59.4 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_5shot-fine-tuning_20211101_181628-3e6bb8fe.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_5shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_10shot-fine-tuning.py) | N | 1 | 10 | 76.4 | 62.6 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_10shot-fine-tuning_20211101_185037-b8635ce5.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_voc-split1_10shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/fsce/voc/split1/fsce_r101_fpn_contrastive-loss_voc-split1_3shot-fine-tuning.py) | Y | 1 | 3 | 75.0 | 48.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_contrastive-loss_voc-split1_3shot-fine-tuning_20211101_154514-59838a14.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_contrastive-loss_voc-split1_3shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/fsce/voc/split1/fsce_r101_fpn_contrastive-loss_voc-split1_5shot-fine-tuning.py) | Y | 1 | 5 | 75.0 | 58.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_contrastive-loss_voc-split1_5shot-fine-tuning_20211101_161702-67cc5b36.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_contrastive-loss_voc-split1_5shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/fsce/voc/split1/fsce_r101_fpn_contrastive-loss_voc-split1_10shot-fine-tuning.py) | Y | 1 | 10 | 75.5 | 63.3 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_contrastive-loss_voc-split1_10shot-fine-tuning_20211101_165137-833012d3.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split1/fsce_r101_fpn_contrastive-loss_voc-split1_10shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_1shot-fine-tuning.py) | N | 2 | 1 | 79.8 | 25.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_1shot-fine-tuning_20211101_194330-9aca29bf.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_1shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_2shot-fine-tuning.py) | N | 2 | 2 | 78.0 | 30.6 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_2shot-fine-tuning_20211101_195856-3e4cbf81.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_2shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_3shot-fine-tuning.py) | N | 2 | 3 | 76.4 | 43.4 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_3shot-fine-tuning_20211101_221253-c3cb1bc5.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_3shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_5shot-fine-tuning.py) | N | 2 | 5 | 77.2 | 45.3 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_5shot-fine-tuning_20211101_224701-36a1b478.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_5shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_10shot-fine-tuning.py) | N | 2 | 10 | 77.5 | 50.4 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_10shot-fine-tuning_20211101_232105-3f91d0cc.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_voc-split2_10shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/fsce/voc/split2/fsce_r101_fpn_contrastive-loss_voc-split2_3shot-fine-tuning.py) | Y | 2 | 3 | 76.3 | 43.3 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_contrastive-loss_voc-split2_3shot-fine-tuning_20211101_201853-665e5ffb.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_contrastive-loss_voc-split2_3shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/fsce/voc/split2/fsce_r101_fpn_contrastive-loss_voc-split2_5shot-fine-tuning.py) | Y | 2 | 5 | 76.6 | 45.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_contrastive-loss_voc-split2_5shot-fine-tuning_20211101_205345-cfedd8c2.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_contrastive-loss_voc-split2_5shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/fsce/voc/split2/fsce_r101_fpn_contrastive-loss_voc-split2_10shot-fine-tuning.py) | Y | 2 | 10 | 76.8 | 50.4 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_contrastive-loss_voc-split2_10shot-fine-tuning_20211101_212829-afca4e8e.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split2/fsce_r101_fpn_contrastive-loss_voc-split2_10shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_1shot-fine-tuning.py) | N | 3 | 1 | 79.0 | 39.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_1shot-fine-tuning_20211101_145152-5ad96c55.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_1shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_2shot-fine-tuning.py) | N | 3 | 2 | 78.4 | 41.5 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_2shot-fine-tuning_20211101_151930-77eb48e7.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_2shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_3shot-fine-tuning.py) | N | 3 | 3 | 76.1 | 47.1 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_3shot-fine-tuning_20211101_180143-0e3f0471.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_3shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_5shot-fine-tuning.py) | N | 3 | 5 | 77.4 | 54.1 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_5shot-fine-tuning_20211101_183836-b25db64d.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_5shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_10shot-fine-tuning.py) | N | 3 | 10 | 77.7 | 57.4 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_10shot-fine-tuning_20211101_192133-f56834f6.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_voc-split3_10shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/fsce/voc/split3/fsce_r101_fpn_contrastive-loss_voc-split3_3shot-fine-tuning.py) | Y | 3 | 3 | 75.6 | 48.1 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_contrastive-loss_voc-split3_3shot-fine-tuning_20211101_154634-4ba95ebb.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_contrastive-loss_voc-split3_3shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/fsce/voc/split3/fsce_r101_fpn_contrastive-loss_voc-split3_5shot-fine-tuning.py) | Y | 3 | 5 | 76.2 | 55.7 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_contrastive-loss_voc-split3_5shot-fine-tuning_20211101_162401-7b4ebf9a.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_contrastive-loss_voc-split3_5shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/fsce/voc/split3/fsce_r101_fpn_contrastive-loss_voc-split3_10shot-fine-tuning.py) | Y | 3 | 10 | 77.0 | 57.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_contrastive-loss_voc-split3_10shot-fine-tuning_20211101_170749-f73f7a10.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/voc/split3/fsce_r101_fpn_contrastive-loss_voc-split3_10shot-fine-tuning.log.json) | **Note**: + - Following the original implementation, the contrastive loss only is added at VOC 3/5/10 shot setting, while in VOC 1/2 shot setting only the `fc_cls` and `fc_reg` layers are fine-tuned. - Some arguments of configs are different from the official codes, for example, the official codes use aug test @@ -154,17 +154,18 @@ bash ./tools/detection/dist_train.sh \ ### Base Training -| arch | contrastive loss| Base mAP | ckpt(step1) | ckpt(step2) | log | -| :------: | :-----------: | :------: |:------: |:------: |:------: | -| [r101_fpn](/configs/detection/fsce/coco/fsce_r101_fpn_coco_base-training.py) | N | 39.50 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/coco/tfa_r101_fpn_coco_base-training_20211102_030413-a67975c7.pth) | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/coco/tfa_r101_fpn_coco_base-training_20211102_030413_random-init-bbox-head-ea1c2981.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/coco/tfa_r101_fpn_coco_base-training.log.json) | +| arch | contrastive loss | Base mAP | ckpt(step1) | ckpt(step2) | log | +| :--------------------------------------------------------------------------: | :--------------: | :------: | :------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------: | +| [r101_fpn](/configs/detection/fsce/coco/fsce_r101_fpn_coco_base-training.py) | N | 39.50 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/coco/tfa_r101_fpn_coco_base-training_20211102_030413-a67975c7.pth) | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/coco/tfa_r101_fpn_coco_base-training_20211102_030413_random-init-bbox-head-ea1c2981.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/coco/tfa_r101_fpn_coco_base-training.log.json) | ### Few Shot Fine-tuning -| arch | shot | contrastive loss| Base mAP | Novel mAP | ckpt | log | -| :--------------: | :-----------: | :------: | :------: | :------: |:------: |:------: | -| [r101_fpn](/configs/detection/fsce/coco/fsce_r101_fpn_coco_10shot-fine-tuning.py) | 10 | N | 31.7 | 11.7 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/coco/fsce_r101_fpn_coco_10shot-fine-tuning_20211103_120353-3baa63b5.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/coco/fsce_r101_fpn_coco_10shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/fsce/coco/fsce_r101_fpn_coco_30shot-fine-tuning.py) | 30 | N | 32.3 | 16.4 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/coco/fsce_r101_fpn_coco_30shot-fine-tuning_20211103_140559-42edb8b2.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/coco/fsce_r101_fpn_coco_30shot-fine-tuning.log.json) | +| arch | shot | contrastive loss | Base mAP | Novel mAP | ckpt | log | +| :-------------------------------------------------------------------------------: | :--: | :--------------: | :------: | :-------: | :-------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------: | +| [r101_fpn](/configs/detection/fsce/coco/fsce_r101_fpn_coco_10shot-fine-tuning.py) | 10 | N | 31.7 | 11.7 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/coco/fsce_r101_fpn_coco_10shot-fine-tuning_20211103_120353-3baa63b5.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/coco/fsce_r101_fpn_coco_10shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/fsce/coco/fsce_r101_fpn_coco_30shot-fine-tuning.py) | 30 | N | 32.3 | 16.4 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsce/coco/fsce_r101_fpn_coco_30shot-fine-tuning_20211103_140559-42edb8b2.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsce/coco/fsce_r101_fpn_coco_30shot-fine-tuning.log.json) | **Note**: + - Some arguments of configs are different from the official codes, for example, the official codes use aug test in some settings, while all the results reported above do not use `aug_test`. diff --git a/configs/detection/fsdetview/README.md b/configs/detection/fsdetview/README.md index e264200..4b4b8bc 100644 --- a/configs/detection/fsdetview/README.md +++ b/configs/detection/fsdetview/README.md @@ -3,6 +3,7 @@ ## Abstract + Detecting objects and estimating their viewpoint in images are key tasks of 3D scene understanding. Recent approaches have achieved excellent results on very large benchmarks for object detection and view-point estimation. However, performances are still lagging behind for novel object categories with few samples. @@ -15,13 +16,12 @@ PASCAL VOC and MS COCO for few-shot object detection, and Pascal3D+ and ObjectNe And for the first time, we tackle the combination of both few-shot tasks, on ObjectNet3D, showing promising results. Our code and data are available at http://imagine.enpc.fr/~xiaoy/FSDetView/. - +
- ## Citation @@ -42,12 +42,14 @@ Please refer to [DATA Preparation](https://github.com/open-mmlab/mmfewshot/tree/ ## How to reproduce FSDetView Following the original implementation, it consists of 2 steps: + - **Step1: Base training** - - use all the images and annotations of base classes to train a base model. + + - use all the images and annotations of base classes to train a base model. - **Step2: Few shot fine-tuning**: - - use the base model from step1 as model initialization and further fine tune the model with few shot datasets. + - use the base model from step1 as model initialization and further fine tune the model with few shot datasets. ### An example of VOC split1 1 shot setting with 8 gpus @@ -62,17 +64,16 @@ bash ./tools/detection/dist_train.sh \ ``` **Note**: + - The default output path of the reshaped base model in step2 is set to `work_dirs/{BASE TRAINING CONFIG}/base_model_random_init_bbox_head.pth`. When the model is saved to different path, please update the argument `load_from` in step3 few shot fine-tune configs instead of using `resume_from`. - To use pre-trained checkpoint, please set the `load_from` to the downloaded checkpoint path. - - - ## Results on VOC dataset **Note**: + - The official implementation use batch size 1x4 for training, while we use batch size 8x4. - For few shot fine-tuning we only fine tune the bbox head and the iterations or training strategy may not be the optimal in 8gpu setting. @@ -81,41 +82,38 @@ bash ./tools/detection/dist_train.sh \ To reproduce the reported few shot results, it is highly recommended using the released model for few shot fine-tuning. - The difficult samples will be used in base training query set, but not be used in support set and few shot setting. - ### Base Training -| Arch | Split | Base AP50 | ckpt | log | -| :------: | :-----------: | :------: | :------: |:------: | -| [r101 c4](/configs/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_base-training.py) | 1 | 73.7 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_base-training_20211101_072143-6d1fd09d.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_base-training.log.json) | -| [r101 c4](/configs/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_base-training.py) | 2 | 74.6 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_base-training_20211101_104321-6890f5da.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_base-training.log.json) | -| [r101 c4](/configs/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_base-training.py) | 3 | 73.2 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_base-training_20211101_140448-c831f0cf.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_base-training.log.json) | - - +| Arch | Split | Base AP50 | ckpt | log | +| :---------------------------------------------------------------------------------------------------: | :---: | :-------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------: | +| [r101 c4](/configs/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_base-training.py) | 1 | 73.7 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_base-training_20211101_072143-6d1fd09d.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_base-training.log.json) | +| [r101 c4](/configs/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_base-training.py) | 2 | 74.6 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_base-training_20211101_104321-6890f5da.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_base-training.log.json) | +| [r101 c4](/configs/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_base-training.py) | 3 | 73.2 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_base-training_20211101_140448-c831f0cf.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_base-training.log.json) | ### Few Shot Fine-tuning -| Arch | Split | Shot | Base AP50 | Novel AP50 | ckpt | log | -| :-----: | :------: | :------: | :------: |:------: |:------: |:------: | -| [r101 c4](/configs/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_1shot-fine-tuning.py) | 1 | 1 | 61.1 | 35.5 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_1shot-fine-tuning_20211111_174458-7f003e09.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_1shot-fine-tuning.log.json) | -| [r101 c4](/configs/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_2shot-fine-tuning.py) | 1 | 2 | 67.9 | 49.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_2shot-fine-tuning_20211111_175533-6a218bf8.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_2shot-fine-tuning.log.json) | -| [r101 c4](/configs/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_3shot-fine-tuning.py) | 1 | 3 | 68.1 | 54.6 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_3shot-fine-tuning_20211111_181021-7fed633f.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_3shot-fine-tuning.log.json) | -| [r101 c4](/configs/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_5shot-fine-tuning.py) | 1 | 5 | 69.9 | 60.5 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_5shot-fine-tuning_20211111_183331-2bad7372.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_5shot-fine-tuning.log.json) | -| [r101 c4](/configs/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_10shot-fine-tuning.py) | 1 | 10 | 71.7 | 61.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_10shot-fine-tuning_20211111_185540-3717717b.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_10shot-fine-tuning.log.json) | -| [r101 c4](/configs/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_1shot-fine-tuning.py) | 2 | 1 | 65.0 | 27.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_1shot-fine-tuning_20211111_192244-0fb62181.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_1shot-fine-tuning.log.json) | -| [r101 c4](/configs/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_2shot-fine-tuning.py) | 2 | 2 | 69.6 | 36.6 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_2shot-fine-tuning_20211111_193302-77a3e0ed.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_2shot-fine-tuning.log.json) | -| [r101 c4](/configs/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_3shot-fine-tuning.py) | 2 | 3 | 70.9 | 41.4 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_3shot-fine-tuning_20211111_194805-a9746764.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_3shot-fine-tuning.log.json) | -| [r101 c4](/configs/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_5shot-fine-tuning.py) | 2 | 5 | 71.3 | 43.2 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_5shot-fine-tuning_20211111_201121-627d8bab.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_5shot-fine-tuning.log.json) | -| [r101 c4](/configs/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_10shot-fine-tuning.py) | 2 | 10 | 72.4 | 47.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_10shot-fine-tuning_20211111_203317-1d8371fa.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_10shot-fine-tuning.log.json) | -| [r101 c4](/configs/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_1shot-fine-tuning.py) | 3 | 1 | 61.4 | 37.3 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_1shot-fine-tuning_20211111_210030-71f567aa.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_1shot-fine-tuning.log.json) | -| [r101 c4](/configs/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_2shot-fine-tuning.py) | 3 | 2 | 69.3 | 44.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_2shot-fine-tuning_20211111_211043-903328e6.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_2shot-fine-tuning.log.json) | -| [r101 c4](/configs/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_3shot-fine-tuning.py) | 3 | 3 | 70.5 | 47.5 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_3shot-fine-tuning_20211111_212549-c2a73819.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_3shot-fine-tuning.log.json) | -| [r101 c4](/configs/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_5shot-fine-tuning.py) | 3 | 5 | 72.2 | 52.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_5shot-fine-tuning_20211111_214912-2650edee.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_5shot-fine-tuning.log.json) | -| [r101 c4](/configs/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_10shot-fine-tuning.py) | 3 | 10 | 73.1 | 52.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_10shot-fine-tuning_20211111_221125-7f2f0ddb.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_10shot-fine-tuning.log.json) | - +| Arch | Split | Shot | Base AP50 | Novel AP50 | ckpt | log | +| :--------------------------------------------------------------------------------------------------------: | :---: | :--: | :-------: | :--------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------: | +| [r101 c4](/configs/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_1shot-fine-tuning.py) | 1 | 1 | 61.1 | 35.5 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_1shot-fine-tuning_20211111_174458-7f003e09.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_1shot-fine-tuning.log.json) | +| [r101 c4](/configs/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_2shot-fine-tuning.py) | 1 | 2 | 67.9 | 49.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_2shot-fine-tuning_20211111_175533-6a218bf8.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_2shot-fine-tuning.log.json) | +| [r101 c4](/configs/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_3shot-fine-tuning.py) | 1 | 3 | 68.1 | 54.6 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_3shot-fine-tuning_20211111_181021-7fed633f.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_3shot-fine-tuning.log.json) | +| [r101 c4](/configs/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_5shot-fine-tuning.py) | 1 | 5 | 69.9 | 60.5 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_5shot-fine-tuning_20211111_183331-2bad7372.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_5shot-fine-tuning.log.json) | +| [r101 c4](/configs/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_10shot-fine-tuning.py) | 1 | 10 | 71.7 | 61.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_10shot-fine-tuning_20211111_185540-3717717b.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split1/fsdetview_r101_c4_8xb4_voc-split1_10shot-fine-tuning.log.json) | +| [r101 c4](/configs/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_1shot-fine-tuning.py) | 2 | 1 | 65.0 | 27.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_1shot-fine-tuning_20211111_192244-0fb62181.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_1shot-fine-tuning.log.json) | +| [r101 c4](/configs/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_2shot-fine-tuning.py) | 2 | 2 | 69.6 | 36.6 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_2shot-fine-tuning_20211111_193302-77a3e0ed.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_2shot-fine-tuning.log.json) | +| [r101 c4](/configs/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_3shot-fine-tuning.py) | 2 | 3 | 70.9 | 41.4 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_3shot-fine-tuning_20211111_194805-a9746764.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_3shot-fine-tuning.log.json) | +| [r101 c4](/configs/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_5shot-fine-tuning.py) | 2 | 5 | 71.3 | 43.2 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_5shot-fine-tuning_20211111_201121-627d8bab.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_5shot-fine-tuning.log.json) | +| [r101 c4](/configs/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_10shot-fine-tuning.py) | 2 | 10 | 72.4 | 47.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_10shot-fine-tuning_20211111_203317-1d8371fa.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split2/fsdetview_r101_c4_8xb4_voc-split2_10shot-fine-tuning.log.json) | +| [r101 c4](/configs/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_1shot-fine-tuning.py) | 3 | 1 | 61.4 | 37.3 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_1shot-fine-tuning_20211111_210030-71f567aa.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_1shot-fine-tuning.log.json) | +| [r101 c4](/configs/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_2shot-fine-tuning.py) | 3 | 2 | 69.3 | 44.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_2shot-fine-tuning_20211111_211043-903328e6.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_2shot-fine-tuning.log.json) | +| [r101 c4](/configs/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_3shot-fine-tuning.py) | 3 | 3 | 70.5 | 47.5 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_3shot-fine-tuning_20211111_212549-c2a73819.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_3shot-fine-tuning.log.json) | +| [r101 c4](/configs/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_5shot-fine-tuning.py) | 3 | 5 | 72.2 | 52.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_5shot-fine-tuning_20211111_214912-2650edee.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_5shot-fine-tuning.log.json) | +| [r101 c4](/configs/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_10shot-fine-tuning.py) | 3 | 10 | 73.1 | 52.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_10shot-fine-tuning_20211111_221125-7f2f0ddb.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/voc/split3/fsdetview_r101_c4_8xb4_voc-split3_10shot-fine-tuning.log.json) | ## Results on COCO dataset **Note**: + - The official implementation use batch size 1x4 for training, while we use batch size 8x4. - For few shot fine-tuning we only fine tune the bbox head and the iterations or training strategy may not be the optimal in 8gpu setting. @@ -125,15 +123,13 @@ bash ./tools/detection/dist_train.sh \ ### Base Training -| Arch | Base mAP | ckpt | log | -| :------: | :-----------: | :------: |:------: | -| [r50 c4](/configs/detection/fsdetview/coco/fsdetview_r50_c4_8xb4_coco_base-training.py) | 21.3 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/coco/fsdetview_r50_c4_8xb4_coco_base-training_20211113_011123-02c00ddc.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/coco/fsdetview_r50_c4_8xb4_coco_base-training.log.json) | - +| Arch | Base mAP | ckpt | log | +| :-------------------------------------------------------------------------------------: | :------: | :---------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------: | +| [r50 c4](/configs/detection/fsdetview/coco/fsdetview_r50_c4_8xb4_coco_base-training.py) | 21.3 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/coco/fsdetview_r50_c4_8xb4_coco_base-training_20211113_011123-02c00ddc.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/coco/fsdetview_r50_c4_8xb4_coco_base-training.log.json) | ### Few Shot Fine-tuning - -| Arch | Shot | Base mAP | Novel mAP | ckpt | log | -| :-----: | :--------: | :------: |:------: |:------: |:------: | -| [r50 c4](/configs/detection/fsdetview/coco/fsdetview_r50_c4_8xb4_coco_10shot-fine-tuning.py) | 10 | 21.1 | 9.1 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/coco/fsdetview_r50_c4_8xb4_coco_10shot-fine-tuning_20211114_002725-a3c97004.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/coco/fsdetview_r50_c4_8xb4_coco_10shot-fine-tuning.log.json) | -| [r50 c4](/configs/detection/fsdetview/coco/fsdetview_r50_c4_8xb4_coco_30shot-fine-tuning.py) | 30 | 23.5 | 12.4 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/coco/fsdetview_r50_c4_8xb4_coco_30shot-fine-tuning_20211114_022948-8e0e6378.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/coco/fsdetview_r50_c4_8xb4_coco_30shot-fine-tuning.log.json) | +| Arch | Shot | Base mAP | Novel mAP | ckpt | log | +| :------------------------------------------------------------------------------------------: | :--: | :------: | :-------: | :--------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------: | +| [r50 c4](/configs/detection/fsdetview/coco/fsdetview_r50_c4_8xb4_coco_10shot-fine-tuning.py) | 10 | 21.1 | 9.1 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/coco/fsdetview_r50_c4_8xb4_coco_10shot-fine-tuning_20211114_002725-a3c97004.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/coco/fsdetview_r50_c4_8xb4_coco_10shot-fine-tuning.log.json) | +| [r50 c4](/configs/detection/fsdetview/coco/fsdetview_r50_c4_8xb4_coco_30shot-fine-tuning.py) | 30 | 23.5 | 12.4 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/fsdetview/coco/fsdetview_r50_c4_8xb4_coco_30shot-fine-tuning_20211114_022948-8e0e6378.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/fsdetview/coco/fsdetview_r50_c4_8xb4_coco_30shot-fine-tuning.log.json) | diff --git a/configs/detection/meta_rcnn/README.md b/configs/detection/meta_rcnn/README.md index e1f4289..02c5b88 100644 --- a/configs/detection/meta_rcnn/README.md +++ b/configs/detection/meta_rcnn/README.md @@ -16,8 +16,8 @@ The vectors take channel-wise soft-attention on RoI features, remodeling those R In our experiments, Meta R-CNN yields the new state of the art in low-shot object detection and improves low-shot object segmentation by Mask R-CNN. Code: https://yanxp.github.io/metarcnn.html. - +
@@ -25,6 +25,7 @@ Code: https://yanxp.github.io/metarcnn.html. ## Citation + ```bibtex @inproceedings{yan2019meta, title={Meta r-cnn: Towards general solver for instance-level low-shot learning}, @@ -41,12 +42,14 @@ Please refer to [DATA Preparation](https://github.com/open-mmlab/mmfewshot/tree/ ## How to reproduce Meta RCNN Following the original implementation, it consists of 2 steps: + - **Step1: Base training** - - use all the images and annotations of base classes to train a base model. + + - use all the images and annotations of base classes to train a base model. - **Step2: Few shot fine-tuning**: - - use the base model from step1 as model initialization and further fine tune the model with few shot datasets. + - use the base model from step1 as model initialization and further fine tune the model with few shot datasets. ### An example of VOC split1 1 shot setting with 8 gpus @@ -61,16 +64,16 @@ bash ./tools/detection/dist_train.sh \ ``` **Note**: + - The default output path of the reshaped base model in step2 is set to `work_dirs/{BASE TRAINING CONFIG}/base_model_random_init_bbox_head.pth`. When the model is saved to different path, please update the argument `load_from` in step3 few shot fine-tune configs instead of using `resume_from`. - To use pre-trained checkpoint, please set the `load_from` to the downloaded checkpoint path. - - ## Results on VOC dataset **Note**: + - The official implementation use batch size 1x4 for training, while we use batch size 8x4. - For few shot fine-tuning we only fine tune the bbox head and the iterations or training strategy may not be the optimal in 8gpu setting. @@ -79,43 +82,38 @@ bash ./tools/detection/dist_train.sh \ To reproduce the reported few shot results, it is highly recommended using the released model for few shot fine-tuning. - The difficult samples will be used in base training query set, but not be used in support set and few shot setting. - ### Base Training -| Arch | Split | Base AP50 | ckpt | log | -| :------: | :-----------: | :------: | :------: |:------: | -| [r101 c4](/configs/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_base-training.py) | 1 | 72.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_base-training_20211101_234042-7184a596.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_base-training.log.json) | -| [r101 c4](/configs/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_base-training.py) | 2 | 73.3 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_base-training_20211101_004034-03616bec.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_base-training.log.json) | -| [r101 c4](/configs/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_base-training.py) | 3 | 74.2 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_base-training_20211101_040111-24a50a91.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_base-training.log.json) | - +| Arch | Split | Base AP50 | ckpt | log | +| :---------------------------------------------------------------------------------------------------: | :---: | :-------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------: | +| [r101 c4](/configs/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_base-training.py) | 1 | 72.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_base-training_20211101_234042-7184a596.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_base-training.log.json) | +| [r101 c4](/configs/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_base-training.py) | 2 | 73.3 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_base-training_20211101_004034-03616bec.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_base-training.log.json) | +| [r101 c4](/configs/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_base-training.py) | 3 | 74.2 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_base-training_20211101_040111-24a50a91.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_base-training.log.json) | ### Few Shot Fine-tuning - -| Arch | Split | Shot | Base AP50 | Novel AP50 | ckpt | log | -| :--------------: | :-----------: | :------: | :------: | :------: |:------: |:------: | -| [r101 c4](/configs/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_1shot-fine-tuning.py) | 1 | 1 | 58.8 | 40.2 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_1shot-fine-tuning_20211111_173217-b872c72a.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_1shot-fine-tuning.log.json) | -| [r101 c4](/configs/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_2shot-fine-tuning.py) | 1 | 2 | 67.7 | 49.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_2shot-fine-tuning_20211111_173941-75b01b1d.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_2shot-fine-tuning.log.json) | -| [r101 c4](/configs/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_3shot-fine-tuning.py) | 1 | 3 | 69.0 | 54.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_3shot-fine-tuning_20211111_175026-6b556b8c.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_3shot-fine-tuning.log.json) | -| [r101 c4](/configs/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_5shot-fine-tuning.py) | 1 | 5 | 70.8 | 55.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_5shot-fine-tuning_20211111_180727-d9194139.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_5shot-fine-tuning.log.json) | -| [r101 c4](/configs/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_10shot-fine-tuning.py) | 1 | 10 | 71.7 | 56.3 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_10shot-fine-tuning_20211111_182413-f3db91b6.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_10shot-fine-tuning.log.json) | -| [r101 c4](/configs/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_1shot-fine-tuning.py) | 2 | 1 | 61.0 | 27.3 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_1shot-fine-tuning_20211111_184455-c0319926.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_1shot-fine-tuning.log.json) | -| [r101 c4](/configs/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_2shot-fine-tuning.py) | 2 | 2 | 69.5 | 34.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_2shot-fine-tuning_20211111_185215-c5807bb2.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_2shot-fine-tuning.log.json) | -| [r101 c4](/configs/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_3shot-fine-tuning.py) | 2 | 3 | 71.0 | 39.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_3shot-fine-tuning_20211111_190314-add8dbf5.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_3shot-fine-tuning.log.json) | -| [r101 c4](/configs/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_5shot-fine-tuning.py) | 2 | 5 | 71.7 | 36.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_5shot-fine-tuning_20211111_192028-61dcc52f.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_5shot-fine-tuning.log.json) | -| [r101 c4](/configs/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_10shot-fine-tuning.py) | 2 | 10 | 72.6 | 40.1 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_10shot-fine-tuning_20211111_193726-2bc2e6dc.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_10shot-fine-tuning.log.json) | -| [r101 c4](/configs/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_1shot-fine-tuning.py) | 3 | 1 | 63.0 | 32.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_1shot-fine-tuning_20211111_195827-63728ee6.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_1shot-fine-tuning.log.json) | -| [r101 c4](/configs/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_2shot-fine-tuning.py) | 3 | 2 | 70.1 | 37.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_2shot-fine-tuning_20211111_200558-4ef3a000.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_2shot-fine-tuning.log.json) | -| [r101 c4](/configs/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_3shot-fine-tuning.py) | 3 | 3 | 71.3 | 42.5 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_3shot-fine-tuning_20211111_201709-eb05339e.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_3shot-fine-tuning.log.json) | -| [r101 c4](/configs/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_5shot-fine-tuning.py) | 3 | 5 | 72.3 | 49.6 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_5shot-fine-tuning_20211111_203427-54bdf978.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_5shot-fine-tuning.log.json) | -| [r101 c4](/configs/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_10shot-fine-tuning.py) | 3 | 10 | 73.2 | 49.1 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_10shot-fine-tuning_20211111_205129-6d94e3b4.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_10shot-fine-tuning.log.json) | - - +| Arch | Split | Shot | Base AP50 | Novel AP50 | ckpt | log | +| :--------------------------------------------------------------------------------------------------------: | :---: | :--: | :-------: | :--------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------: | +| [r101 c4](/configs/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_1shot-fine-tuning.py) | 1 | 1 | 58.8 | 40.2 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_1shot-fine-tuning_20211111_173217-b872c72a.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_1shot-fine-tuning.log.json) | +| [r101 c4](/configs/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_2shot-fine-tuning.py) | 1 | 2 | 67.7 | 49.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_2shot-fine-tuning_20211111_173941-75b01b1d.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_2shot-fine-tuning.log.json) | +| [r101 c4](/configs/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_3shot-fine-tuning.py) | 1 | 3 | 69.0 | 54.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_3shot-fine-tuning_20211111_175026-6b556b8c.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_3shot-fine-tuning.log.json) | +| [r101 c4](/configs/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_5shot-fine-tuning.py) | 1 | 5 | 70.8 | 55.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_5shot-fine-tuning_20211111_180727-d9194139.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_5shot-fine-tuning.log.json) | +| [r101 c4](/configs/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_10shot-fine-tuning.py) | 1 | 10 | 71.7 | 56.3 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_10shot-fine-tuning_20211111_182413-f3db91b6.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split1/meta-rcnn_r101_c4_8xb4_voc-split1_10shot-fine-tuning.log.json) | +| [r101 c4](/configs/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_1shot-fine-tuning.py) | 2 | 1 | 61.0 | 27.3 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_1shot-fine-tuning_20211111_184455-c0319926.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_1shot-fine-tuning.log.json) | +| [r101 c4](/configs/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_2shot-fine-tuning.py) | 2 | 2 | 69.5 | 34.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_2shot-fine-tuning_20211111_185215-c5807bb2.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_2shot-fine-tuning.log.json) | +| [r101 c4](/configs/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_3shot-fine-tuning.py) | 2 | 3 | 71.0 | 39.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_3shot-fine-tuning_20211111_190314-add8dbf5.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_3shot-fine-tuning.log.json) | +| [r101 c4](/configs/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_5shot-fine-tuning.py) | 2 | 5 | 71.7 | 36.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_5shot-fine-tuning_20211111_192028-61dcc52f.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_5shot-fine-tuning.log.json) | +| [r101 c4](/configs/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_10shot-fine-tuning.py) | 2 | 10 | 72.6 | 40.1 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_10shot-fine-tuning_20211111_193726-2bc2e6dc.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split2/meta-rcnn_r101_c4_8xb4_voc-split2_10shot-fine-tuning.log.json) | +| [r101 c4](/configs/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_1shot-fine-tuning.py) | 3 | 1 | 63.0 | 32.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_1shot-fine-tuning_20211111_195827-63728ee6.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_1shot-fine-tuning.log.json) | +| [r101 c4](/configs/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_2shot-fine-tuning.py) | 3 | 2 | 70.1 | 37.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_2shot-fine-tuning_20211111_200558-4ef3a000.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_2shot-fine-tuning.log.json) | +| [r101 c4](/configs/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_3shot-fine-tuning.py) | 3 | 3 | 71.3 | 42.5 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_3shot-fine-tuning_20211111_201709-eb05339e.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_3shot-fine-tuning.log.json) | +| [r101 c4](/configs/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_5shot-fine-tuning.py) | 3 | 5 | 72.3 | 49.6 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_5shot-fine-tuning_20211111_203427-54bdf978.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_5shot-fine-tuning.log.json) | +| [r101 c4](/configs/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_10shot-fine-tuning.py) | 3 | 10 | 73.2 | 49.1 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_10shot-fine-tuning_20211111_205129-6d94e3b4.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/voc/split3/meta-rcnn_r101_c4_8xb4_voc-split3_10shot-fine-tuning.log.json) | ## Results on COCO dataset - **Note**: + - The official implementation use batch size 1x4 for training, while we use batch size 8x4. - For few shot fine-tuning we only fine tune the bbox head and the iterations or training strategy may not be the optimal in 8gpu setting. @@ -125,15 +123,13 @@ bash ./tools/detection/dist_train.sh \ ### Base Training -| Arch | Base mAP | ckpt | log | -| :------: | :-----------: | :------: |:------: | -| [r50 c4](/configs/detection/meta_rcnn/coco/meta-rcnn_r50_c4_8xb4_coco_base-training.py) | 27.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/coco/meta-rcnn_r50_c4_8xb4_coco_base-training_20211102_213915-65a22539.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/coco/meta-rcnn_r50_c4_8xb4_coco_base-training.log.json) | - +| Arch | Base mAP | ckpt | log | +| :-------------------------------------------------------------------------------------: | :------: | :---------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------: | +| [r50 c4](/configs/detection/meta_rcnn/coco/meta-rcnn_r50_c4_8xb4_coco_base-training.py) | 27.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/coco/meta-rcnn_r50_c4_8xb4_coco_base-training_20211102_213915-65a22539.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/coco/meta-rcnn_r50_c4_8xb4_coco_base-training.log.json) | Few Shot Finetuning - -| Arch | Shot | Base mAP | Novel AP50 | ckpt | log | -| :--------------: | :-----------: | :------: |:------: |:------: |:------: | -| [r50 c4](/configs/detection/meta_rcnn/coco/meta-rcnn_r50_c4_8xb4_coco_10shot-fine-tuning.py) | 10 | 25.1 | 9.4 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/coco/meta-rcnn_r50_c4_8xb4_coco_10shot-fine-tuning_20211112_090638-e703f762.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/coco/meta-rcnn_r50_c4_8xb4_coco_10shot-fine-tuning.log.json) | -| [r50 c4](/configs/detection/meta_rcnn/coco/meta-rcnn_r50_c4_8xb4_coco_30shot-fine-tuning.py) | 30 | 26.9 | 11.5 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/coco/meta-rcnn_r50_c4_8xb4_coco_30shot-fine-tuning_20211112_110452-50d791dd.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/coco/meta-rcnn_r50_c4_8xb4_coco_30shot-fine-tuning.log.json) | +| Arch | Shot | Base mAP | Novel AP50 | ckpt | log | +| :------------------------------------------------------------------------------------------: | :--: | :------: | :--------: | :--------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------: | +| [r50 c4](/configs/detection/meta_rcnn/coco/meta-rcnn_r50_c4_8xb4_coco_10shot-fine-tuning.py) | 10 | 25.1 | 9.4 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/coco/meta-rcnn_r50_c4_8xb4_coco_10shot-fine-tuning_20211112_090638-e703f762.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/coco/meta-rcnn_r50_c4_8xb4_coco_10shot-fine-tuning.log.json) | +| [r50 c4](/configs/detection/meta_rcnn/coco/meta-rcnn_r50_c4_8xb4_coco_30shot-fine-tuning.py) | 30 | 26.9 | 11.5 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/coco/meta-rcnn_r50_c4_8xb4_coco_30shot-fine-tuning_20211112_110452-50d791dd.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/meta_rcnn/coco/meta-rcnn_r50_c4_8xb4_coco_30shot-fine-tuning.log.json) | diff --git a/configs/detection/mpsr/README.md b/configs/detection/mpsr/README.md index bb88260..6b2ef12 100644 --- a/configs/detection/mpsr/README.md +++ b/configs/detection/mpsr/README.md @@ -1,7 +1,9 @@ # Multi-Scale Positive Sample Refinement for Few-Shot Object Detection (ECCV'2020) + ## Abstract + Few-shot object detection (FSOD) helps detectors adapt to unseen classes with few training instances, and is useful when manual annotation is time-consuming or data acquisition is limited. Unlike previous attempts that exploit few-shot classification techniques to facilitate FSOD, this work highlights the necessity of handling the problem of scale @@ -14,15 +16,15 @@ Several experiments are conducted on PASCAL VOC andMS COCO, and the proposed app Code is available at https://github.com/jiaxi-wu/MPSR. +
- - ## Citation + ```bibtex @inproceedings{wu2020mpsr, title={Multi-Scale Positive Sample Refinement for Few-Shot Object Detection}, @@ -32,19 +34,21 @@ Code is available at https://github.com/jiaxi-wu/MPSR. } ``` - **Note**: ALL the reported results use the data split released from [TFA](https://github.com/ucbdrive/few-shot-object-detection/blob/main/datasets/README.md) official repo. Currently, each setting is only evaluated with one fixed few shot dataset. Please refer to [DATA Preparation](https://github.com/open-mmlab/mmfewshot/tree/main/tools/data/detection) to get more details about the dataset and data preparation. ## How to reproduce MPSR + Following the original implementation, it consists of 2 steps: + - **Step1: Base training** - - use all the images and annotations of base classes to train a base model. + + - use all the images and annotations of base classes to train a base model. - **Step2: Few shot fine-tuning**: - - use the base model from step1 as model initialization and further fine tune the model with few shot datasets. + - use the base model from step1 as model initialization and further fine tune the model with few shot datasets. ### An example of VOC split1 1 shot setting with 8 gpus @@ -59,16 +63,16 @@ bash ./tools/detection/dist_train.sh \ ``` **Note**: + - The default output path of the reshaped base model in step2 is set to `work_dirs/{BASE TRAINING CONFIG}/base_model_random_init_bbox_head.pth`. When the model is saved to different path, please update the argument `load_from` in step3 few shot fine-tune configs instead of using `resume_from`. - To use pre-trained checkpoint, please set the `load_from` to the downloaded checkpoint path. - - ## Results on VOC dataset **Note**: + - We follow the official implementation using batch size 2x2 for training. - The performance of few shot setting can be unstable, even using the same random seed. To reproduce the reported few shot results, it is highly recommended using the released model for few shot fine-tuning. @@ -76,62 +80,60 @@ bash ./tools/detection/dist_train.sh \ ### Base Training -| Arch | Split | Base AP50 | ckpt | log | -| :------: | :-----------: | :------: | :------: |:------: | -| [r101 fpn](/configs/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_base-training.py) | 1 | 80.5 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_base-training_20211107_135130-ea747c7b.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_base-training.log.json) | -| [r101 fpn](/configs/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_base-training.py) | 2 | 81.3 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_base-training_20211107_135130-c7b4ee3f.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_base-training.log.json) | -| [r101 fpn](/configs/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_base-training.py) | 3 | 81.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_base-training_20211107_135304-3528e346.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_base-training.log.json) | -| [r101 fpn*](/configs/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_base-training.py) | 1 | 77.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split1/convert_mpsr_r101_fpn_2xb2_voc-split1_base-training-c186aaef.pth) | - | -| [r101 fpn*](/configs/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_base-training.py) | 2 | 78.3 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split2/convert_mpsr_r101_fpn_2xb2_voc-split2_base-training-1861c370.pth) | - | -| [r101 fpn*](/configs/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_base-training.py) | 3 | 77.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split3/convert_mpsr_r101_fpn_2xb2_voc-split3_base-training-1afa74d7.pth) | - | +| Arch | Split | Base AP50 | ckpt | log | +| :---------------------------------------------------------------------------------------------: | :---: | :-------: | :-------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------: | +| [r101 fpn](/configs/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_base-training.py) | 1 | 80.5 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_base-training_20211107_135130-ea747c7b.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_base-training.log.json) | +| [r101 fpn](/configs/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_base-training.py) | 2 | 81.3 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_base-training_20211107_135130-c7b4ee3f.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_base-training.log.json) | +| [r101 fpn](/configs/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_base-training.py) | 3 | 81.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_base-training_20211107_135304-3528e346.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_base-training.log.json) | +| [r101 fpn\*](/configs/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_base-training.py) | 1 | 77.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split1/convert_mpsr_r101_fpn_2xb2_voc-split1_base-training-c186aaef.pth) | - | +| [r101 fpn\*](/configs/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_base-training.py) | 2 | 78.3 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split2/convert_mpsr_r101_fpn_2xb2_voc-split2_base-training-1861c370.pth) | - | +| [r101 fpn\*](/configs/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_base-training.py) | 3 | 77.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split3/convert_mpsr_r101_fpn_2xb2_voc-split3_base-training-1afa74d7.pth) | - | **Note**: + - \* means the model is converted from [official repo](https://github.com/jiaxi-wu/MPSR), as we find that the base model trained from mmfewshot will get worse performance in fine-tuning especially in 1/2/3 shots, even their base training performance are higher. We will continue to investigate and improve it. - ### Few Shot Fine-tuning - -| Arch | Split | Shot | Base AP50 | Novel AP50 | ckpt | log | -| :--------------: | :-----------: | :------: | :------: |:------: |:------: |:------: | -| [r101 fpn*](/configs/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_1shot-fine-tuning.py) | 1 | 1 | 60.6 | 38.5 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_1shot-fine-tuning_20211109_130330-444b743a.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_1shot-fine-tuning.log.json) | -| [r101 fpn*](/configs/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_2shot-fine-tuning.py) | 1 | 2 | 65.9 | 45.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_2shot-fine-tuning_20211109_130330-3a778216.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_2shot-fine-tuning.log.json) | -| [r101 fpn*](/configs/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_3shot-fine-tuning.py) | 1 | 3 | 68.1 | 49.2 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_3shot-fine-tuning_20211109_130347-f5baa2f7.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_3shot-fine-tuning.log.json) | -| [r101 fpn*](/configs/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_5shot-fine-tuning.py) | 1 | 5 | 69.2 | 55.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_5shot-fine-tuning_20211109_130347-620065e8.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_5shot-fine-tuning.log.json) | -| [r101 fpn*](/configs/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_10shot-fine-tuning.py) | 1 | 10 | 71.2 | 58.7 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_10shot-fine-tuning_20211109_130430-d87b3b4b.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_10shot-fine-tuning.log.json) | -| [r101 fpn*](/configs/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_1shot-fine-tuning.py) | 2 | 1 | 61.0 | 25.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_1shot-fine-tuning_20211107_195800-48163ea0.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_1shot-fine-tuning.log.json) | -| [r101 fpn*](/configs/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_2shot-fine-tuning.py) | 2 | 2 | 66.9 | 29.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_2shot-fine-tuning_20211107_203755-65afa20b.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_2shot-fine-tuning.log.json) | -| [r101 fpn*](/configs/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_3shot-fine-tuning.py) | 2 | 3 | 67.6 | 40.6 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_3shot-fine-tuning_20211107_110120-832962b1.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_3shot-fine-tuning.log.json) | -| [r101 fpn*](/configs/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_5shot-fine-tuning.py) | 2 | 5 | 70.4 | 41.5 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_5shot-fine-tuning_20211107_114449-ea834f31.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_5shot-fine-tuning.log.json) | -| [r101 fpn*](/configs/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_10shot-fine-tuning.py) | 2 | 10 | 71.7 | 47.1 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_10shot-fine-tuning_20211107_122815-8108834b.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_10shot-fine-tuning.log.json) | -| [r101 fpn*](/configs/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_1shot-fine-tuning.py) | 3 | 1 | 57.9 | 34.6 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_1shot-fine-tuning_20211107_131308-c0e1d1f0.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_1shot-fine-tuning.log.json) | -| [r101 fpn*](/configs/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_2shot-fine-tuning.py) | 3 | 2 | 65.7 | 41.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_2shot-fine-tuning_20211107_135527-70053e26.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_2shot-fine-tuning.log.json) | -| [r101 fpn*](/configs/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_3shot-fine-tuning.py) | 3 | 3 | 69.1 | 44.1 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_3shot-fine-tuning_20211107_155433-8955b1d3.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_3shot-fine-tuning.log.json) | -| [r101 fpn*](/configs/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_5shot-fine-tuning.py) | 3 | 5 | 70.4 | 48.5 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_5shot-fine-tuning_20211107_171449-a9931117.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_5shot-fine-tuning.log.json) | -| [r101 fpn*](/configs/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_10shot-fine-tuning.py) | 3 | 10 | 72.5 | 51.7 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_10shot-fine-tuning_20211107_183534-698b6503.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_10shot-fine-tuning.log.json) | +| Arch | Split | Shot | Base AP50 | Novel AP50 | ckpt | log | +| :--------------------------------------------------------------------------------------------------: | :---: | :--: | :-------: | :--------: | :------------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------: | +| [r101 fpn\*](/configs/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_1shot-fine-tuning.py) | 1 | 1 | 60.6 | 38.5 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_1shot-fine-tuning_20211109_130330-444b743a.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_1shot-fine-tuning.log.json) | +| [r101 fpn\*](/configs/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_2shot-fine-tuning.py) | 1 | 2 | 65.9 | 45.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_2shot-fine-tuning_20211109_130330-3a778216.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_2shot-fine-tuning.log.json) | +| [r101 fpn\*](/configs/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_3shot-fine-tuning.py) | 1 | 3 | 68.1 | 49.2 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_3shot-fine-tuning_20211109_130347-f5baa2f7.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_3shot-fine-tuning.log.json) | +| [r101 fpn\*](/configs/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_5shot-fine-tuning.py) | 1 | 5 | 69.2 | 55.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_5shot-fine-tuning_20211109_130347-620065e8.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_5shot-fine-tuning.log.json) | +| [r101 fpn\*](/configs/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_10shot-fine-tuning.py) | 1 | 10 | 71.2 | 58.7 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_10shot-fine-tuning_20211109_130430-d87b3b4b.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_10shot-fine-tuning.log.json) | +| [r101 fpn\*](/configs/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_1shot-fine-tuning.py) | 2 | 1 | 61.0 | 25.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_1shot-fine-tuning_20211107_195800-48163ea0.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_1shot-fine-tuning.log.json) | +| [r101 fpn\*](/configs/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_2shot-fine-tuning.py) | 2 | 2 | 66.9 | 29.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_2shot-fine-tuning_20211107_203755-65afa20b.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_2shot-fine-tuning.log.json) | +| [r101 fpn\*](/configs/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_3shot-fine-tuning.py) | 2 | 3 | 67.6 | 40.6 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_3shot-fine-tuning_20211107_110120-832962b1.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_3shot-fine-tuning.log.json) | +| [r101 fpn\*](/configs/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_5shot-fine-tuning.py) | 2 | 5 | 70.4 | 41.5 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_5shot-fine-tuning_20211107_114449-ea834f31.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_5shot-fine-tuning.log.json) | +| [r101 fpn\*](/configs/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_10shot-fine-tuning.py) | 2 | 10 | 71.7 | 47.1 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_10shot-fine-tuning_20211107_122815-8108834b.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split2/mpsr_r101_fpn_2xb2_voc-split2_10shot-fine-tuning.log.json) | +| [r101 fpn\*](/configs/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_1shot-fine-tuning.py) | 3 | 1 | 57.9 | 34.6 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_1shot-fine-tuning_20211107_131308-c0e1d1f0.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_1shot-fine-tuning.log.json) | +| [r101 fpn\*](/configs/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_2shot-fine-tuning.py) | 3 | 2 | 65.7 | 41.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_2shot-fine-tuning_20211107_135527-70053e26.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_2shot-fine-tuning.log.json) | +| [r101 fpn\*](/configs/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_3shot-fine-tuning.py) | 3 | 3 | 69.1 | 44.1 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_3shot-fine-tuning_20211107_155433-8955b1d3.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_3shot-fine-tuning.log.json) | +| [r101 fpn\*](/configs/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_5shot-fine-tuning.py) | 3 | 5 | 70.4 | 48.5 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_5shot-fine-tuning_20211107_171449-a9931117.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_5shot-fine-tuning.log.json) | +| [r101 fpn\*](/configs/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_10shot-fine-tuning.py) | 3 | 10 | 72.5 | 51.7 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_10shot-fine-tuning_20211107_183534-698b6503.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/voc/split3/mpsr_r101_fpn_2xb2_voc-split3_10shot-fine-tuning.log.json) | - \* means using base model converted from [official repo](https://github.com/jiaxi-wu/MPSR) ## Results on COCO dataset **Note**: + - We follow the official implementation using batch size 2x2 for training. - The performance of base training and few shot setting can be unstable, even using the same random seed. To reproduce the reported few shot results, it is highly recommended using the released model for few shot fine-tuning. - ### Base Training -| Arch | Base mAP | ckpt | log | -| :------: | :-----------: | :------: |:------: | -| [r101 fpn](/configs/detection/mpsr/coco/mpsr_r101_fpn_2xb2_coco_base-training.py) | 34.6 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/coco/mpsr_r101_fpn_2xb2_coco_base-training_20211103_164720-c6998b36.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/coco/mpsr_r101_fpn_2xb2_coco_base-training.log.json) | +| Arch | Base mAP | ckpt | log | +| :-------------------------------------------------------------------------------: | :------: | :-------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------: | +| [r101 fpn](/configs/detection/mpsr/coco/mpsr_r101_fpn_2xb2_coco_base-training.py) | 34.6 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/coco/mpsr_r101_fpn_2xb2_coco_base-training_20211103_164720-c6998b36.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/coco/mpsr_r101_fpn_2xb2_coco_base-training.log.json) | ### Few Shot Fine-tuning - -| Arch | Shot | Base mAP | Novel mAP | ckpt | log | -| :--------------: | :-----------: | :------: |:------: |:------: |:------: | -| [r101 fpn](/configs/detection/mpsr/coco/mpsr_r101_fpn_2xb2_coco_10shot-fine-tuning.py) | 10 | 23.2 | 12.6 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/coco/mpsr_r101_fpn_2xb2_coco_10shot-fine-tuning_20211104_161345-c4f1955a.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/coco/mpsr_r101_fpn_2xb2_coco_10shot-fine-tuning.log.json) | -| [r101 fpn](/configs/detection/mpsr/coco/mpsr_r101_fpn_2xb2_coco_30shot-fine-tuning.py) | 30 | 25.2 | 18.1 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/coco/mpsr_r101_fpn_2xb2_coco_30shot-fine-tuning_20211104_161611-fedc6a63.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/coco/mpsr_r101_fpn_2xb2_coco_30shot-fine-tuning.log.json) | +| Arch | Shot | Base mAP | Novel mAP | ckpt | log | +| :------------------------------------------------------------------------------------: | :--: | :------: | :-------: | :------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | +| [r101 fpn](/configs/detection/mpsr/coco/mpsr_r101_fpn_2xb2_coco_10shot-fine-tuning.py) | 10 | 23.2 | 12.6 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/coco/mpsr_r101_fpn_2xb2_coco_10shot-fine-tuning_20211104_161345-c4f1955a.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/coco/mpsr_r101_fpn_2xb2_coco_10shot-fine-tuning.log.json) | +| [r101 fpn](/configs/detection/mpsr/coco/mpsr_r101_fpn_2xb2_coco_30shot-fine-tuning.py) | 30 | 25.2 | 18.1 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/mpsr/coco/mpsr_r101_fpn_2xb2_coco_30shot-fine-tuning_20211104_161611-fedc6a63.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/mpsr/coco/mpsr_r101_fpn_2xb2_coco_30shot-fine-tuning.log.json) | diff --git a/configs/detection/tfa/README.md b/configs/detection/tfa/README.md index 2cef48c..3a8bce7 100644 --- a/configs/detection/tfa/README.md +++ b/configs/detection/tfa/README.md @@ -1,6 +1,5 @@ # Frustratingly Simple Few-Shot Object Detection (ICML'2020) - ## Abstract @@ -16,12 +15,11 @@ Again, our fine-tuning approach establishes a new state of the art on the revise The code as well as the pretrained models are available at https://github.com/ucbdrive/few-shot-object-detection. +
- - ## Citation @@ -35,28 +33,27 @@ The code as well as the pretrained models are available at https://github.com/uc } ``` - - **Note**: ALL the reported results use the data split released from [TFA](https://github.com/ucbdrive/few-shot-object-detection/blob/main/datasets/README.md) official repo. Currently, each setting is only evaluated with one fixed few shot dataset. Please refer to [DATA Preparation](https://github.com/open-mmlab/mmfewshot/tree/main/tools/data/detection) to get more details about the dataset and data preparation. - ## How to reproduce TFA - Following the original implementation, it consists of 3 steps: + - **Step1: Base training** - - use all the images and annotations of base classes to train a base model. + + - use all the images and annotations of base classes to train a base model. - **Step2: Reshape the bbox head of base model**: - - create a new bbox head for all classes fine-tuning (base classes + novel classes) using provided script. - - the weights of base class in new bbox head directly use the original one as initialization. - - the weights of novel class in new bbox head use random initialization. + + - create a new bbox head for all classes fine-tuning (base classes + novel classes) using provided script. + - the weights of base class in new bbox head directly use the original one as initialization. + - the weights of novel class in new bbox head use random initialization. - **Step3: Few shot fine-tuning**: - - use the base model from step2 as model initialization and further fine tune the bbox head with few shot datasets. + - use the base model from step2 as model initialization and further fine tune the bbox head with few shot datasets. ### An example of VOC split1 1 shot setting with 8 gpus @@ -77,24 +74,24 @@ bash ./tools/detection/dist_train.sh \ ``` **Note**: + - The default output path of the reshaped base model in step2 is set to `work_dirs/{BASE TRAINING CONFIG}/base_model_random_init_bbox_head.pth`. When the model is saved to different path, please update the argument `load_from` in step3 few shot fine-tune configs instead of using `resume_from`. - To use pre-trained checkpoint, please set the `load_from` to the downloaded checkpoint path. - ## Results on VOC dataset ### Base Training -| Arch | Split | Base AP50 | ckpt(step1) | ckpt(step2) | log | -| :------: | :-----------: | :------: | :------: | :------: |:------: | -| [r101_fpn](/configs/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_base-training.py) | 1 | 80.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_base-training_20211031_114821-efbd13e9.pth) | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_base-training_20211031_114821_random-init-bbox-head-1e681852.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_base-training.log.json) | -| [r101_fpn](/configs/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_base-training.py) | 2 | 82.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_base-training_20211031_114820-d47f8ef9.pth) | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_base-training_20211031_114820_random-init-bbox-head-3d4c632c.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_base-training.log.json) | -| [r101_fpn](/configs/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_base-training.py) | 3 | 82.1 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_base-training_20211031_114840-fd8a9864.pth) | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_base-training_20211031_114840_random-init-bbox-head-9bb8c09b.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_base-training.log.json) | - +| Arch | Split | Base AP50 | ckpt(step1) | ckpt(step2) | log | +| :------------------------------------------------------------------------------------: | :---: | :-------: | :------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | +| [r101_fpn](/configs/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_base-training.py) | 1 | 80.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_base-training_20211031_114821-efbd13e9.pth) | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_base-training_20211031_114821_random-init-bbox-head-1e681852.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_base-training.log.json) | +| [r101_fpn](/configs/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_base-training.py) | 2 | 82.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_base-training_20211031_114820-d47f8ef9.pth) | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_base-training_20211031_114820_random-init-bbox-head-3d4c632c.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_base-training.log.json) | +| [r101_fpn](/configs/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_base-training.py) | 3 | 82.1 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_base-training_20211031_114840-fd8a9864.pth) | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_base-training_20211031_114840_random-init-bbox-head-9bb8c09b.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_base-training.log.json) | **Note**: + - The performance of the same few shot setting using different base training models can be dramatically unstable (AP50 can fluctuate by 5.0 or more), even their mAP on base classes are very close. - Temporally, the solution to getting a good base model is training the base model with different random seed. @@ -105,42 +102,37 @@ bash ./tools/detection/dist_train.sh \ - To reproduce the reported few shot results, it is highly recommended using the released step2 model for few shot fine-tuning. - The difficult samples will be used in base training, but not be used in few shot setting. - - ### Few Shot Fine-tuning -| Arch | Split | Shot | Base AP50 | Novel AP50 | ckpt | log | -| :--------------: | :-----------: | :------: | :------: | :------: |:------: |:------: | -| [r101_fpn](/configs/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_1shot-fine-tuning.py) | 1 | 1 | 79.2 | 41.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_1shot-fine-tuning_20211031_204528-9d6b2d28.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_1shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_2shot-fine-tuning.py) | 1 | 2 | 79.2 | 49.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_2shot-fine-tuning_20211101_003504-d5083628.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_2shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_3shot-fine-tuning.py) | 1 | 3 | 79.6 | 49.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_3shot-fine-tuning_20211101_005934-10ad61cd.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_3shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_5shot-fine-tuning.py) | 1 | 5 | 79.6 | 58.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_5shot-fine-tuning_20211101_013516-5d682ebb.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_5shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_10shot-fine-tuning.py) | 1 | 10| 79.7 | 58.4 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_10shot-fine-tuning_20211101_023154-1f3d1ff1.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_10shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_1shot-fine-tuning.py) | 2 | 1 | 80.3 | 26.6 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_1shot-fine-tuning_20211031_222829-a476e97f.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_1shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_2shot-fine-tuning.py) | 2 | 2 | 78.1 | 30.7 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_2shot-fine-tuning_20211101_042109-eb35e87e.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_2shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_3shot-fine-tuning.py) | 2 | 3 | 79.4 | 39.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_3shot-fine-tuning_20211101_044601-db0cd2b3.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_3shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_5shot-fine-tuning.py) | 2 | 5 | 79.4 | 35.7 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_5shot-fine-tuning_20211101_052148-d2edde97.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_5shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_10shot-fine-tuning.py) | 2 | 10| 79.7 | 40.5 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_10shot-fine-tuning_20211101_061828-9c0cd7cd.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_10shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_1shot-fine-tuning.py) | 3 | 1 | 80.5 | 34.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_1shot-fine-tuning_20211031_222908-509b00cd.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_1shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_2shot-fine-tuning.py) | 3 | 2 | 80.6 | 39.3 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_2shot-fine-tuning_20211101_080733-2b0bc25b.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_2shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_3shot-fine-tuning.py) | 3 | 3 | 81.1 | 42.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_3shot-fine-tuning_20211101_083226-48983379.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_3shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_5shot-fine-tuning.py) | 3 | 5 | 80.8 | 51.4 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_5shot-fine-tuning_20211101_090812-da47ba99.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_5shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_10shot-fine-tuning.py) | 3 | 10| 80.7 | 50.6 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_10shot-fine-tuning_20211101_100435-ef8d4023.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_10shot-fine-tuning.log.json) | - - +| Arch | Split | Shot | Base AP50 | Novel AP50 | ckpt | log | +| :-----------------------------------------------------------------------------------------: | :---: | :--: | :-------: | :--------: | :-----------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------: | +| [r101_fpn](/configs/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_1shot-fine-tuning.py) | 1 | 1 | 79.2 | 41.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_1shot-fine-tuning_20211031_204528-9d6b2d28.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_1shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_2shot-fine-tuning.py) | 1 | 2 | 79.2 | 49.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_2shot-fine-tuning_20211101_003504-d5083628.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_2shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_3shot-fine-tuning.py) | 1 | 3 | 79.6 | 49.9 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_3shot-fine-tuning_20211101_005934-10ad61cd.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_3shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_5shot-fine-tuning.py) | 1 | 5 | 79.6 | 58.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_5shot-fine-tuning_20211101_013516-5d682ebb.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_5shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_10shot-fine-tuning.py) | 1 | 10 | 79.7 | 58.4 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_10shot-fine-tuning_20211101_023154-1f3d1ff1.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split1/tfa_r101_fpn_voc-split1_10shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_1shot-fine-tuning.py) | 2 | 1 | 80.3 | 26.6 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_1shot-fine-tuning_20211031_222829-a476e97f.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_1shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_2shot-fine-tuning.py) | 2 | 2 | 78.1 | 30.7 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_2shot-fine-tuning_20211101_042109-eb35e87e.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_2shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_3shot-fine-tuning.py) | 2 | 3 | 79.4 | 39.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_3shot-fine-tuning_20211101_044601-db0cd2b3.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_3shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_5shot-fine-tuning.py) | 2 | 5 | 79.4 | 35.7 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_5shot-fine-tuning_20211101_052148-d2edde97.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_5shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_10shot-fine-tuning.py) | 2 | 10 | 79.7 | 40.5 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_10shot-fine-tuning_20211101_061828-9c0cd7cd.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split2/tfa_r101_fpn_voc-split2_10shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_1shot-fine-tuning.py) | 3 | 1 | 80.5 | 34.0 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_1shot-fine-tuning_20211031_222908-509b00cd.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_1shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_2shot-fine-tuning.py) | 3 | 2 | 80.6 | 39.3 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_2shot-fine-tuning_20211101_080733-2b0bc25b.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_2shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_3shot-fine-tuning.py) | 3 | 3 | 81.1 | 42.8 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_3shot-fine-tuning_20211101_083226-48983379.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_3shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_5shot-fine-tuning.py) | 3 | 5 | 80.8 | 51.4 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_5shot-fine-tuning_20211101_090812-da47ba99.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_5shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_10shot-fine-tuning.py) | 3 | 10 | 80.7 | 50.6 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_10shot-fine-tuning_20211101_100435-ef8d4023.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/voc/split3/tfa_r101_fpn_voc-split3_10shot-fine-tuning.log.json) | ## Results on COCO dataset ### Base Training -| Arch | Base mAP | ckpt(step1) | ckpt(step2) | log | -| :------: | :-----------: | :------: |:------: |:------: | -| [r101_fpn](/configs/detection/tfa/coco/tfa_r101_fpn_coco_base-training.py) | 39.5 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/coco/tfa_r101_fpn_coco_base-training_20211102_030413-a67975c7.pth) | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/coco/tfa_r101_fpn_coco_base-training_20211102_030413_random-init-bbox-head-ea1c2981.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/coco/tfa_r101_fpn_coco_base-training.log.json) | - +| Arch | Base mAP | ckpt(step1) | ckpt(step2) | log | +| :------------------------------------------------------------------------: | :------: | :------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------: | +| [r101_fpn](/configs/detection/tfa/coco/tfa_r101_fpn_coco_base-training.py) | 39.5 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/coco/tfa_r101_fpn_coco_base-training_20211102_030413-a67975c7.pth) | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/coco/tfa_r101_fpn_coco_base-training_20211102_030413_random-init-bbox-head-ea1c2981.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/coco/tfa_r101_fpn_coco_base-training.log.json) | ### Few Shot Fine-tuning -| Arch | Shot | Base mAP | Novel mAP | ckpt | log | -| :--------------: | :-----------: | :------: | :------: |:------: |:------: | -| [r101_fpn](/configs/detection/tfa/coco/tfa_r101_fpn_coco_10shot-fine-tuning.py) | 10 | 35.2 | 10.4 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/coco/tfa_r101_fpn_coco_10shot-fine-tuning_20211102_162241-8abd2a82.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/coco/tfa_r101_fpn_coco_10shot-fine-tuning.log.json) | -| [r101_fpn](/configs/detection/tfa/coco/tfa_r101_fpn_coco_30shot-fine-tuning.py) | 30 | 36.7 | 14.7 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/coco/tfa_r101_fpn_coco_30shot-fine-tuning_20211103_001731-a63fce47.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/coco/tfa_r101_fpn_coco_30shot-fine-tuning.log.json) | +| Arch | Shot | Base mAP | Novel mAP | ckpt | log | +| :-----------------------------------------------------------------------------: | :--: | :------: | :-------: | :-----------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------: | +| [r101_fpn](/configs/detection/tfa/coco/tfa_r101_fpn_coco_10shot-fine-tuning.py) | 10 | 35.2 | 10.4 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/coco/tfa_r101_fpn_coco_10shot-fine-tuning_20211102_162241-8abd2a82.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/coco/tfa_r101_fpn_coco_10shot-fine-tuning.log.json) | +| [r101_fpn](/configs/detection/tfa/coco/tfa_r101_fpn_coco_30shot-fine-tuning.py) | 30 | 36.7 | 14.7 | [ckpt](https://download.openmmlab.com/mmfewshot/detection/tfa/coco/tfa_r101_fpn_coco_30shot-fine-tuning_20211103_001731-a63fce47.pth) | [log](https://download.openmmlab.com/mmfewshot/detection/tfa/coco/tfa_r101_fpn_coco_30shot-fine-tuning.log.json) | diff --git a/demo/README.md b/demo/README.md index ec5e463..a3c1ca9 100644 --- a/demo/README.md +++ b/demo/README.md @@ -39,7 +39,7 @@ python demo/demo_metric_classifier_1shot_inference.py \ We provide a demo script to test a single query image, given directory of support instance images. The file names of support images will be used as class names. -The shape of image will be used as the bbox of instance, i.e [0, 0, width, height]. +The shape of image will be used as the bbox of instance, i.e \[0, 0, width, height\]. ```shell python demo/demo_attention_rpn_detector_inference.py \ diff --git a/docs/en/classification/customize_config.md b/docs/en/classification/customize_config.md index bbbb55a..eaa601c 100644 --- a/docs/en/classification/customize_config.md +++ b/docs/en/classification/customize_config.md @@ -5,7 +5,6 @@ If you wish to inspect the config file, you may run `python tools/misc/print_con The classification part of mmfewshot is built upon the [mmcls](https://github.com/open-mmlab/mmclassification), thus it is highly recommended learning the basic of mmcls. - ## Modify config through script arguments When submitting jobs using "tools/classification/train.py" or "tools/classification/test.py", you may specify `--cfg-options` to in-place modify the config. @@ -24,7 +23,7 @@ When submitting jobs using "tools/classification/train.py" or "tools/classificat - Update values of list/tuples. If the value to be updated is a list or a tuple. For example, the config file normally sets `workflow=[('train', 1)]`. If you want to - change this key, you may specify `--cfg-options workflow="[(train,1),(val,1)]"`. Note that the quotation mark \" is necessary to + change this key, you may specify `--cfg-options workflow="[(train,1),(val,1)]"`. Note that the quotation mark " is necessary to support list/tuple data types, and that **NO** white space is allowed inside the quotation marks in the specified value. ## Config name style @@ -41,15 +40,12 @@ We follow the below style to name config files. Contributors are advised to foll - `[algorithm setting]`: specific setting for some model, like `without_semantic` for `htc`, `moment` for `reppoints`, etc. - `{backbone}`: backbone type like `conv4`, `resnet12`. - `[norm_setting]`: `bn` (Batch Normalization) is used unless specified, other norm layer type could be `gn` (Group Normalization), `syncbn` (Synchronized Batch Normalization). - `gn-head`/`gn-neck` indicates GN is applied in head/neck only, while `gn-all` means GN is applied in the entire model, e.g. backbone, neck, head. + `gn-head`/`gn-neck` indicates GN is applied in head/neck only, while `gn-all` means GN is applied in the entire model, e.g. backbone, neck, head. - `[gpu x batch_per_gpu]`: GPUs and samples per GPU. For episodic training methods we use the total number of images in one episode, i.e. n classes x (support images+query images). - `[misc]`: miscellaneous setting/plugins of model. - `{dataset}`: dataset like `cub`, `mini-imagenet` and `tiered-imagenet`. - `{meta test setting}`: n way k shot setting like `5way_1shot` or `5way_5shot`. - - - ## An example of Baseline To help the users have a basic idea of a complete config and the modules in a modern classification system, @@ -249,7 +245,6 @@ lr_config = dict( ## FAQ - ### Use intermediate variables in configs Some intermediate variables are used in the configuration file. The intermediate variables make the configuration file clearer and easier to modify. diff --git a/docs/en/classification/customize_dataset.md b/docs/en/classification/customize_dataset.md index 62ec138..dbe8e7e 100644 --- a/docs/en/classification/customize_dataset.md +++ b/docs/en/classification/customize_dataset.md @@ -126,6 +126,7 @@ dataset_A_train = dict( An example of customizing data sampling logic for training: #### Create a new dataset wrapper + We can create a new dataset wrapper in mmfewshot/classification/datasets/dataset_wrappers.py to customize sampling logic. ```python @@ -162,10 +163,10 @@ class MyDatasetWrapper: ``` #### Update dataset builder + We need to add the build code in mmfewshot/classification/datasets/builder.py for our customize dataset wrapper. - ```python def build_dataset(cfg, default_args=None): if isinstance(cfg, (list, tuple)): @@ -206,7 +207,9 @@ class MyClassifier(BaseFewShotClassifier): ``` #### Using customize dataset wrapper in config + Then in the config, to use `MyDatasetWrapper` you can modify the config as the following, + ```python dataset_A_train = dict( type='MyDatasetWrapper', diff --git a/docs/en/classification/customize_models.md b/docs/en/classification/customize_models.md index a7f87d1..fadcd56 100644 --- a/docs/en/classification/customize_models.md +++ b/docs/en/classification/customize_models.md @@ -204,7 +204,6 @@ model = dict( ### Add new loss - To add a new loss function, the users need implement it in `mmfewshot/classification/models/losses/my_loss.py`. The decorator `weighted_loss` enable the loss to be weighted for each element. diff --git a/docs/en/classification/customize_runtime.md b/docs/en/classification/customize_runtime.md index 3422657..e926803 100644 --- a/docs/en/classification/customize_runtime.md +++ b/docs/en/classification/customize_runtime.md @@ -41,8 +41,8 @@ To find the above module defined above, this module should be imported into the - Modify `mmfewshot/classification/core/optimizer/__init__.py` to import it. - The newly defined module should be imported in `mmfewshot/classification/core/optimizer/__init__.py` so that the registry will - find the new module and add it: + The newly defined module should be imported in `mmfewshot/classification/core/optimizer/__init__.py` so that the registry will + find the new module and add it: ```python from .my_optimizer import MyOptimizer @@ -106,31 +106,31 @@ The default optimizer constructor is implemented [here](https://github.com/open- Tricks not implemented by the optimizer should be implemented through optimizer constructor (e.g., set parameter-wise learning rates) or hooks. We list some common settings that could stabilize the training or accelerate the training. Feel free to create PR, issue for more settings. - __Use gradient clip to stabilize training__: - Some models need gradient clip to clip the gradients to stabilize the training process. An example is as below: + Some models need gradient clip to clip the gradients to stabilize the training process. An example is as below: - ```python - optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) - ``` + ```python + optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) + ``` - __Use momentum schedule to accelerate model convergence__: - We support momentum scheduler to modify model's momentum according to learning rate, which could make the model converge in a faster way. - Momentum scheduler is usually used with LR scheduler, for example, the following config is used in 3D detection to accelerate convergence. - For more details, please refer to the implementation of [CyclicLrUpdater](https://github.com/open-mmlab/mmcv/blob/f48241a65aebfe07db122e9db320c31b685dc674/mmcv/runner/hooks/lr_updater.py#L327) and [CyclicMomentumUpdater](https://github.com/open-mmlab/mmcv/blob/f48241a65aebfe07db122e9db320c31b685dc674/mmcv/runner/hooks/momentum_updater.py#L130). - - ```python - lr_config = dict( - policy='cyclic', - target_ratio=(10, 1e-4), - cyclic_times=1, - step_ratio_up=0.4, - ) - momentum_config = dict( - policy='cyclic', - target_ratio=(0.85 / 0.95, 1), - cyclic_times=1, - step_ratio_up=0.4, - ) - ``` + We support momentum scheduler to modify model's momentum according to learning rate, which could make the model converge in a faster way. + Momentum scheduler is usually used with LR scheduler, for example, the following config is used in 3D detection to accelerate convergence. + For more details, please refer to the implementation of [CyclicLrUpdater](https://github.com/open-mmlab/mmcv/blob/f48241a65aebfe07db122e9db320c31b685dc674/mmcv/runner/hooks/lr_updater.py#L327) and [CyclicMomentumUpdater](https://github.com/open-mmlab/mmcv/blob/f48241a65aebfe07db122e9db320c31b685dc674/mmcv/runner/hooks/momentum_updater.py#L130). + + ```python + lr_config = dict( + policy='cyclic', + target_ratio=(10, 1e-4), + cyclic_times=1, + step_ratio_up=0.4, + ) + momentum_config = dict( + policy='cyclic', + target_ratio=(0.85 / 0.95, 1), + cyclic_times=1, + step_ratio_up=0.4, + ) + ``` ## Customize training schedules @@ -139,20 +139,20 @@ We support many other learning rate schedule [here](https://github.com/open-mmla - Poly schedule: - ```python - lr_config = dict(policy='poly', power=0.9, min_lr=1e-4, by_epoch=False) - ``` + ```python + lr_config = dict(policy='poly', power=0.9, min_lr=1e-4, by_epoch=False) + ``` - ConsineAnnealing schedule: - ```python - lr_config = dict( - policy='CosineAnnealing', - warmup='linear', - warmup_iters=1000, - warmup_ratio=1.0 / 10, - min_lr_ratio=1e-5) - ``` + ```python + lr_config = dict( + policy='CosineAnnealing', + warmup='linear', + warmup_iters=1000, + warmup_ratio=1.0 / 10, + min_lr_ratio=1e-5) + ``` ## Customize workflow @@ -186,6 +186,7 @@ so that 1 epoch for training and 1 epoch for validation will be run iteratively. #### 1. Implement a new hook Here we give an example of creating a new hook in MMFewShot and using it in training. + ```python from mmcv.runner import HOOKS, Hook @@ -223,8 +224,8 @@ Then we need to make `MyHook` imported. Assuming the file is in `mmfewshot/class - Modify `mmfewshot/core/utils/__init__.py` to import it. - The newly defined module should be imported in `mmfewshot/classification/core/utils/__init__.py` so that the registry will - find the new module and add it: + The newly defined module should be imported in `mmfewshot/classification/core/utils/__init__.py` so that the registry will + find the new module and add it: ```python from .my_hook import MyHook @@ -264,11 +265,11 @@ custom_hooks = [ ] ``` - ### Customize self-implemented eval hooks with a dataset Here we give an example of creating a new hook in MMFewShot and using it to evaluate a dataset. To achieve this, we can add following code in `mmfewshot/classification/apis/test.py`. + ```python if validate: ... @@ -296,8 +297,6 @@ data = dict( Then we can replace the `test_single_task` with customized `test_my_single_task` in `single_gpu_meta_test` and `multiple_gpu_meta_test` - - ### Modify default runtime hooks There are some common hooks that are not registered through `custom_hooks`, they are @@ -346,7 +345,6 @@ Except the key `interval`, other arguments such as `metric` will be passed to th evaluation = dict(interval=1, metric='bbox') ``` - ## Customize meta testing We already support two ways to handle the support data, fine-tuning and straight forwarding. diff --git a/docs/en/classification/overview.md b/docs/en/classification/overview.md index d0a4952..0eac901 100644 --- a/docs/en/classification/overview.md +++ b/docs/en/classification/overview.md @@ -5,8 +5,8 @@ is the data usage. Therefore, the design of MMFewShot target at data sampling, meta test and models apis for few shot setting based on [mmcls](https://github.com/open-mmlab/mmclassification). Additionally, the modules in [mmcls](https://github.com/open-mmlab/mmclassification) can be imported and reused in the code or config. - ## Design of data sampling + In MMFewShot, we suggest customizing the data pipeline using a dataset wrapper and modify the arguments in forward function when returning the dict with customize keys. @@ -26,10 +26,11 @@ class CustomizeDataset: 'query_data': [self.dataset[i] for i in self.customize_list] } ``` -More details can refer to [Tutorial 2: Adding New Dataset](https://mmfewshot.readthedocs.io/en/latest/classification/customize_dataset.html) +More details can refer to [Tutorial 2: Adding New Dataset](https://mmfewshot.readthedocs.io/en/latest/classification/customize_dataset.html) ## Design of model APIs + Each model in MMFewShot should implement following functions to support meta testing. More details can refer to [Tutorial 3: Customize Models](https://mmfewshot.readthedocs.io/en/latest/classification/customize_models.html) @@ -67,8 +68,8 @@ class BaseFewShotClassifier(BaseModule): ``` - ## Design of meta testing + Meta testing performs prediction on random sampled tasks multiple times. Each task contains support and query data. More details can refer to `mmfewshot/classification/apis/test.py`. @@ -96,6 +97,7 @@ Here is the basic pipeline for meta testing: ``` ### meta testing on multiple gpus + In MMFewShot, we also support multi-gpu meta testing during validation or testing phase. In multi-gpu meta testing, the model will be copied and wrapped with `MetaTestParallel`, which will @@ -104,6 +106,7 @@ Thus, the original model will not be affected by the operations in Meta Testing. More details can refer to `mmfewshot/classification/utils/meta_test_parallel.py` Specifically, each gpu will be assigned with (num_test_tasks / world_size) task. Here is the distributed logic for multi gpu meta testing: + ```python sub_num_test_tasks = num_test_tasks // world_size sub_num_test_tasks += 1 if num_test_tasks % world_size != 0 else 0 @@ -114,4 +117,5 @@ for i in range(sub_num_test_tasks): # test task with task_id ... ``` + If user want to customize the way to test a task, more details can refer to [Tutorial 4: Customize Runtime Settings](https://mmfewshot.readthedocs.io/en/latest/classification/customize_runtime.html) diff --git a/docs/en/detection/customize_config.md b/docs/en/detection/customize_config.md index cb47467..bc2b6ba 100644 --- a/docs/en/detection/customize_config.md +++ b/docs/en/detection/customize_config.md @@ -5,7 +5,6 @@ If you wish to inspect the config file, you may run `python tools/misc/print_con The detection part of mmfewshot is built upon the [mmdet](https://github.com/open-mmlab/mmdetection), thus it is highly recommended learning the basic of [mmdet](https://mmdetection.readthedocs.io/en/latest/). - ## Modify a config through script arguments When submitting jobs using "tools/train.py" or "tools/test.py", you may specify `--cfg-options` to in-place modify the config. @@ -24,7 +23,7 @@ When submitting jobs using "tools/train.py" or "tools/test.py", you may specify - Update values of list/tuples. If the value to be updated is a list or a tuple. For example, the config file normally sets `workflow=[('train', 1)]`. If you want to - change this key, you may specify `--cfg-options workflow="[(train,1),(val,1)]"`. Note that the quotation mark \" is necessary to + change this key, you may specify `--cfg-options workflow="[(train,1),(val,1)]"`. Note that the quotation mark " is necessary to support list/tuple data types, and that **NO** white space is allowed inside the quotation marks in the specified value. ## Config file naming convention @@ -42,7 +41,7 @@ We follow the below style to name config files. Contributors are advised to foll - `{backbone}`: backbone type like `r50` (ResNet-50), `x101` (ResNeXt-101). - `{neck}`: neck type like `fpn`, `c4`. - `[norm_setting]`: `bn` (Batch Normalization) is used unless specified, other norm layer type could be `gn` (Group Normalization), `syncbn` (Synchronized Batch Normalization). - `gn-head`/`gn-neck` indicates GN is applied in head/neck only, while `gn-all` means GN is applied in the entire model, e.g. backbone, neck, head. + `gn-head`/`gn-neck` indicates GN is applied in head/neck only, while `gn-all` means GN is applied in the entire model, e.g. backbone, neck, head. - `[misc]`: miscellaneous setting/plugins of model, e.g. `dconv`, `gcb`, `attention`, `albu`, `mstrain`. - `[gpu x batch_per_gpu]`: GPUs and samples per GPU, `8xb2` is used by default. - `{dataset}`: dataset like `coco`, `voc-split1`, `voc-split2` and `voc-split3`. diff --git a/docs/en/detection/customize_dataset.md b/docs/en/detection/customize_dataset.md index 59ff6de..5a9188f 100644 --- a/docs/en/detection/customize_dataset.md +++ b/docs/en/detection/customize_dataset.md @@ -1,30 +1,37 @@ # Tutorial 2: Adding New Dataset - ## Customize dataset ### Load annotations from file + Different from the config in mmdet using `ann_file` to load a single dataset, we use `ann_cfg` to support the complex few shot setting. The `ann_cfg` is a list of dict and support two type of file: + - loading annotation from the regular `ann_file` of dataset. - ```python - ann_cfg = [dict(type='ann_file', ann_file='path/to/ann_file'), ...] - ``` - For `FewShotVOCDataset`, we also support load specific class from `ann_file` in `ann_classes`. - ```python - dict(type='ann_file', ann_file='path/to/ann_file', ann_classes=['dog', 'cat']) - ``` + + ```python + ann_cfg = [dict(type='ann_file', ann_file='path/to/ann_file'), ...] + ``` + + For `FewShotVOCDataset`, we also support load specific class from `ann_file` in `ann_classes`. + + ```python + dict(type='ann_file', ann_file='path/to/ann_file', ann_classes=['dog', 'cat']) + ``` - loading annotation from a json file saved by a dataset. - ```python - ann_cfg = [dict(type='saved_dataset', ann_file='path/to/ann_file'), ...] - ``` - To save a dataset, we can set the `save_dataset=True` in config file, - and the dataset will be saved as `${WORK_DIR}/{TIMESTAMP}_saved_data.json` - ```python - dataset=dict(type='FewShotVOCDataset', save_dataset=True, ...) - ``` + + ```python + ann_cfg = [dict(type='saved_dataset', ann_file='path/to/ann_file'), ...] + ``` + + To save a dataset, we can set the `save_dataset=True` in config file, + and the dataset will be saved as `${WORK_DIR}/{TIMESTAMP}_saved_data.json` + + ```python + dataset=dict(type='FewShotVOCDataset', save_dataset=True, ...) + ``` ### Load annotations from predefined benchmark @@ -40,6 +47,7 @@ We provide data splits of each reproduced checkpoint for each method. In config file, we can use `method` and `setting` to determine which data split to load. Here is an example of config: + ```python dataset = dict( type='FewShotVOCDefaultDataset', @@ -54,6 +62,7 @@ during runtime for some special cases, such as copying online random sampled sup It needs user to modify code in `mmfewshot.detection.apis`. More details can refer to mmfewshot/detection/apis/train.py. Here is an example of config: + ```python dataset = dict( type='FewShotVOCCopyDataset', @@ -61,13 +70,15 @@ dataset = dict( ``` ### Use predefined class splits + The predefined class splits are supported in datasets. -For VOC, we support [`ALL_CLASSES_SPLIT1`,`ALL_CLASSES_SPLIT2`, `ALL_CLASSES_SPLIT3`, +For VOC, we support \[`ALL_CLASSES_SPLIT1`,`ALL_CLASSES_SPLIT2`, `ALL_CLASSES_SPLIT3`, `NOVEL_CLASSES_SPLIT1`, `NOVEL_CLASSES_SPLIT2`, `NOVEL_CLASSES_SPLIT3`, `BASE_CLASSES_SPLIT1`, -`BASE_CLASSES_SPLIT2`, `BASE_CLASSES_SPLIT3`]. -For COCO, we support [`ALL_CLASSES`, `NOVEL_CLASSES`, `BASE_CLASSES`] +`BASE_CLASSES_SPLIT2`, `BASE_CLASSES_SPLIT3`\]. +For COCO, we support \[`ALL_CLASSES`, `NOVEL_CLASSES`, `BASE_CLASSES`\] Here is an example of config: + ```python data = dict( train=dict(type='FewShotVOCDataset', classes='ALL_CLASSES_SPLIT1'), @@ -77,12 +88,15 @@ data = dict( Also, the class splits can be used to report the evaluation results on different class splits. Here is an example of config: + ```python evaluation = dict(class_splits=['BASE_CLASSES_SPLIT1', 'NOVEL_CLASSES_SPLIT1']) ``` ### Customize the number of annotations + For FewShotDataset, we support two ways to filter extra annotations. + - `ann_shot_filter`: use a dict to specify the class, and the corresponding maximum number of instances when loading the annotation file. @@ -105,8 +119,10 @@ For FewShotDataset, we support two ways to filter extra annotations. ``` ### Customize the organization of annotations + We also support to split the annotation into instance wise, i.e. each image only have one instance, and the images can be repeated. + ```python dataset=dict( type='FewShotVOCDataset', @@ -115,9 +131,11 @@ dataset=dict( ``` ### Customize pipeline + To support different pipelines in single dataset, we can use `multi_pipelines`. In config file, `multi_pipelines` use the name of keys to indicate specific piplines. Here is an example of config: + ```python multi_pipelines = dict( query=[ @@ -145,20 +163,23 @@ train=dict( ... multi_pipelines=train_multi_pipelines)) ``` + When `multi_pipelines` is used, we need to specific the pipeline names in `prepare_train_img` to fetch the image. For example + ```python dataset.prepare_train_img(self, idx, 'query') ``` - ## Customize a new dataset wrapper + In few shot setting, the various sampling logic is implemented by dataset wrapper. An example of customizing query-support data sampling logic for training: #### Create a new dataset wrapper + We can create a new dataset wrapper in mmfewshot/detection/datasets/dataset_wrappers.py to customize sampling logic. ```python @@ -185,10 +206,10 @@ class MyDatasetWrapper: ``` #### Update dataset builder + We need to add the building code in mmfewshot/detection/datasets/builder.py for our customize dataset wrapper. - ```python def build_dataset(cfg, default_args=None): if isinstance(cfg, (list, tuple)): @@ -209,11 +230,11 @@ def build_dataset(cfg, default_args=None): ``` #### Update dataloader builder + We need to add the building code of dataloader in mmfewshot/detection/datasets/builder.py, when the customize dataset wrapper will return list of Tensor. We can use `multi_pipeline_collate_fn` to handle this case. - ```python def build_dataset(cfg, default_args=None): ... @@ -234,7 +255,6 @@ def build_dataset(cfg, default_args=None): ... ``` - #### Update the arguments in model The argument names in forward function need to be consistent with the customize dataset wrapper. @@ -247,7 +267,9 @@ class MyDetector(BaseDetector): ``` #### using customize dataset wrapper in config + Then in the config, to use `MyDatasetWrapper` you can modify the config as the following, + ```python dataset_A_train = dict( type='MyDatasetWrapper', @@ -262,12 +284,14 @@ dataset_A_train = dict( ) ``` - ## Customize a dataloader wrapper + We also support to iterate two different dataset simultaneously by dataloader wrapper. An example of customizing dataloader wrapper for query and support dataset: + #### Create a new dataloader wrapper + We can create a new dataset wrapper in mmfewshot/detection/datasets/dataloader_wrappers.py to customize sampling logic. ```python @@ -293,10 +317,10 @@ class MyDataloader: ``` #### Update dataloader builder + We need to add the build code in mmfewshot/detection/datasets/builder.py for our customize dataset wrapper. - ```python def build_dataloader(dataset, ...): if isinstance(dataset, MyDataset): diff --git a/docs/en/detection/customize_models.md b/docs/en/detection/customize_models.md index 92c3a49..389af38 100644 --- a/docs/en/detection/customize_models.md +++ b/docs/en/detection/customize_models.md @@ -8,7 +8,6 @@ We basically categorize model components into 5 types the same as mmdet. - roi extractor: the part for extracting RoI features from feature maps, e.g., RoI Align. - loss: the component in head for calculating losses, e.g., FocalLoss, L1Loss, and GHMLoss. - ## Develop new components ### Add a new detector @@ -371,6 +370,7 @@ loss_bbox=dict(type='MyLoss', loss_weight=1.0)) We support `frozen_parameters` to freeze the parameters during training by parameters' prefix. For example, in `roi_head` if we only want to freeze the `shared_fcs` in `bbox_head`, we can add `roi_head.bbox_head.shared_fcs` into `frozen_parameters` list. + ```python model = dict( frozen_parameters=[ @@ -379,6 +379,7 @@ model = dict( ``` ## Customize a query-support based detector + Here we show how to develop a new query-support based detector with the example. ### 1. Define a new detector @@ -437,8 +438,10 @@ model = dict( ``` ### Customize an aggregation layer + we also support to reuse the code of feature fusion from different data usually used in query support based methods. Here we show how to develop a new aggregator with the example. + #### 1. Define a new aggregator Add customize code in `mmfewshot/detection/models/utils/aggregation_layer.py`. diff --git a/docs/en/detection/customize_runtime.md b/docs/en/detection/customize_runtime.md index 0fba46e..c6caa9c 100644 --- a/docs/en/detection/customize_runtime.md +++ b/docs/en/detection/customize_runtime.md @@ -41,8 +41,8 @@ To find the above module defined above, this module should be imported into the - Modify `mmfewshot/detection/core/optimizer/__init__.py` to import it. - The newly defined module should be imported in `mmfewshot/detection/core/optimizer/__init__.py` so that the registry will - find the new module and add it: + The newly defined module should be imported in `mmfewshot/detection/core/optimizer/__init__.py` so that the registry will + find the new module and add it: ```python from .my_optimizer import MyOptimizer @@ -106,31 +106,31 @@ The default optimizer constructor is implemented [here](https://github.com/open- Tricks not implemented by the optimizer should be implemented through optimizer constructor (e.g., set parameter-wise learning rates) or hooks. We list some common settings that could stabilize the training or accelerate the training. Feel free to create PR, issue for more settings. - __Use gradient clip to stabilize training__: - Some models need gradient clip to clip the gradients to stabilize the training process. An example is as below: + Some models need gradient clip to clip the gradients to stabilize the training process. An example is as below: - ```python - optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) - ``` + ```python + optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) + ``` - __Use momentum schedule to accelerate model convergence__: - We support momentum scheduler to modify model's momentum according to learning rate, which could make the model converge in a faster way. - Momentum scheduler is usually used with LR scheduler, for example, the following config is used in 3D detection to accelerate convergence. - For more details, please refer to the implementation of [CyclicLrUpdater](https://github.com/open-mmlab/mmcv/blob/f48241a65aebfe07db122e9db320c31b685dc674/mmcv/runner/hooks/lr_updater.py#L327) and [CyclicMomentumUpdater](https://github.com/open-mmlab/mmcv/blob/f48241a65aebfe07db122e9db320c31b685dc674/mmcv/runner/hooks/momentum_updater.py#L130). - - ```python - lr_config = dict( - policy='cyclic', - target_ratio=(10, 1e-4), - cyclic_times=1, - step_ratio_up=0.4, - ) - momentum_config = dict( - policy='cyclic', - target_ratio=(0.85 / 0.95, 1), - cyclic_times=1, - step_ratio_up=0.4, - ) - ``` + We support momentum scheduler to modify model's momentum according to learning rate, which could make the model converge in a faster way. + Momentum scheduler is usually used with LR scheduler, for example, the following config is used in 3D detection to accelerate convergence. + For more details, please refer to the implementation of [CyclicLrUpdater](https://github.com/open-mmlab/mmcv/blob/f48241a65aebfe07db122e9db320c31b685dc674/mmcv/runner/hooks/lr_updater.py#L327) and [CyclicMomentumUpdater](https://github.com/open-mmlab/mmcv/blob/f48241a65aebfe07db122e9db320c31b685dc674/mmcv/runner/hooks/momentum_updater.py#L130). + + ```python + lr_config = dict( + policy='cyclic', + target_ratio=(10, 1e-4), + cyclic_times=1, + step_ratio_up=0.4, + ) + momentum_config = dict( + policy='cyclic', + target_ratio=(0.85 / 0.95, 1), + cyclic_times=1, + step_ratio_up=0.4, + ) + ``` ## Customize training schedules @@ -139,20 +139,20 @@ We support many other learning rate schedule [here](https://github.com/open-mmla - Poly schedule: - ```python - lr_config = dict(policy='poly', power=0.9, min_lr=1e-4, by_epoch=False) - ``` + ```python + lr_config = dict(policy='poly', power=0.9, min_lr=1e-4, by_epoch=False) + ``` - ConsineAnnealing schedule: - ```python - lr_config = dict( - policy='CosineAnnealing', - warmup='linear', - warmup_iters=1000, - warmup_ratio=1.0 / 10, - min_lr_ratio=1e-5) - ``` + ```python + lr_config = dict( + policy='CosineAnnealing', + warmup='linear', + warmup_iters=1000, + warmup_ratio=1.0 / 10, + min_lr_ratio=1e-5) + ``` ## Customize workflow @@ -186,6 +186,7 @@ so that 1 epoch for training and 1 epoch for validation will be run iteratively. #### 1. Implement a new hook Here we give an example of creating a new hook in MMPose and using it in training. + ```python from mmcv.runner import HOOKS, Hook @@ -223,8 +224,8 @@ Then we need to make `MyHook` imported. Assuming the file is in `mmfewshot/detec - Modify `mmfewshot/core/utils/__init__.py` to import it. - The newly defined module should be imported in `mmfewshot/detection/core/utils/__init__.py` so that the registry will - find the new module and add it: + The newly defined module should be imported in `mmfewshot/detection/core/utils/__init__.py` so that the registry will + find the new module and add it: ```python from .my_hook import MyHook diff --git a/docs/en/detection/overview.md b/docs/en/detection/overview.md index a9d66c2..b9c0c5d 100644 --- a/docs/en/detection/overview.md +++ b/docs/en/detection/overview.md @@ -1,30 +1,35 @@ # Tutorial 0: Overview of MMFewShot Detection + The main difference between general classification task and few shot classification task is the data usage. Therefore, the design of MMFewShot targets at data flows for few shot setting based on [mmdet](https://github.com/open-mmlab/mmdetection). Additionally, the modules in [mmdet](https://github.com/open-mmlab/mmdetection) can be imported and reused in the code or config. ## Design of data flow + Since MMFewShot is built upon the [mmdet](https://mmdetection.readthedocs.io/en/latest), all the datasets in mmdet can be configured in the config file. If user want to use the dataset from mmdet, please refer to [mmdet](https://mmdetection.readthedocs.io/en/latest/tutorials/customize_dataset.html) for more details. In MMFewShot, there are three important components for fetching data: + - Datasets: loading annotations from `ann_cfg` and filtering images and annotations for few shot setting. - Dataset Wrappers: determining the sampling logic, such as sampling support images according to query image. - Dataloader Wrappers: encapsulate the data from multiple datasets. In summary, we currently support 4 different data flow for training: + - fine-tune based: it is the same as regular detection. - query aware: it will return query data and support data from same dataset. - n way k shot: it will first sample query data (regular) and support data (N way k shot) from separate datasets and then encapsulate them by dataloader wrapper. - two branch: it will first sample main data (regular) and auxiliary data (regular) from separate datasets and then encapsulate them by dataloader wrapper. For testing: + - regular testing: it is the same as regular detection. - testing for query-support based detector: there will be a model initialization step before testing, it is implemented -by `QuerySupportEvalHook`. More implementation details can refer to `mmfewshot.detection.core.evaluation.eval_hooks` + by `QuerySupportEvalHook`. More implementation details can refer to `mmfewshot.detection.core.evaluation.eval_hooks` ![](../_static/image/detection_data_flow.jpg) diff --git a/docs/en/faq.md b/docs/en/faq.md index 4c75816..08bbd58 100644 --- a/docs/en/faq.md +++ b/docs/en/faq.md @@ -4,81 +4,85 @@ We list some common troubles faced by many users and their corresponding solutio ## MMCV Installation -- Compatibility issue between MMCV and MMDetection; "ConvWS is already registered in conv layer"; "AssertionError: MMCV==xxx is used but incompatible. Please install mmcv>=xxx, <=xxx." +- Compatibility issue between MMCV and MMDetection; "ConvWS is already registered in conv layer"; "AssertionError: MMCV==xxx is used but incompatible. Please install mmcv>=xxx, \<=xxx." Please install the correct version of MMCV for the version of your MMDetection following the [installation instruction](https://mmdetection.readthedocs.io/en/latest/get_started.html#installation). -- "No module named 'mmcv.ops'"; "No module named 'mmcv._ext'". +- "No module named 'mmcv.ops'"; "No module named 'mmcv.\_ext'". - 1. Uninstall existing mmcv in the environment using `pip uninstall mmcv`. - 2. Install mmcv-full following the [installation instruction](https://mmcv.readthedocs.io/en/latest/#installation). + 1. Uninstall existing mmcv in the environment using `pip uninstall mmcv`. + 2. Install mmcv-full following the [installation instruction](https://mmcv.readthedocs.io/en/latest/#installation). ## PyTorch/CUDA Environment - - "invalid device function" or "no kernel image is available for execution". - 1. Check if your cuda runtime version (under `/usr/local/`), `nvcc --version` and `conda list cudatoolkit` version match. - 2. Run `python mmdet/utils/collect_env.py` to check whether PyTorch, torchvision, and MMCV are built for the correct GPU architecture. - You may need to set `TORCH_CUDA_ARCH_LIST` to reinstall MMCV. - The GPU arch table could be found [here](https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#gpu-feature-list), - i.e. run `TORCH_CUDA_ARCH_LIST=7.0 pip install mmcv-full` to build MMCV for Volta GPUs. - The compatibility issue could happen when using old GPUS, e.g., Tesla K80 (3.7) on colab. - 3. Check whether the running environment is the same as that when mmcv/mmdet has compiled. - For example, you may compile mmcv using CUDA 10.0 but run it on CUDA 9.0 environments. + 1. Check if your cuda runtime version (under `/usr/local/`), `nvcc --version` and `conda list cudatoolkit` version match. + 2. Run `python mmdet/utils/collect_env.py` to check whether PyTorch, torchvision, and MMCV are built for the correct GPU architecture. + You may need to set `TORCH_CUDA_ARCH_LIST` to reinstall MMCV. + The GPU arch table could be found [here](https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#gpu-feature-list), + i.e. run `TORCH_CUDA_ARCH_LIST=7.0 pip install mmcv-full` to build MMCV for Volta GPUs. + The compatibility issue could happen when using old GPUS, e.g., Tesla K80 (3.7) on colab. + 3. Check whether the running environment is the same as that when mmcv/mmdet has compiled. + For example, you may compile mmcv using CUDA 10.0 but run it on CUDA 9.0 environments. - "undefined symbol" or "cannot open xxx.so". - 1. If those symbols are CUDA/C++ symbols (e.g., libcudart.so or GLIBCXX), check whether the CUDA/GCC runtimes are the same as those used for compiling mmcv, - i.e. run `python mmdet/utils/collect_env.py` to see if `"MMCV Compiler"`/`"MMCV CUDA Compiler"` is the same as `"GCC"`/`"CUDA_HOME"`. - 2. If those symbols are PyTorch symbols (e.g., symbols containing caffe, aten, and TH), check whether the PyTorch version is the same as that used for compiling mmcv. - 3. Run `python mmdet/utils/collect_env.py` to check whether PyTorch, torchvision, and MMCV are built by and running on the same environment. + 1. If those symbols are CUDA/C++ symbols (e.g., libcudart.so or GLIBCXX), check whether the CUDA/GCC runtimes are the same as those used for compiling mmcv, + i.e. run `python mmdet/utils/collect_env.py` to see if `"MMCV Compiler"`/`"MMCV CUDA Compiler"` is the same as `"GCC"`/`"CUDA_HOME"`. + 2. If those symbols are PyTorch symbols (e.g., symbols containing caffe, aten, and TH), check whether the PyTorch version is the same as that used for compiling mmcv. + 3. Run `python mmdet/utils/collect_env.py` to check whether PyTorch, torchvision, and MMCV are built by and running on the same environment. - setuptools.sandbox.UnpickleableException: DistutilsSetupError("each element of 'ext_modules' option must be an Extension instance or 2-tuple") - 1. If you are using miniconda rather than anaconda, check whether Cython is installed as indicated in [#3379](https://github.com/open-mmlab/mmdetection/issues/3379). - You need to manually install Cython first and then run command `pip install -r requirements.txt`. - 2. You may also need to check the compatibility between the `setuptools`, `Cython`, and `PyTorch` in your environment. + 1. If you are using miniconda rather than anaconda, check whether Cython is installed as indicated in [#3379](https://github.com/open-mmlab/mmdetection/issues/3379). + You need to manually install Cython first and then run command `pip install -r requirements.txt`. + 2. You may also need to check the compatibility between the `setuptools`, `Cython`, and `PyTorch` in your environment. - "Segmentation fault". - 1. Check you GCC version and use GCC 5.4. This usually caused by the incompatibility between PyTorch and the environment (e.g., GCC < 4.9 for PyTorch). We also recommend the users to avoid using GCC 5.5 because many feedbacks report that GCC 5.5 will cause "segmentation fault" and simply changing it to GCC 5.4 could solve the problem. - 2. Check whether PyTorch is correctly installed and could use CUDA op, e.g. type the following command in your terminal. + 1. Check you GCC version and use GCC 5.4. This usually caused by the incompatibility between PyTorch and the environment (e.g., GCC \< 4.9 for PyTorch). We also recommend the users to avoid using GCC 5.5 because many feedbacks report that GCC 5.5 will cause "segmentation fault" and simply changing it to GCC 5.4 could solve the problem. + + 2. Check whether PyTorch is correctly installed and could use CUDA op, e.g. type the following command in your terminal. - ```shell - python -c 'import torch; print(torch.cuda.is_available())' - ``` + ```shell + python -c 'import torch; print(torch.cuda.is_available())' + ``` - And see whether they could correctly output results. + And see whether they could correctly output results. - 3. If Pytorch is correctly installed, check whether MMCV is correctly installed. + 3. If Pytorch is correctly installed, check whether MMCV is correctly installed. - ```shell - python -c 'import mmcv; import mmcv.ops' - ``` + ```shell + python -c 'import mmcv; import mmcv.ops' + ``` - If MMCV is correctly installed, then there will be no issue of the above two commands. + If MMCV is correctly installed, then there will be no issue of the above two commands. - 4. If MMCV and Pytorch is correctly installed, you man use `ipdb`, `pdb` to set breakpoints or directly add 'print' in mmdetection code and see which part leads the segmentation fault. + 4. If MMCV and Pytorch is correctly installed, you man use `ipdb`, `pdb` to set breakpoints or directly add 'print' in mmdetection code and see which part leads the segmentation fault. ## Training - "Loss goes Nan" - 1. Check if the dataset annotations are valid: zero-size bounding boxes will cause the regression loss to be Nan due to the commonly used transformation for box regression. Some small size (width or height are smaller than 1) boxes will also cause this problem after data augmentation (e.g., instaboost). So check the data and try to filter out those zero-size boxes and skip some risky augmentations on the small-size boxes when you face the problem. - 2. Reduce the learning rate: the learning rate might be too large due to some reasons, e.g., change of batch size. You can rescale them to the value that could stably train the model. - 3. Extend the warmup iterations: some models are sensitive to the learning rate at the start of the training. You can extend the warmup iterations, e.g., change the `warmup_iters` from 500 to 1000 or 2000. - 4. Add gradient clipping: some models requires gradient clipping to stabilize the training process. The default of `grad_clip` is `None`, you can add gradient clippint to avoid gradients that are too large, i.e., set `optimizer_config=dict(_delete_=True, grad_clip=dict(max_norm=35, norm_type=2))` in your config file. If your config does not inherits from any basic config that contains `optimizer_config=dict(grad_clip=None)`, you can simply add `optimizer_config=dict(grad_clip=dict(max_norm=35, norm_type=2))`. + + 1. Check if the dataset annotations are valid: zero-size bounding boxes will cause the regression loss to be Nan due to the commonly used transformation for box regression. Some small size (width or height are smaller than 1) boxes will also cause this problem after data augmentation (e.g., instaboost). So check the data and try to filter out those zero-size boxes and skip some risky augmentations on the small-size boxes when you face the problem. + 2. Reduce the learning rate: the learning rate might be too large due to some reasons, e.g., change of batch size. You can rescale them to the value that could stably train the model. + 3. Extend the warmup iterations: some models are sensitive to the learning rate at the start of the training. You can extend the warmup iterations, e.g., change the `warmup_iters` from 500 to 1000 or 2000. + 4. Add gradient clipping: some models requires gradient clipping to stabilize the training process. The default of `grad_clip` is `None`, you can add gradient clippint to avoid gradients that are too large, i.e., set `optimizer_config=dict(_delete_=True, grad_clip=dict(max_norm=35, norm_type=2))` in your config file. If your config does not inherits from any basic config that contains `optimizer_config=dict(grad_clip=None)`, you can simply add `optimizer_config=dict(grad_clip=dict(max_norm=35, norm_type=2))`. + - ’GPU out of memory" - 1. There are some scenarios when there are large amounts of ground truth boxes, which may cause OOM during target assignment. You can set `gpu_assign_thr=N` in the config of assigner thus the assigner will calculate box overlaps through CPU when there are more than N GT boxes. - 2. Set `with_cp=True` in the backbone. This uses the sublinear strategy in PyTorch to reduce GPU memory cost in the backbone. - 3. Try mixed precision training using following the examples in `config/fp16`. The `loss_scale` might need further tuning for different models. + + 1. There are some scenarios when there are large amounts of ground truth boxes, which may cause OOM during target assignment. You can set `gpu_assign_thr=N` in the config of assigner thus the assigner will calculate box overlaps through CPU when there are more than N GT boxes. + 2. Set `with_cp=True` in the backbone. This uses the sublinear strategy in PyTorch to reduce GPU memory cost in the backbone. + 3. Try mixed precision training using following the examples in `config/fp16`. The `loss_scale` might need further tuning for different models. - "RuntimeError: Expected to have finished reduction in the prior iteration before starting a new one" - 1. This error indicates that your module has parameters that were not used in producing loss. This phenomenon may be caused by running different branches in your code in DDP mode. - 2. You can set ` find_unused_parameters = True` in the config to solve the above problems or find those unused parameters manually. + + 1. This error indicates that your module has parameters that were not used in producing loss. This phenomenon may be caused by running different branches in your code in DDP mode. + 2. You can set ` find_unused_parameters = True` in the config to solve the above problems or find those unused parameters manually. ## Evaluation - COCO Dataset, AP or AR = -1 - 1. According to the definition of COCO dataset, the small and medium areas in an image are less than 1024 (32\*32), 9216 (96\*96), respectively. - 2. If the corresponding area has no object, the result of AP and AR will set to -1. + 1. According to the definition of COCO dataset, the small and medium areas in an image are less than 1024 (32\*32), 9216 (96\*96), respectively. + 2. If the corresponding area has no object, the result of AP and AR will set to -1. diff --git a/docs/en/get_started.md b/docs/en/get_started.md index 52aa31d..231f75f 100644 --- a/docs/en/get_started.md +++ b/docs/en/get_started.md @@ -22,7 +22,6 @@ sh ./tools/dist_test.sh ${CONFIG_FILE} ${CHECKPOINT_FILE} ${GPU_NUM} [optional a python tools/test.py ${CONFIG_FILE} ${CHECKPOINT_FILE} [optional arguments] --launcher slurm ``` - Examples: For classification, inference Baseline on CUB under 5way 1shot setting. @@ -64,7 +63,6 @@ python tools/train.py ${CONFIG_FILE} [optional arguments] We do not recommend users to use CPU for training because it is too slow. We support this feature to allow users to debug on machines without GPU for convenience. - ### Train with multiple GPUs ```shell @@ -82,6 +80,7 @@ Difference between `resume-from` and `load-from`: `load-from` only loads the model weights and the training epoch starts from 0. It is usually used for finetuning. ### Train with multiple machines + If you launch with multiple machines simply connected with ethernet, you can simply run following commands: On the first machine: @@ -98,8 +97,6 @@ NNODES=2 NODE_RANK=1 PORT=$MASTER_PORT MASTER_ADDR=$MASTER_ADDR sh tools/dist_tr Usually it is slow if you do not have high speed networking like InfiniBand. - - If you run MMClassification on a cluster managed with [slurm](https://slurm.schedmd.com/), you can use the script `slurm_train.sh`. (This script also supports single machine training.) ```shell diff --git a/docs/en/install.md b/docs/en/install.md index 361f0e0..b999219 100644 --- a/docs/en/install.md +++ b/docs/en/install.md @@ -9,12 +9,11 @@ - [mmdet](https://mmdetection.readthedocs.io/en/latest/get_started.html#installation) 2.16.0+ - [mmcls](https://mmclassification.readthedocs.io/en/latest/install.html) 0.15.0+ - Compatible MMCV, MMClassification and MMDetection versions are shown as below. Please install the correct version of them to avoid installation issues. -| MMFewShot version | MMCV version | MMClassification version | MMDetection version | -|:-------------------:|:-----------------:|:---------------------------------:|:----------------------------:| -| master | mmcv-full>=1.3.12 | mmdet >= 2.16.0 | mmcls >=0.15.0 | +| MMFewShot version | MMCV version | MMClassification version | MMDetection version | +| :---------------: | :---------------: | :----------------------: | :-----------------: | +| master | mmcv-full>=1.3.12 | mmdet >= 2.16.0 | mmcls >=0.15.0 | **Note:** You need to run `pip uninstall mmcv` first if you have mmcv installed. If mmcv and mmcv-full are both installed, there will be `ModuleNotFoundError`. @@ -50,27 +49,26 @@ pip install -v -e . # or "python setup.py develop" 1. Create a conda virtual environment and activate it. - ```shell - conda create -n openmmlab python=3.7 -y - conda activate openmmlab - ``` + ```shell + conda create -n openmmlab python=3.7 -y + conda activate openmmlab + ``` 2. Install PyTorch and torchvision following the [official instructions](https://pytorch.org/), e.g., - ```shell - conda install pytorch torchvision -c pytorch - ``` - - Note: Make sure that your compilation CUDA version and runtime CUDA version match. - You can check the supported CUDA version for precompiled packages on the [PyTorch website](https://pytorch.org/). + ```shell + conda install pytorch torchvision -c pytorch + ``` - `E.g` If you have CUDA 10.1 installed under `/usr/local/cuda` and would like to install - PyTorch 1.7, you need to install the prebuilt PyTorch with CUDA 10.1. + Note: Make sure that your compilation CUDA version and runtime CUDA version match. + You can check the supported CUDA version for precompiled packages on the [PyTorch website](https://pytorch.org/). - ```shell - conda install pytorch==1.7.0 torchvision==0.8.0 torchaudio==0.7.0 cudatoolkit=10.1 -c pytorch - ``` + `E.g` If you have CUDA 10.1 installed under `/usr/local/cuda` and would like to install + PyTorch 1.7, you need to install the prebuilt PyTorch with CUDA 10.1. + ```shell + conda install pytorch==1.7.0 torchvision==0.8.0 torchaudio==0.7.0 cudatoolkit=10.1 -c pytorch + ``` ### Install MMFewShot @@ -86,45 +84,47 @@ Or you can still install MMFewShot manually: 1. Install mmcv-full. - ```shell - # pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html - pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.10.0/index.html - ``` + ```shell + # pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html + pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.10.0/index.html + ``` - mmcv-full is only compiled on PyTorch 1.x.0 because the compatibility usually holds between 1.x.0 and 1.x.1. If your PyTorch version is 1.x.1, you can install mmcv-full compiled with PyTorch 1.x.0 and it usually works well. + mmcv-full is only compiled on PyTorch 1.x.0 because the compatibility usually holds between 1.x.0 and 1.x.1. If your PyTorch version is 1.x.1, you can install mmcv-full compiled with PyTorch 1.x.0 and it usually works well. - ``` - # We can ignore the micro version of PyTorch - pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.10/index.html - ``` + ``` + # We can ignore the micro version of PyTorch + pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.10/index.html + ``` - See [here](https://github.com/open-mmlab/mmcv#installation) for different versions of MMCV compatible to different PyTorch and CUDA versions. + See [here](https://github.com/open-mmlab/mmcv#installation) for different versions of MMCV compatible to different PyTorch and CUDA versions. - Optionally you can compile mmcv from source if you need to develop both mmcv and mmfewshot. Refer to the [guide](https://github.com/open-mmlab/mmcv#installation) for details. + Optionally you can compile mmcv from source if you need to develop both mmcv and mmfewshot. Refer to the [guide](https://github.com/open-mmlab/mmcv#installation) for details. 2. Install MMClassification and MMDetection. - You can simply install mmclassification and mmdetection with the following command: + You can simply install mmclassification and mmdetection with the following command: - ```shell - pip install mmcls mmdet - ``` + ```shell + pip install mmcls mmdet + ``` 3. Install MMFewShot. - You can simply install mmfewshot with the following command: + You can simply install mmfewshot with the following command: + + ```shell + pip install mmfewshot + ``` - ```shell - pip install mmfewshot - ``` + or clone the repository and then install it: - or clone the repository and then install it: + ```shell + git clone https://github.com/open-mmlab/mmfewshot.git + cd mmfewshot + pip install -r requirements/build.txt + pip install -v -e . # or "python setup.py develop" - ```shell - git clone https://github.com/open-mmlab/mmfewshot.git - cd mmfewshot - pip install -r requirements/build.txt - pip install -v -e . # or "python setup.py develop" + ``` **Note:** @@ -135,8 +135,7 @@ b. If you would like to use `opencv-python-headless` instead of `opencv-python`, you can install it before installing MMCV. c. Some dependencies are optional. Simply running `pip install -v -e .` will - only install the minimum runtime requirements. To use optional dependencies like `albumentations` and `imagecorruptions` either install them manually with `pip install -r requirements/optional.txt` or specify desired extras when calling `pip` (e.g. `pip install -v -e .[optional]`). Valid keys for the extras field are: `all`, `tests`, `build`, and `optional`. - +only install the minimum runtime requirements. To use optional dependencies like `albumentations` and `imagecorruptions` either install them manually with `pip install -r requirements/optional.txt` or specify desired extras when calling `pip` (e.g. `pip install -v -e .[optional]`). Valid keys for the extras field are: `all`, `tests`, `build`, and `optional`. ### Another option: Docker Image @@ -159,7 +158,8 @@ To verify whether MMFewShot is installed correctly, we can run the demo code and Please refer to [few shot classification demo](https://github.com/open-mmlab/mmfewshot/tree/main/demo#few-shot-classification-demo) or [few shot detection demo](https://github.com/open-mmlab/mmfewshot/tree/main/demo#few-shot-detection-demo) - for more details. The demo code is supposed to run successfully upon you finish the installation. +for more details. The demo code is supposed to run successfully upon you finish the installation. ## Dataset Preparation + Please refer to [data preparation](https://github.com/open-mmlab/mmfewshot/tree/main/tools/data) for dataset preparation. diff --git a/docs/en/intro.md b/docs/en/intro.md index 83ffe93..67f8980 100644 --- a/docs/en/intro.md +++ b/docs/en/intro.md @@ -6,6 +6,7 @@ MMFewShot, and provides links to detailed tutorials about MMFewShot. ## What is Few Shot Learning ### Problem definition + Few shot learning aims at generalizing to new tasks based on a limited number of samples using prior knowledge. The prior knowledge usually refers to a large scale training set that has many classes and samples, while the samples in new tasks are never seen in the training set. @@ -15,15 +16,16 @@ predict the class of bird in the query image. Another example in few shot detection is that a detector needs to detect the new categories based on a few instances. In summary, few shot learning focus on two aspects: + - how to embed prior knowledge into models (pre-train with large scale dataset) - how to transfer knowledge to adapt to new tasks (learn on a few labeled samples). -
### Terminologies in few-shot learning + - Training set: every class in the training set has many samples, and it is big enough for training a deep neural network. - Support set: a small set of labeled images and all the classes do not exist in the training set. - Query set: unlabeled images to predict and share the same classes with support set. @@ -33,22 +35,24 @@ In summary, few shot learning focus on two aspects: - For detection, there will be NxK support instances in a support set, and the number of images can be less than NxK. - ### Evaluation + #### Few shot classification + The classes of a dataset will be divided into three disjoint groups: train, test and val set. The evaluation also called meta test, will randomly sample (N way x K shot) labeled support images + Q unlabeled query images from the test set to form a task and get the prediction accuracy of query images in that task. Usually, meta test will repeatedly sample numerous tasks to get a sufficient evaluation and calculate the mean and std of accuracy from all tasks. + #### Few shot detection + The classes of dataset are split into two group, base classes and novel classes. The training set contains all the annotations from base classes and a few annotations from novel classes. The novel classes performance (mAP or AP50) on test set are used for evaluating a few shot detector. - - ### The basic pipeline for few shot learning + We will introduce a simple baseline for all the few shot learning tasks to further illustrate how few shot learning work. The most obvious pipeline is fine-tuning. It usually consists of two steps: train a model on a large scale dataset and then fine-tune on few shot data. @@ -70,9 +74,9 @@ and below is its whole framework: MMFewShot consists of 4 main parts, `datasets`, `models`, `core` and `apis`. - `datasets` is for data loading and data augmentation. In this part, -we support various datasets for classification and detection algorithms, -useful data augmentation transforms in `pipelines` for pre-processing image -and flexible data sampling in `datasetswrappers`. + we support various datasets for classification and detection algorithms, + useful data augmentation transforms in `pipelines` for pre-processing image + and flexible data sampling in `datasetswrappers`. - `models` contains models and loss functions. @@ -91,15 +95,17 @@ Here is a detailed step-by-step guide to learn more about MMFewShot: 3. Refer to the below tutorials to dive deeper: - Few Shot Classification - - [Overview](classification/overview.md) - - [Config](classification/customize_config.md) - - [Customize Dataset](classification/customize_dataset.md) - - [Customize Model](classification/customize_models.md) - - [Customize Runtime](classification/customize_runtime.md) + + - [Overview](classification/overview.md) + - [Config](classification/customize_config.md) + - [Customize Dataset](classification/customize_dataset.md) + - [Customize Model](classification/customize_models.md) + - [Customize Runtime](classification/customize_runtime.md) - Few Shot Detection - - [Overview](detection/overview.md) - - [Config](detection/customize_config.md) - - [Customize Dataset](detection/customize_dataset.md) - - [Customize Model](detection/customize_models.md) - - [Customize Runtime](detection/customize_runtime.md) + + - [Overview](detection/overview.md) + - [Config](detection/customize_config.md) + - [Customize Dataset](detection/customize_dataset.md) + - [Customize Model](detection/customize_models.md) + - [Customize Runtime](detection/customize_runtime.md) diff --git a/docs/en/model_zoo.md b/docs/en/model_zoo.md index 228eebd..39745c1 100644 --- a/docs/en/model_zoo.md +++ b/docs/en/model_zoo.md @@ -1,9 +1,7 @@ # Model Zoo - ## Few Shot Classification Model Zoo - #### Baseline Please refer to [Baseline](https://github.com/open-mmlab/mmfewshot/tree/main/configs/classification/baseline) for details. @@ -36,8 +34,6 @@ Please refer to [NegMargin](https://github.com/open-mmlab/mmfewshot/tree/main/co Please refer to [Meta Baseline](https://github.com/open-mmlab/mmfewshot/tree/main/configs/classification/meta_baseline) for details. - - ## Few Shot Detection Model Zoo #### TFA diff --git a/docs/zh_cn/classification/customize_config.md b/docs/zh_cn/classification/customize_config.md index 91c597a..1e0586b 100644 --- a/docs/zh_cn/classification/customize_config.md +++ b/docs/zh_cn/classification/customize_config.md @@ -5,7 +5,6 @@ If you wish to inspect the config file, you may run `python tools/misc/print_con The classification part of mmfewshot is built upon the [mmcls](https://github.com/open-mmlab/mmclassification), thus it is highly recommended learning the basic of mmcls. - ## Modify config through script arguments When submitting jobs using "tools/classification/train.py" or "tools/classification/test.py", you may specify `--cfg-options` to in-place modify the config. @@ -24,7 +23,7 @@ When submitting jobs using "tools/classification/train.py" or "tools/classificat - Update values of list/tuples. If the value to be updated is a list or a tuple. For example, the config file normally sets `workflow=[('train', 1)]`. If you want to - change this key, you may specify `--cfg-options workflow="[(train,1),(val,1)]"`. Note that the quotation mark \" is necessary to + change this key, you may specify `--cfg-options workflow="[(train,1),(val,1)]"`. Note that the quotation mark " is necessary to support list/tuple data types, and that **NO** white space is allowed inside the quotation marks in the specified value. ## Config Name Style @@ -41,15 +40,12 @@ We follow the below style to name config files. Contributors are advised to foll - `[algorithm setting]`: specific setting for some model, like `without_semantic` for `htc`, `moment` for `reppoints`, etc. - `{backbone}`: backbone type like `conv4`, `resnet12`. - `[norm_setting]`: `bn` (Batch Normalization) is used unless specified, other norm layer type could be `gn` (Group Normalization), `syncbn` (Synchronized Batch Normalization). - `gn-head`/`gn-neck` indicates GN is applied in head/neck only, while `gn-all` means GN is applied in the entire model, e.g. backbone, neck, head. + `gn-head`/`gn-neck` indicates GN is applied in head/neck only, while `gn-all` means GN is applied in the entire model, e.g. backbone, neck, head. - `[gpu x batch_per_gpu]`: GPUs and samples per GPU. For episodic training methods we use the total number of images in one episode, i.e. n classes x (support images+query images). - `[misc]`: miscellaneous setting/plugins of model. - `{dataset}`: dataset like `cub`, `mini-imagenet` and `tiered-imagenet`. - `{meta test setting}`: n way k shot setting like `5way_1shot` or `5way_5shot`. - - - ## An Example of Baseline To help the users have a basic idea of a complete config and the modules in a modern classification system, @@ -249,7 +245,6 @@ lr_config = dict( ## FAQ - ### Use intermediate variables in configs Some intermediate variables are used in the configuration file. The intermediate variables make the configuration file clearer and easier to modify. diff --git a/docs/zh_cn/classification/customize_dataset.md b/docs/zh_cn/classification/customize_dataset.md index db4be88..be00b6f 100644 --- a/docs/zh_cn/classification/customize_dataset.md +++ b/docs/zh_cn/classification/customize_dataset.md @@ -126,6 +126,7 @@ dataset_A_train = dict( An example of customizing data sampling logic for training: #### Create a new dataset wrapper + We can create a new dataset wrapper in mmfewshot/classification/datasets/dataset_wrappers.py to customize sampling logic. ```python @@ -162,10 +163,10 @@ class MyDatasetWrapper: ``` #### Update dataset builder + We need to add the build code in mmfewshot/classification/datasets/builder.py for our customize dataset wrapper. - ```python def build_dataset(cfg, default_args=None): if isinstance(cfg, (list, tuple)): @@ -206,7 +207,9 @@ class MyClassifier(BaseFewShotClassifier): ``` #### using customize dataset wrapper in config + Then in the config, to use `MyDatasetWrapper` you can modify the config as the following, + ```python dataset_A_train = dict( type='MyDatasetWrapper', diff --git a/docs/zh_cn/classification/customize_models.md b/docs/zh_cn/classification/customize_models.md index a7f87d1..fadcd56 100644 --- a/docs/zh_cn/classification/customize_models.md +++ b/docs/zh_cn/classification/customize_models.md @@ -204,7 +204,6 @@ model = dict( ### Add new loss - To add a new loss function, the users need implement it in `mmfewshot/classification/models/losses/my_loss.py`. The decorator `weighted_loss` enable the loss to be weighted for each element. diff --git a/docs/zh_cn/classification/customize_runtime.md b/docs/zh_cn/classification/customize_runtime.md index c7c5b01..035930b 100644 --- a/docs/zh_cn/classification/customize_runtime.md +++ b/docs/zh_cn/classification/customize_runtime.md @@ -41,8 +41,8 @@ To find the above module defined above, this module should be imported into the - Modify `mmfewshot/classification/core/optimizer/__init__.py` to import it. - The newly defined module should be imported in `mmfewshot/classification/core/optimizer/__init__.py` so that the registry will - find the new module and add it: + The newly defined module should be imported in `mmfewshot/classification/core/optimizer/__init__.py` so that the registry will + find the new module and add it: ```python from .my_optimizer import MyOptimizer @@ -106,31 +106,31 @@ The default optimizer constructor is implemented [here](https://github.com/open- Tricks not implemented by the optimizer should be implemented through optimizer constructor (e.g., set parameter-wise learning rates) or hooks. We list some common settings that could stabilize the training or accelerate the training. Feel free to create PR, issue for more settings. - __Use gradient clip to stabilize training__: - Some models need gradient clip to clip the gradients to stabilize the training process. An example is as below: + Some models need gradient clip to clip the gradients to stabilize the training process. An example is as below: - ```python - optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) - ``` + ```python + optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) + ``` - __Use momentum schedule to accelerate model convergence__: - We support momentum scheduler to modify model's momentum according to learning rate, which could make the model converge in a faster way. - Momentum scheduler is usually used with LR scheduler, for example, the following config is used in 3D detection to accelerate convergence. - For more details, please refer to the implementation of [CyclicLrUpdater](https://github.com/open-mmlab/mmcv/blob/f48241a65aebfe07db122e9db320c31b685dc674/mmcv/runner/hooks/lr_updater.py#L327) and [CyclicMomentumUpdater](https://github.com/open-mmlab/mmcv/blob/f48241a65aebfe07db122e9db320c31b685dc674/mmcv/runner/hooks/momentum_updater.py#L130). - - ```python - lr_config = dict( - policy='cyclic', - target_ratio=(10, 1e-4), - cyclic_times=1, - step_ratio_up=0.4, - ) - momentum_config = dict( - policy='cyclic', - target_ratio=(0.85 / 0.95, 1), - cyclic_times=1, - step_ratio_up=0.4, - ) - ``` + We support momentum scheduler to modify model's momentum according to learning rate, which could make the model converge in a faster way. + Momentum scheduler is usually used with LR scheduler, for example, the following config is used in 3D detection to accelerate convergence. + For more details, please refer to the implementation of [CyclicLrUpdater](https://github.com/open-mmlab/mmcv/blob/f48241a65aebfe07db122e9db320c31b685dc674/mmcv/runner/hooks/lr_updater.py#L327) and [CyclicMomentumUpdater](https://github.com/open-mmlab/mmcv/blob/f48241a65aebfe07db122e9db320c31b685dc674/mmcv/runner/hooks/momentum_updater.py#L130). + + ```python + lr_config = dict( + policy='cyclic', + target_ratio=(10, 1e-4), + cyclic_times=1, + step_ratio_up=0.4, + ) + momentum_config = dict( + policy='cyclic', + target_ratio=(0.85 / 0.95, 1), + cyclic_times=1, + step_ratio_up=0.4, + ) + ``` ## Customize training schedules @@ -139,20 +139,20 @@ We support many other learning rate schedule [here](https://github.com/open-mmla - Poly schedule: - ```python - lr_config = dict(policy='poly', power=0.9, min_lr=1e-4, by_epoch=False) - ``` + ```python + lr_config = dict(policy='poly', power=0.9, min_lr=1e-4, by_epoch=False) + ``` - ConsineAnnealing schedule: - ```python - lr_config = dict( - policy='CosineAnnealing', - warmup='linear', - warmup_iters=1000, - warmup_ratio=1.0 / 10, - min_lr_ratio=1e-5) - ``` + ```python + lr_config = dict( + policy='CosineAnnealing', + warmup='linear', + warmup_iters=1000, + warmup_ratio=1.0 / 10, + min_lr_ratio=1e-5) + ``` ## Customize workflow @@ -186,6 +186,7 @@ so that 1 epoch for training and 1 epoch for validation will be run iteratively. #### 1. Implement a new hook Here we give an example of creating a new hook in MMFewShot and using it in training. + ```python from mmcv.runner import HOOKS, Hook @@ -223,8 +224,8 @@ Then we need to make `MyHook` imported. Assuming the file is in `mmfewshot/class - Modify `mmfewshot/core/utils/__init__.py` to import it. - The newly defined module should be imported in `mmfewshot/classification/core/utils/__init__.py` so that the registry will - find the new module and add it: + The newly defined module should be imported in `mmfewshot/classification/core/utils/__init__.py` so that the registry will + find the new module and add it: ```python from .my_hook import MyHook @@ -264,11 +265,11 @@ custom_hooks = [ ] ``` - ### Customize self-implemented eval hooks with a dataset Here we give an example of creating a new hook in MMFewShot and using it to evaluate a dataset. To achieve this, we can add following code in `mmfewshot/classification/apis/test.py`. + ```python if validate: ... @@ -296,8 +297,6 @@ data = dict( Then we can replace the `test_single_task` with customized `test_my_single_task` in `single_gpu_meta_test` and `multiple_gpu_meta_test` - - ### Modify default runtime hooks There are some common hooks that are not registered through `custom_hooks`, they are @@ -346,7 +345,6 @@ Except the key `interval`, other arguments such as `metric` will be passed to th evaluation = dict(interval=1, metric='bbox') ``` - ## Customize Meta Testing We already support two ways to handle the support data, fine-tuning and straight forwarding. diff --git a/docs/zh_cn/classification/overview.md b/docs/zh_cn/classification/overview.md index 72b4dde..fb95a0f 100644 --- a/docs/zh_cn/classification/overview.md +++ b/docs/zh_cn/classification/overview.md @@ -5,8 +5,8 @@ is the data usage. Therefore, the design of MMFewShot target at data sampling, meta test and models apis for few shot setting based on [mmcls](https://github.com/open-mmlab/mmclassification). Additionally, the modules in [mmcls](https://github.com/open-mmlab/mmclassification) can be imported and reused in the code or config. - ## Design of Data Sampling + In MMFewShot, we suggest customizing the data pipeline using a dataset wrapper and modify the arguments in forward function when returning the dict with customize keys. @@ -26,10 +26,11 @@ class CustomizeDataset: 'query_data': [self.dataset[i] for i in self.customize_list] } ``` -More details can refer to [Tutorial 2: Adding New Dataset](https://mmfewshot.readthedocs.io/en/latest/classification/customize_dataset.html) +More details can refer to [Tutorial 2: Adding New Dataset](https://mmfewshot.readthedocs.io/en/latest/classification/customize_dataset.html) ## Design of Models API + Each model in MMFewShot should implement following functions to support meta testing. More details can refer to [Tutorial 3: Customize Models](https://mmfewshot.readthedocs.io/en/latest/classification/customize_models.html) @@ -67,8 +68,8 @@ class BaseFewShotClassifier(BaseModule): ``` - ## Design of Meta Testing + Meta testing performs prediction on random sampled tasks multiple times. Each task contains support and query data. More details can refer to `mmfewshot/classification/apis/test.py`. @@ -96,6 +97,7 @@ Here is the basic pipeline for meta testing: ``` ### meta testing on multiple gpus + In MMFewShot, we also support multi-gpu meta testing during validation or testing phase. In multi-gpu meta testing, the model will be copied and wrapped with `MetaTestParallel`, which will @@ -104,6 +106,7 @@ Thus, the original model will not be affected by the operations in Meta Testing. More details can refer to `mmfewshot/classification/utils/meta_test_parallel.py` Specifically, each gpu will be assigned with (num_test_tasks / world_size) task. Here is the distributed logic for multi gpu meta testing: + ```python sub_num_test_tasks = num_test_tasks // world_size sub_num_test_tasks += 1 if num_test_tasks % world_size != 0 else 0 @@ -114,4 +117,5 @@ for i in range(sub_num_test_tasks): # test task with task_id ... ``` + If user want to customize the way to test a task, more details can refer to [Tutorial 4: Customize Runtime Settings](https://mmfewshot.readthedocs.io/en/latest/classification/customize_runtime.html) diff --git a/docs/zh_cn/detection/customize_config.md b/docs/zh_cn/detection/customize_config.md index 39e8852..d5f7a01 100644 --- a/docs/zh_cn/detection/customize_config.md +++ b/docs/zh_cn/detection/customize_config.md @@ -5,7 +5,6 @@ If you wish to inspect the config file, you may run `python tools/misc/print_con The detection part of mmfewshot is built upon the [mmdet](https://github.com/open-mmlab/mmdetection), thus it is highly recommended learning the basic of [mmdet](https://mmdetection.readthedocs.io/en/latest/). - ## Modify a config through script arguments When submitting jobs using "tools/train.py" or "tools/test.py", you may specify `--cfg-options` to in-place modify the config. @@ -24,7 +23,7 @@ When submitting jobs using "tools/train.py" or "tools/test.py", you may specify - Update values of list/tuples. If the value to be updated is a list or a tuple. For example, the config file normally sets `workflow=[('train', 1)]`. If you want to - change this key, you may specify `--cfg-options workflow="[(train,1),(val,1)]"`. Note that the quotation mark \" is necessary to + change this key, you may specify `--cfg-options workflow="[(train,1),(val,1)]"`. Note that the quotation mark " is necessary to support list/tuple data types, and that **NO** white space is allowed inside the quotation marks in the specified value. ## Config File Naming Convention @@ -42,7 +41,7 @@ We follow the below style to name config files. Contributors are advised to foll - `{backbone}`: backbone type like `r50` (ResNet-50), `x101` (ResNeXt-101). - `{neck}`: neck type like `fpn`, `c4`. - `[norm_setting]`: `bn` (Batch Normalization) is used unless specified, other norm layer type could be `gn` (Group Normalization), `syncbn` (Synchronized Batch Normalization). - `gn-head`/`gn-neck` indicates GN is applied in head/neck only, while `gn-all` means GN is applied in the entire model, e.g. backbone, neck, head. + `gn-head`/`gn-neck` indicates GN is applied in head/neck only, while `gn-all` means GN is applied in the entire model, e.g. backbone, neck, head. - `[misc]`: miscellaneous setting/plugins of model, e.g. `dconv`, `gcb`, `attention`, `albu`, `mstrain`. - `[gpu x batch_per_gpu]`: GPUs and samples per GPU, `8xb2` is used by default. - `{dataset}`: dataset like `coco`, `voc-split1`, `voc-split2` and `voc-split3`. diff --git a/docs/zh_cn/detection/customize_dataset.md b/docs/zh_cn/detection/customize_dataset.md index 4dab66b..8541490 100644 --- a/docs/zh_cn/detection/customize_dataset.md +++ b/docs/zh_cn/detection/customize_dataset.md @@ -1,30 +1,37 @@ # Tutorial 2: Adding New Dataset - ## Customize Dataset ### Load annotations from file + Different from the config in mmdet using `ann_file` to load a single dataset, we use `ann_cfg` to support the complex few shot setting. The `ann_cfg` is a list of dict and support two type of file: + - loading annotation from the regular `ann_file` of dataset. - ```python - ann_cfg = [dict(type='ann_file', ann_file='path/to/ann_file'), ...] - ``` - For `FewShotVOCDataset`, we also support load specific class from `ann_file` in `ann_classes`. - ```python - dict(type='ann_file', ann_file='path/to/ann_file', ann_classes=['dog', 'cat']) - ``` + + ```python + ann_cfg = [dict(type='ann_file', ann_file='path/to/ann_file'), ...] + ``` + + For `FewShotVOCDataset`, we also support load specific class from `ann_file` in `ann_classes`. + + ```python + dict(type='ann_file', ann_file='path/to/ann_file', ann_classes=['dog', 'cat']) + ``` - loading annotation from a json file saved by a dataset. - ```python - ann_cfg = [dict(type='saved_dataset', ann_file='path/to/ann_file'), ...] - ``` - To save a dataset, we can set the `save_dataset=True` in config file, - and the dataset will be saved as `${WORK_DIR}/{TIMESTAMP}_saved_data.json` - ```python - dataset=dict(type='FewShotVOCDataset', save_dataset=True, ...) - ``` + + ```python + ann_cfg = [dict(type='saved_dataset', ann_file='path/to/ann_file'), ...] + ``` + + To save a dataset, we can set the `save_dataset=True` in config file, + and the dataset will be saved as `${WORK_DIR}/{TIMESTAMP}_saved_data.json` + + ```python + dataset=dict(type='FewShotVOCDataset', save_dataset=True, ...) + ``` ### Load annotations from predefined benchmark @@ -40,6 +47,7 @@ We provide data splits of each reproduced checkpoint for each method. In config file, we can use `method` and `setting` to determine which data split to load. Here is an example of config: + ```python dataset = dict( type='FewShotVOCDefaultDataset', @@ -54,6 +62,7 @@ during runtime for some special cases, such as copying online random sampled sup It needs user to modify code in `mmfewshot.detection.apis`. More details can refer to mmfewshot/detection/apis/train.py. Here is an example of config: + ```python dataset = dict( type='FewShotVOCCopyDataset', @@ -61,13 +70,15 @@ dataset = dict( ``` ### Use predefined class splits + The predefined class splits are supported in datasets. -For VOC, we support [`ALL_CLASSES_SPLIT1`,`ALL_CLASSES_SPLIT2`, `ALL_CLASSES_SPLIT3`, +For VOC, we support \[`ALL_CLASSES_SPLIT1`,`ALL_CLASSES_SPLIT2`, `ALL_CLASSES_SPLIT3`, `NOVEL_CLASSES_SPLIT1`, `NOVEL_CLASSES_SPLIT2`, `NOVEL_CLASSES_SPLIT3`, `BASE_CLASSES_SPLIT1`, -`BASE_CLASSES_SPLIT2`, `BASE_CLASSES_SPLIT3`]. -For COCO, we support [`ALL_CLASSES`, `NOVEL_CLASSES`, `BASE_CLASSES`] +`BASE_CLASSES_SPLIT2`, `BASE_CLASSES_SPLIT3`\]. +For COCO, we support \[`ALL_CLASSES`, `NOVEL_CLASSES`, `BASE_CLASSES`\] Here is an example of config: + ```python data = dict( train=dict(type='FewShotVOCDataset', classes='ALL_CLASSES_SPLIT1'), @@ -77,12 +88,15 @@ data = dict( Also, the class splits can be used to report the evaluation results on different class splits. Here is an example of config: + ```python evaluation = dict(class_splits=['BASE_CLASSES_SPLIT1', 'NOVEL_CLASSES_SPLIT1']) ``` ### Customize the number of annotations + For FewShotDataset, we support two ways to filter extra annotations. + - `ann_shot_filter`: use a dict to specify the class, and the corresponding maximum number of instances when loading the annotation file. @@ -105,8 +119,10 @@ For FewShotDataset, we support two ways to filter extra annotations. ``` ### Customize the organization of annotations + We also support to split the annotation into instance wise, i.e. each image only have one instance, and the images can be repeated. + ```python dataset=dict( type='FewShotVOCDataset', @@ -115,9 +131,11 @@ dataset=dict( ``` ### Customize pipeline + To support different pipelines in single dataset, we can use `multi_pipelines`. In config file, `multi_pipelines` use the name of keys to indicate specific piplines. Here is an example of config: + ```python multi_pipelines = dict( query=[ @@ -145,20 +163,23 @@ train=dict( ... multi_pipelines=train_multi_pipelines)) ``` + When `multi_pipelines` is used, we need to specific the pipeline names in `prepare_train_img` to fetch the image. For example + ```python dataset.prepare_train_img(self, idx, 'query') ``` - ## Customize Dataset Wrapper + In few shot setting, the various sampling logic is implemented by dataset wrapper. An example of customizing query-support data sampling logic for training: #### Create a new dataset wrapper + We can create a new dataset wrapper in mmfewshot/detection/datasets/dataset_wrappers.py to customize sampling logic. ```python @@ -185,10 +206,10 @@ class MyDatasetWrapper: ``` #### Update dataset builder + We need to add the building code in mmfewshot/detection/datasets/builder.py for our customize dataset wrapper. - ```python def build_dataset(cfg, default_args=None): if isinstance(cfg, (list, tuple)): @@ -209,11 +230,11 @@ def build_dataset(cfg, default_args=None): ``` #### Update dataloader builder + We need to add the building code of dataloader in mmfewshot/detection/datasets/builder.py, when the customize dataset wrapper will return list of Tensor. We can use `multi_pipeline_collate_fn` to handle this case. - ```python def build_dataset(cfg, default_args=None): ... @@ -234,7 +255,6 @@ def build_dataset(cfg, default_args=None): ... ``` - #### Update the arguments in model The argument names in forward function need to be consistent with the customize dataset wrapper. @@ -247,7 +267,9 @@ class MyDetector(BaseDetector): ``` #### using customize dataset wrapper in config + Then in the config, to use `MyDatasetWrapper` you can modify the config as the following, + ```python dataset_A_train = dict( type='MyDatasetWrapper', @@ -262,12 +284,14 @@ dataset_A_train = dict( ) ``` - ## Customize Dataloader Wrapper + We also support to iterate two different dataset simultaneously by dataloader wrapper. An example of customizing dataloader wrapper for query and support dataset: + #### Create a new dataloader wrapper + We can create a new dataset wrapper in mmfewshot/detection/datasets/dataloader_wrappers.py to customize sampling logic. ```python @@ -293,10 +317,10 @@ class MyDataloader: ``` #### Update dataloader builder + We need to add the build code in mmfewshot/detection/datasets/builder.py for our customize dataset wrapper. - ```python def build_dataloader(dataset, ...): if isinstance(dataset, MyDataset): diff --git a/docs/zh_cn/detection/customize_models.md b/docs/zh_cn/detection/customize_models.md index 92c3a49..389af38 100644 --- a/docs/zh_cn/detection/customize_models.md +++ b/docs/zh_cn/detection/customize_models.md @@ -8,7 +8,6 @@ We basically categorize model components into 5 types the same as mmdet. - roi extractor: the part for extracting RoI features from feature maps, e.g., RoI Align. - loss: the component in head for calculating losses, e.g., FocalLoss, L1Loss, and GHMLoss. - ## Develop new components ### Add a new detector @@ -371,6 +370,7 @@ loss_bbox=dict(type='MyLoss', loss_weight=1.0)) We support `frozen_parameters` to freeze the parameters during training by parameters' prefix. For example, in `roi_head` if we only want to freeze the `shared_fcs` in `bbox_head`, we can add `roi_head.bbox_head.shared_fcs` into `frozen_parameters` list. + ```python model = dict( frozen_parameters=[ @@ -379,6 +379,7 @@ model = dict( ``` ## Customize a query-support based detector + Here we show how to develop a new query-support based detector with the example. ### 1. Define a new detector @@ -437,8 +438,10 @@ model = dict( ``` ### Customize an aggregation layer + we also support to reuse the code of feature fusion from different data usually used in query support based methods. Here we show how to develop a new aggregator with the example. + #### 1. Define a new aggregator Add customize code in `mmfewshot/detection/models/utils/aggregation_layer.py`. diff --git a/docs/zh_cn/detection/customize_runtime.md b/docs/zh_cn/detection/customize_runtime.md index 0fba46e..c6caa9c 100644 --- a/docs/zh_cn/detection/customize_runtime.md +++ b/docs/zh_cn/detection/customize_runtime.md @@ -41,8 +41,8 @@ To find the above module defined above, this module should be imported into the - Modify `mmfewshot/detection/core/optimizer/__init__.py` to import it. - The newly defined module should be imported in `mmfewshot/detection/core/optimizer/__init__.py` so that the registry will - find the new module and add it: + The newly defined module should be imported in `mmfewshot/detection/core/optimizer/__init__.py` so that the registry will + find the new module and add it: ```python from .my_optimizer import MyOptimizer @@ -106,31 +106,31 @@ The default optimizer constructor is implemented [here](https://github.com/open- Tricks not implemented by the optimizer should be implemented through optimizer constructor (e.g., set parameter-wise learning rates) or hooks. We list some common settings that could stabilize the training or accelerate the training. Feel free to create PR, issue for more settings. - __Use gradient clip to stabilize training__: - Some models need gradient clip to clip the gradients to stabilize the training process. An example is as below: + Some models need gradient clip to clip the gradients to stabilize the training process. An example is as below: - ```python - optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) - ``` + ```python + optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) + ``` - __Use momentum schedule to accelerate model convergence__: - We support momentum scheduler to modify model's momentum according to learning rate, which could make the model converge in a faster way. - Momentum scheduler is usually used with LR scheduler, for example, the following config is used in 3D detection to accelerate convergence. - For more details, please refer to the implementation of [CyclicLrUpdater](https://github.com/open-mmlab/mmcv/blob/f48241a65aebfe07db122e9db320c31b685dc674/mmcv/runner/hooks/lr_updater.py#L327) and [CyclicMomentumUpdater](https://github.com/open-mmlab/mmcv/blob/f48241a65aebfe07db122e9db320c31b685dc674/mmcv/runner/hooks/momentum_updater.py#L130). - - ```python - lr_config = dict( - policy='cyclic', - target_ratio=(10, 1e-4), - cyclic_times=1, - step_ratio_up=0.4, - ) - momentum_config = dict( - policy='cyclic', - target_ratio=(0.85 / 0.95, 1), - cyclic_times=1, - step_ratio_up=0.4, - ) - ``` + We support momentum scheduler to modify model's momentum according to learning rate, which could make the model converge in a faster way. + Momentum scheduler is usually used with LR scheduler, for example, the following config is used in 3D detection to accelerate convergence. + For more details, please refer to the implementation of [CyclicLrUpdater](https://github.com/open-mmlab/mmcv/blob/f48241a65aebfe07db122e9db320c31b685dc674/mmcv/runner/hooks/lr_updater.py#L327) and [CyclicMomentumUpdater](https://github.com/open-mmlab/mmcv/blob/f48241a65aebfe07db122e9db320c31b685dc674/mmcv/runner/hooks/momentum_updater.py#L130). + + ```python + lr_config = dict( + policy='cyclic', + target_ratio=(10, 1e-4), + cyclic_times=1, + step_ratio_up=0.4, + ) + momentum_config = dict( + policy='cyclic', + target_ratio=(0.85 / 0.95, 1), + cyclic_times=1, + step_ratio_up=0.4, + ) + ``` ## Customize training schedules @@ -139,20 +139,20 @@ We support many other learning rate schedule [here](https://github.com/open-mmla - Poly schedule: - ```python - lr_config = dict(policy='poly', power=0.9, min_lr=1e-4, by_epoch=False) - ``` + ```python + lr_config = dict(policy='poly', power=0.9, min_lr=1e-4, by_epoch=False) + ``` - ConsineAnnealing schedule: - ```python - lr_config = dict( - policy='CosineAnnealing', - warmup='linear', - warmup_iters=1000, - warmup_ratio=1.0 / 10, - min_lr_ratio=1e-5) - ``` + ```python + lr_config = dict( + policy='CosineAnnealing', + warmup='linear', + warmup_iters=1000, + warmup_ratio=1.0 / 10, + min_lr_ratio=1e-5) + ``` ## Customize workflow @@ -186,6 +186,7 @@ so that 1 epoch for training and 1 epoch for validation will be run iteratively. #### 1. Implement a new hook Here we give an example of creating a new hook in MMPose and using it in training. + ```python from mmcv.runner import HOOKS, Hook @@ -223,8 +224,8 @@ Then we need to make `MyHook` imported. Assuming the file is in `mmfewshot/detec - Modify `mmfewshot/core/utils/__init__.py` to import it. - The newly defined module should be imported in `mmfewshot/detection/core/utils/__init__.py` so that the registry will - find the new module and add it: + The newly defined module should be imported in `mmfewshot/detection/core/utils/__init__.py` so that the registry will + find the new module and add it: ```python from .my_hook import MyHook diff --git a/docs/zh_cn/detection/overview.md b/docs/zh_cn/detection/overview.md index a9d66c2..b9c0c5d 100644 --- a/docs/zh_cn/detection/overview.md +++ b/docs/zh_cn/detection/overview.md @@ -1,30 +1,35 @@ # Tutorial 0: Overview of MMFewShot Detection + The main difference between general classification task and few shot classification task is the data usage. Therefore, the design of MMFewShot targets at data flows for few shot setting based on [mmdet](https://github.com/open-mmlab/mmdetection). Additionally, the modules in [mmdet](https://github.com/open-mmlab/mmdetection) can be imported and reused in the code or config. ## Design of data flow + Since MMFewShot is built upon the [mmdet](https://mmdetection.readthedocs.io/en/latest), all the datasets in mmdet can be configured in the config file. If user want to use the dataset from mmdet, please refer to [mmdet](https://mmdetection.readthedocs.io/en/latest/tutorials/customize_dataset.html) for more details. In MMFewShot, there are three important components for fetching data: + - Datasets: loading annotations from `ann_cfg` and filtering images and annotations for few shot setting. - Dataset Wrappers: determining the sampling logic, such as sampling support images according to query image. - Dataloader Wrappers: encapsulate the data from multiple datasets. In summary, we currently support 4 different data flow for training: + - fine-tune based: it is the same as regular detection. - query aware: it will return query data and support data from same dataset. - n way k shot: it will first sample query data (regular) and support data (N way k shot) from separate datasets and then encapsulate them by dataloader wrapper. - two branch: it will first sample main data (regular) and auxiliary data (regular) from separate datasets and then encapsulate them by dataloader wrapper. For testing: + - regular testing: it is the same as regular detection. - testing for query-support based detector: there will be a model initialization step before testing, it is implemented -by `QuerySupportEvalHook`. More implementation details can refer to `mmfewshot.detection.core.evaluation.eval_hooks` + by `QuerySupportEvalHook`. More implementation details can refer to `mmfewshot.detection.core.evaluation.eval_hooks` ![](../_static/image/detection_data_flow.jpg) diff --git a/docs/zh_cn/faq.md b/docs/zh_cn/faq.md index 9950105..3b015f2 100644 --- a/docs/zh_cn/faq.md +++ b/docs/zh_cn/faq.md @@ -4,87 +4,92 @@ We list some common troubles faced by many users and their corresponding solutio ## MMCV Installation -- Compatibility issue between MMCV and MMDetection; "ConvWS is already registered in conv layer"; "AssertionError: MMCV==xxx is used but incompatible. Please install mmcv>=xxx, <=xxx." +- Compatibility issue between MMCV and MMDetection; "ConvWS is already registered in conv layer"; "AssertionError: MMCV==xxx is used but incompatible. Please install mmcv>=xxx, \<=xxx." Please install the correct version of MMCV for the version of your MMDetection following the [installation instruction](https://mmdetection.readthedocs.io/en/latest/get_started.html#installation). -- "No module named 'mmcv.ops'"; "No module named 'mmcv._ext'". +- "No module named 'mmcv.ops'"; "No module named 'mmcv.\_ext'". - 1. Uninstall existing mmcv in the environment using `pip uninstall mmcv`. - 2. Install mmcv-full following the [installation instruction](https://mmcv.readthedocs.io/en/latest/#installation). + 1. Uninstall existing mmcv in the environment using `pip uninstall mmcv`. + 2. Install mmcv-full following the [installation instruction](https://mmcv.readthedocs.io/en/latest/#installation). ## PyTorch/CUDA Environment - "RTX 30 series card fails when building MMCV or MMDet" - 1. Temporary work-around: do `MMCV_WITH_OPS=1 MMCV_CUDA_ARGS='-gencode=arch=compute_80,code=sm_80' pip install -e .`. - The common issue is `nvcc fatal : Unsupported gpu architecture 'compute_86'`. This means that the compiler should optimize for sm_86, i.e., nvidia 30 series card, but such optimizations have not been supported by CUDA toolkit 11.0. - This work-around modifies the compile flag by adding `MMCV_CUDA_ARGS='-gencode=arch=compute_80,code=sm_80'`, which tells `nvcc` to optimize for **sm_80**, i.e., Nvidia A100. Although A100 is different from the 30 series card, they use similar ampere architecture. This may hurt the performance but it works. - 2. PyTorch developers have updated that the default compiler flags should be fixed by [pytorch/pytorch#47585](https://github.com/pytorch/pytorch/pull/47585). So using PyTorch-nightly may also be able to solve the problem, though we have not tested it yet. + 1. Temporary work-around: do `MMCV_WITH_OPS=1 MMCV_CUDA_ARGS='-gencode=arch=compute_80,code=sm_80' pip install -e .`. + The common issue is `nvcc fatal : Unsupported gpu architecture 'compute_86'`. This means that the compiler should optimize for sm_86, i.e., nvidia 30 series card, but such optimizations have not been supported by CUDA toolkit 11.0. + This work-around modifies the compile flag by adding `MMCV_CUDA_ARGS='-gencode=arch=compute_80,code=sm_80'`, which tells `nvcc` to optimize for **sm_80**, i.e., Nvidia A100. Although A100 is different from the 30 series card, they use similar ampere architecture. This may hurt the performance but it works. + 2. PyTorch developers have updated that the default compiler flags should be fixed by [pytorch/pytorch#47585](https://github.com/pytorch/pytorch/pull/47585). So using PyTorch-nightly may also be able to solve the problem, though we have not tested it yet. - "invalid device function" or "no kernel image is available for execution". - 1. Check if your cuda runtime version (under `/usr/local/`), `nvcc --version` and `conda list cudatoolkit` version match. - 2. Run `python mmdet/utils/collect_env.py` to check whether PyTorch, torchvision, and MMCV are built for the correct GPU architecture. - You may need to set `TORCH_CUDA_ARCH_LIST` to reinstall MMCV. - The GPU arch table could be found [here](https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#gpu-feature-list), - i.e. run `TORCH_CUDA_ARCH_LIST=7.0 pip install mmcv-full` to build MMCV for Volta GPUs. - The compatibility issue could happen when using old GPUS, e.g., Tesla K80 (3.7) on colab. - 3. Check whether the running environment is the same as that when mmcv/mmdet has compiled. - For example, you may compile mmcv using CUDA 10.0 but run it on CUDA 9.0 environments. + 1. Check if your cuda runtime version (under `/usr/local/`), `nvcc --version` and `conda list cudatoolkit` version match. + 2. Run `python mmdet/utils/collect_env.py` to check whether PyTorch, torchvision, and MMCV are built for the correct GPU architecture. + You may need to set `TORCH_CUDA_ARCH_LIST` to reinstall MMCV. + The GPU arch table could be found [here](https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#gpu-feature-list), + i.e. run `TORCH_CUDA_ARCH_LIST=7.0 pip install mmcv-full` to build MMCV for Volta GPUs. + The compatibility issue could happen when using old GPUS, e.g., Tesla K80 (3.7) on colab. + 3. Check whether the running environment is the same as that when mmcv/mmdet has compiled. + For example, you may compile mmcv using CUDA 10.0 but run it on CUDA 9.0 environments. - "undefined symbol" or "cannot open xxx.so". - 1. If those symbols are CUDA/C++ symbols (e.g., libcudart.so or GLIBCXX), check whether the CUDA/GCC runtimes are the same as those used for compiling mmcv, - i.e. run `python mmdet/utils/collect_env.py` to see if `"MMCV Compiler"`/`"MMCV CUDA Compiler"` is the same as `"GCC"`/`"CUDA_HOME"`. - 2. If those symbols are PyTorch symbols (e.g., symbols containing caffe, aten, and TH), check whether the PyTorch version is the same as that used for compiling mmcv. - 3. Run `python mmdet/utils/collect_env.py` to check whether PyTorch, torchvision, and MMCV are built by and running on the same environment. + 1. If those symbols are CUDA/C++ symbols (e.g., libcudart.so or GLIBCXX), check whether the CUDA/GCC runtimes are the same as those used for compiling mmcv, + i.e. run `python mmdet/utils/collect_env.py` to see if `"MMCV Compiler"`/`"MMCV CUDA Compiler"` is the same as `"GCC"`/`"CUDA_HOME"`. + 2. If those symbols are PyTorch symbols (e.g., symbols containing caffe, aten, and TH), check whether the PyTorch version is the same as that used for compiling mmcv. + 3. Run `python mmdet/utils/collect_env.py` to check whether PyTorch, torchvision, and MMCV are built by and running on the same environment. - setuptools.sandbox.UnpickleableException: DistutilsSetupError("each element of 'ext_modules' option must be an Extension instance or 2-tuple") - 1. If you are using miniconda rather than anaconda, check whether Cython is installed as indicated in [#3379](https://github.com/open-mmlab/mmdetection/issues/3379). - You need to manually install Cython first and then run command `pip install -r requirements.txt`. - 2. You may also need to check the compatibility between the `setuptools`, `Cython`, and `PyTorch` in your environment. + 1. If you are using miniconda rather than anaconda, check whether Cython is installed as indicated in [#3379](https://github.com/open-mmlab/mmdetection/issues/3379). + You need to manually install Cython first and then run command `pip install -r requirements.txt`. + 2. You may also need to check the compatibility between the `setuptools`, `Cython`, and `PyTorch` in your environment. - "Segmentation fault". - 1. Check you GCC version and use GCC 5.4. This usually caused by the incompatibility between PyTorch and the environment (e.g., GCC < 4.9 for PyTorch). We also recommend the users to avoid using GCC 5.5 because many feedbacks report that GCC 5.5 will cause "segmentation fault" and simply changing it to GCC 5.4 could solve the problem. - 2. Check whether PyTorch is correctly installed and could use CUDA op, e.g. type the following command in your terminal. + 1. Check you GCC version and use GCC 5.4. This usually caused by the incompatibility between PyTorch and the environment (e.g., GCC \< 4.9 for PyTorch). We also recommend the users to avoid using GCC 5.5 because many feedbacks report that GCC 5.5 will cause "segmentation fault" and simply changing it to GCC 5.4 could solve the problem. - ```shell - python -c 'import torch; print(torch.cuda.is_available())' - ``` + 2. Check whether PyTorch is correctly installed and could use CUDA op, e.g. type the following command in your terminal. - And see whether they could correctly output results. + ```shell + python -c 'import torch; print(torch.cuda.is_available())' + ``` - 3. If Pytorch is correctly installed, check whether MMCV is correctly installed. + And see whether they could correctly output results. - ```shell - python -c 'import mmcv; import mmcv.ops' - ``` + 3. If Pytorch is correctly installed, check whether MMCV is correctly installed. - If MMCV is correctly installed, then there will be no issue of the above two commands. + ```shell + python -c 'import mmcv; import mmcv.ops' + ``` - 4. If MMCV and Pytorch is correctly installed, you man use `ipdb`, `pdb` to set breakpoints or directly add 'print' in mmdetection code and see which part leads the segmentation fault. + If MMCV is correctly installed, then there will be no issue of the above two commands. + + 4. If MMCV and Pytorch is correctly installed, you man use `ipdb`, `pdb` to set breakpoints or directly add 'print' in mmdetection code and see which part leads the segmentation fault. ## Training - "Loss goes Nan" - 1. Check if the dataset annotations are valid: zero-size bounding boxes will cause the regression loss to be Nan due to the commonly used transformation for box regression. Some small size (width or height are smaller than 1) boxes will also cause this problem after data augmentation (e.g., instaboost). So check the data and try to filter out those zero-size boxes and skip some risky augmentations on the small-size boxes when you face the problem. - 2. Reduce the learning rate: the learning rate might be too large due to some reasons, e.g., change of batch size. You can rescale them to the value that could stably train the model. - 3. Extend the warmup iterations: some models are sensitive to the learning rate at the start of the training. You can extend the warmup iterations, e.g., change the `warmup_iters` from 500 to 1000 or 2000. - 4. Add gradient clipping: some models requires gradient clipping to stabilize the training process. The default of `grad_clip` is `None`, you can add gradient clippint to avoid gradients that are too large, i.e., set `optimizer_config=dict(_delete_=True, grad_clip=dict(max_norm=35, norm_type=2))` in your config file. If your config does not inherits from any basic config that contains `optimizer_config=dict(grad_clip=None)`, you can simply add `optimizer_config=dict(grad_clip=dict(max_norm=35, norm_type=2))`. + + 1. Check if the dataset annotations are valid: zero-size bounding boxes will cause the regression loss to be Nan due to the commonly used transformation for box regression. Some small size (width or height are smaller than 1) boxes will also cause this problem after data augmentation (e.g., instaboost). So check the data and try to filter out those zero-size boxes and skip some risky augmentations on the small-size boxes when you face the problem. + 2. Reduce the learning rate: the learning rate might be too large due to some reasons, e.g., change of batch size. You can rescale them to the value that could stably train the model. + 3. Extend the warmup iterations: some models are sensitive to the learning rate at the start of the training. You can extend the warmup iterations, e.g., change the `warmup_iters` from 500 to 1000 or 2000. + 4. Add gradient clipping: some models requires gradient clipping to stabilize the training process. The default of `grad_clip` is `None`, you can add gradient clippint to avoid gradients that are too large, i.e., set `optimizer_config=dict(_delete_=True, grad_clip=dict(max_norm=35, norm_type=2))` in your config file. If your config does not inherits from any basic config that contains `optimizer_config=dict(grad_clip=None)`, you can simply add `optimizer_config=dict(grad_clip=dict(max_norm=35, norm_type=2))`. + - ’GPU out of memory" - 1. There are some scenarios when there are large amounts of ground truth boxes, which may cause OOM during target assignment. You can set `gpu_assign_thr=N` in the config of assigner thus the assigner will calculate box overlaps through CPU when there are more than N GT boxes. - 2. Set `with_cp=True` in the backbone. This uses the sublinear strategy in PyTorch to reduce GPU memory cost in the backbone. - 3. Try mixed precision training using following the examples in `config/fp16`. The `loss_scale` might need further tuning for different models. + + 1. There are some scenarios when there are large amounts of ground truth boxes, which may cause OOM during target assignment. You can set `gpu_assign_thr=N` in the config of assigner thus the assigner will calculate box overlaps through CPU when there are more than N GT boxes. + 2. Set `with_cp=True` in the backbone. This uses the sublinear strategy in PyTorch to reduce GPU memory cost in the backbone. + 3. Try mixed precision training using following the examples in `config/fp16`. The `loss_scale` might need further tuning for different models. - "RuntimeError: Expected to have finished reduction in the prior iteration before starting a new one" - 1. This error indicates that your module has parameters that were not used in producing loss. This phenomenon may be caused by running different branches in your code in DDP mode. - 2. You can set ` find_unused_parameters = True` in the config to solve the above problems or find those unused parameters manually. + + 1. This error indicates that your module has parameters that were not used in producing loss. This phenomenon may be caused by running different branches in your code in DDP mode. + 2. You can set ` find_unused_parameters = True` in the config to solve the above problems or find those unused parameters manually. ## Evaluation - COCO Dataset, AP or AR = -1 - 1. According to the definition of COCO dataset, the small and medium areas in an image are less than 1024 (32\*32), 9216 (96\*96), respectively. - 2. If the corresponding area has no object, the result of AP and AR will set to -1. + 1. According to the definition of COCO dataset, the small and medium areas in an image are less than 1024 (32\*32), 9216 (96\*96), respectively. + 2. If the corresponding area has no object, the result of AP and AR will set to -1. diff --git a/docs/zh_cn/get_started.md b/docs/zh_cn/get_started.md index 52aa31d..231f75f 100644 --- a/docs/zh_cn/get_started.md +++ b/docs/zh_cn/get_started.md @@ -22,7 +22,6 @@ sh ./tools/dist_test.sh ${CONFIG_FILE} ${CHECKPOINT_FILE} ${GPU_NUM} [optional a python tools/test.py ${CONFIG_FILE} ${CHECKPOINT_FILE} [optional arguments] --launcher slurm ``` - Examples: For classification, inference Baseline on CUB under 5way 1shot setting. @@ -64,7 +63,6 @@ python tools/train.py ${CONFIG_FILE} [optional arguments] We do not recommend users to use CPU for training because it is too slow. We support this feature to allow users to debug on machines without GPU for convenience. - ### Train with multiple GPUs ```shell @@ -82,6 +80,7 @@ Difference between `resume-from` and `load-from`: `load-from` only loads the model weights and the training epoch starts from 0. It is usually used for finetuning. ### Train with multiple machines + If you launch with multiple machines simply connected with ethernet, you can simply run following commands: On the first machine: @@ -98,8 +97,6 @@ NNODES=2 NODE_RANK=1 PORT=$MASTER_PORT MASTER_ADDR=$MASTER_ADDR sh tools/dist_tr Usually it is slow if you do not have high speed networking like InfiniBand. - - If you run MMClassification on a cluster managed with [slurm](https://slurm.schedmd.com/), you can use the script `slurm_train.sh`. (This script also supports single machine training.) ```shell diff --git a/docs/zh_cn/install.md b/docs/zh_cn/install.md index 9801ee0..2a9b197 100644 --- a/docs/zh_cn/install.md +++ b/docs/zh_cn/install.md @@ -9,14 +9,13 @@ - [mmdet](https://mmdetection.readthedocs.io/en/latest/#installation) 2.16.0+ - [mmcls](https://mmclassification.readthedocs.io/en/latest/#installation) 0.15.0+ - MMFewShot 和 MMCV, MMCls, MMDet 版本兼容性如下所示,需要安装正确的版本以避免安装出现问题。 -| MMFewShot 版本 | MMCV 版本 | MMClassification 版本 | MMDetection 版本 | -|:-------------------:|:-----------------:|:---------------------------------:|:----------------------------:| -| master | mmcv-full>=1.3.12 | mmdet >= 2.16.0 | mmcls >=0.15.0 | +| MMFewShot 版本 | MMCV 版本 | MMClassification 版本 | MMDetection 版本 | +| :----------: | :---------------: | :-----------------: | :------------: | +| master | mmcv-full>=1.3.12 | mmdet >= 2.16.0 | mmcls >=0.15.0 | -**注意:**如果已经安装了 mmcv,首先需要使用 `pip uninstall mmcv` 卸载已安装的 mmcv,如果同时安装了 mmcv 和 mmcv-full,将会报 `ModuleNotFoundError` 错误。 +\*\*注意:\*\*如果已经安装了 mmcv,首先需要使用 `pip uninstall mmcv` 卸载已安装的 mmcv,如果同时安装了 mmcv 和 mmcv-full,将会报 `ModuleNotFoundError` 错误。 ## 安装流程 @@ -48,78 +47,79 @@ pip install -v -e . # or "python setup.py develop" 1. 使用 conda 新建虚拟环境,并进入该虚拟环境; - ```shell - conda create -n openmmlab python=3.7 -y - conda activate openmmlab - ``` + ```shell + conda create -n openmmlab python=3.7 -y + conda activate openmmlab + ``` 2. 基于 [PyTorch 官网](https://pytorch.org/)安装 PyTorch 和 torchvision,例如: - ```shell - conda install pytorch torchvision -c pytorch - ``` + ```shell + conda install pytorch torchvision -c pytorch + ``` **注意**:需要确保 CUDA 的编译版本和运行版本匹配。可以在 [PyTorch 官网](https://pytorch.org/)查看预编译包所支持的 CUDA 版本。 `例 1` 例如在 `/usr/local/cuda` 下安装了 CUDA 10.1, 并想安装 PyTorch 1.7,则需要安装支持 CUDA 10.1 的预构建 PyTorch: - ```shell - conda install pytorch==1.7.0 torchvision==0.8.0 torchaudio==0.7.0 cudatoolkit=10.1 -c pytorch - ``` - + ```shell + conda install pytorch==1.7.0 torchvision==0.8.0 torchaudio==0.7.0 cudatoolkit=10.1 -c pytorch + ``` ### 安装 MMFewShot 我们建议使用 [MIM](https://github.com/open-mmlab/mim) 来安装 MMFewShot: -``` shell +```shell pip install openmim mim install mmfewshot ``` -MIM 能够自动地安装 OpenMMLab 的项目以及对应的依赖包。 +MIM 能够自动地安装 OpenMMLab 的项目以及对应的依赖包。 或者,可以手动安装 MMFewShot: 1. 安装 mmcv-full,我们建议使用预构建包来安装: - ```shell - # pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html - pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.10.0/index.html - ``` + ```shell + # pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html + pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.10.0/index.html + ``` - PyTorch 在 1.x.0 和 1.x.1 之间通常是兼容的,故 mmcv-full 只提供 1.x.0 的编译包。如果你的 PyTorch 版本是 1.x.1,你可以放心地安装在 1.x.0 版本编译的 mmcv-full。 + PyTorch 在 1.x.0 和 1.x.1 之间通常是兼容的,故 mmcv-full 只提供 1.x.0 的编译包。如果你的 PyTorch 版本是 1.x.1,你可以放心地安装在 1.x.0 版本编译的 mmcv-full。 - ``` - # 我们可以忽略 PyTorch 的小版本号 - pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.10/index.html - ``` + ``` + # 我们可以忽略 PyTorch 的小版本号 + pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.10/index.html + ``` - 请参阅 [MMCV](https://github.com/open-mmlab/mmcv#install-with-pip) 了解不同版本的 MMCV 与不同版本的 PyTorch 和 CUDA 的兼容情况。同时,您可以使用以下命令从源码编译 MMCV: + 请参阅 [MMCV](https://github.com/open-mmlab/mmcv#install-with-pip) 了解不同版本的 MMCV 与不同版本的 PyTorch 和 CUDA 的兼容情况。同时,您可以使用以下命令从源码编译 MMCV: 2. 安装 MMClassification 和 MMDetection. - 你可以直接通过如下命令从 pip 安装使用 mmclassification 和 mmdetection: + 你可以直接通过如下命令从 pip 安装使用 mmclassification 和 mmdetection: - ```shell - pip install mmcls mmdet - ``` + ```shell + pip install mmcls mmdet + ``` 3. 安装 MMFewShot. - 你可以直接通过如下命令从 pip 安装使用 mmfewshot: + 你可以直接通过如下命令从 pip 安装使用 mmfewshot: + + ```shell + pip install mmfewshot + ``` - ```shell - pip install mmfewshot - ``` + 或者从 git 仓库编译源码: - 或者从 git 仓库编译源码: + ```shell + git clone https://github.com/open-mmlab/mmfewshot.git + cd mmfewshot + pip install -r requirements/build.txt + pip install -v -e . # or "python setup.py develop" - ```shell - git clone https://github.com/open-mmlab/mmfewshot.git - cd mmfewshot - pip install -r requirements/build.txt - pip install -v -e . # or "python setup.py develop" + ``` **Note:** @@ -129,7 +129,6 @@ MIM 能够自动地安装 OpenMMLab 的项目以及对应的依赖包。 (3) 一些安装依赖是可以选择的。例如只需要安装最低运行要求的版本,则可以使用 `pip install -v -e .` 命令。如果希望使用可选择的像 `albumentations` 和 `imagecorruptions` 这种依赖项,可以使用 `pip install -r requirements/optional.txt ` 进行手动安装,或者在使用 `pip` 时指定所需的附加功能(例如 `pip install -v -e .[optional]`),支持附加功能的有效键值包括 `all`、`tests`、`build` 以及 `optional` 。 - ### 另一种选择: Docker 镜像 我们提供了 [Dockerfile](https://github.com/open-mmlab/mmfewshot/blob/master/docker/Dockerfile) to build an image. Ensure that you are using [docker version](https://docs.docker.com/engine/install/) >=19.03. @@ -154,4 +153,5 @@ docker run --gpus all --shm-size=8g -it -v {DATA_DIR}:/mmfewshot/data mmfewshot 如果成功安装 MMFewShot,则上面的代码可以完整地运行。 ## 准备数据集 + 具体的细节可以参考 [准备数据](https://github.com/open-mmlab/mmfewshot/tree/main/tools/data) 下载并组织数据集。 diff --git a/docs/zh_cn/model_zoo.md b/docs/zh_cn/model_zoo.md index 228eebd..39745c1 100644 --- a/docs/zh_cn/model_zoo.md +++ b/docs/zh_cn/model_zoo.md @@ -1,9 +1,7 @@ # Model Zoo - ## Few Shot Classification Model Zoo - #### Baseline Please refer to [Baseline](https://github.com/open-mmlab/mmfewshot/tree/main/configs/classification/baseline) for details. @@ -36,8 +34,6 @@ Please refer to [NegMargin](https://github.com/open-mmlab/mmfewshot/tree/main/co Please refer to [Meta Baseline](https://github.com/open-mmlab/mmfewshot/tree/main/configs/classification/meta_baseline) for details. - - ## Few Shot Detection Model Zoo #### TFA diff --git a/tools/data/README.md b/tools/data/README.md index dd4b0b3..9d9f699 100644 --- a/tools/data/README.md +++ b/tools/data/README.md @@ -3,7 +3,6 @@ It is recommended to symlink the dataset root to `$MMFEWSHOT/data`. If your folder structure is different, you may need to change the corresponding paths in config files. - # Few Shot Classification Datasets supported in MMFewShot: diff --git a/tools/data/classification/cub/README.md b/tools/data/classification/cub/README.md index 0f57815..8d60fea 100644 --- a/tools/data/classification/cub/README.md +++ b/tools/data/classification/cub/README.md @@ -15,6 +15,7 @@ The CUB dataset can be downloaded from [here](http://www.vision.caltech.edu/visipedia-data/CUB-200-2011/CUB_200_2011.tgz). The data structure is as follows: + ```text mmfewshot ├── mmfewshot diff --git a/tools/data/classification/mini-imagenet/README.md b/tools/data/classification/mini-imagenet/README.md index adbdf5b..f0d10bd 100644 --- a/tools/data/classification/mini-imagenet/README.md +++ b/tools/data/classification/mini-imagenet/README.md @@ -26,6 +26,7 @@ The split files of mini-imagenet can be downloaded from [here](https://github.co The whole imagenet dataset can be downloaded from [here](https://image-net.org/challenges/LSVRC/2012/index.php). The data structure is as follows: + ```text mmfewshot ├── mmfewshot diff --git a/tools/data/classification/tiered-imagenet/README.md b/tools/data/classification/tiered-imagenet/README.md index 241ca70..6994547 100644 --- a/tools/data/classification/tiered-imagenet/README.md +++ b/tools/data/classification/tiered-imagenet/README.md @@ -24,6 +24,7 @@ The pickle file of tiered imagenet dataset is released in [repo](https://github.com/renmengye/few-shot-ssl-public#tieredimagenet) can be downloaded from [here](https://drive.google.com/open?id=1g1aIDy2Ar_MViF2gDXFYDBTR-HYecV07). The data structure is as follows: + ```text mmfewshot ├── mmfewshot diff --git a/tools/data/detection/README.md b/tools/data/detection/README.md index 3e61dd4..946e2ae 100644 --- a/tools/data/detection/README.md +++ b/tools/data/detection/README.md @@ -4,5 +4,6 @@ It is recommended to symlink the dataset root to `$MMFEWSHOT/data`. If your folder structure is different, you may need to change the corresponding paths in config files. Datasets supported in MMFewShot: + - [COCO Dataset](coco/README.md) \[ [Homepage](https://cocodataset.org/#home) \] \[ [Split](http://dl.yf.io/fs-det/datasets/cocosplit/) \] - [VOC Dataset](voc/README.md) \[ [Homepage](http://host.robots.ox.ac.uk/pascal/VOC/) \] \[ [Split](http://dl.yf.io/fs-det/datasets/vocsplit/) \] diff --git a/tools/data/detection/coco/README.md b/tools/data/detection/coco/README.md index a707957..ee02850 100644 --- a/tools/data/detection/coco/README.md +++ b/tools/data/detection/coco/README.md @@ -21,12 +21,14 @@ ``` ## download coco dataset + The coco14/coco17 dataset can be downloaded from [here](https://cocodataset.org/#download). In mmfewshot, coco14 is used as default setting, while coco17 is optional. Some methods (attention rpn) were proposed with coco17 data split, which is also evaluated in mmfewshot. The data structure is as follows: + ```none mmfewshot ├── mmfewshot @@ -42,6 +44,7 @@ mmfewshot ``` ## download few shot annotations + In mmfewshot, we use the train/val/few shot split of coco14 released in TFA [repo](https://github.com/ucbdrive/few-shot-object-detection). The original data spilt can be found in [here](http://dl.yf.io/fs-det/datasets/cocosplit/). @@ -50,6 +53,7 @@ Please download [coco.tar.gz](https://download.openmmlab.com/mmfewshot/few_shot_ and unzip them into `$MMFEWSHOT/data/few_shot_ann`. The final data structure is as follows: + ```none mmfewshot ├── mmfewshot diff --git a/tools/data/detection/voc/README.md b/tools/data/detection/voc/README.md index efa759b..63f30e5 100644 --- a/tools/data/detection/voc/README.md +++ b/tools/data/detection/voc/README.md @@ -23,11 +23,13 @@ ``` ## download VOC dataset + The VOC 2007/2012 dataset can be downloaded from [here](http://host.robots.ox.ac.uk/pascal/VOC/). In mmfewshot, VOC 2007(trainval) + 2012 (trainval) are used for training and VOC 2007(test) is used for evaluation. The data structure is as follows: + ```none mmfewshot ├── mmfewshot @@ -40,6 +42,7 @@ mmfewshot ``` ## download few shot annotations + In mmfewshot, we use the VOC few shot split released in TFA [repo](https://github.com/ucbdrive/few-shot-object-detection). The original data spilt can be found in [here](http://dl.yf.io/fs-det/datasets/vocsplit/). @@ -47,9 +50,8 @@ We provide a re-organized data split. Please download [voc.tar.gz](https://download.openmmlab.com/mmfewshot/few_shot_ann/voc.tar.gz) and unzip them into `$MMFEWSHOT/data/few_shot_ann`. - - The final data structure is as follows: + ```none mmfewshot ├── mmfewshot