Skip to content

Commit

Permalink
[Docs] Update introduction and fix issues (#10)
Browse files Browse the repository at this point in the history
* fix link issue

* fix link issue

* [Docs] update intro and fix issues

* [Docs] fix translation

* [Docs] update introduction

* remove duplicated model_zoo.yml

* update intro and fix codecov icon

* update README
  • Loading branch information
linyq17 committed Nov 26, 2021
1 parent 0bd4fa7 commit 217aff6
Show file tree
Hide file tree
Showing 9 changed files with 294 additions and 74 deletions.
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ English | [简体中文](README_zh-CN.md)

[![Documentation](https://readthedocs.org/projects/mmfewshot/badge/?version=latest)](https://mmfewshot.readthedocs.io/en/latest/?badge=latest)
[![actions](https://github.com/open-mmlab/mmfewshot/workflows/build/badge.svg)](https://github.com/open-mmlab/mmfewshot/actions)
[![codecov](https://codecov.io/gh/open-mmlab/mmfewshot/branch/master/graph/badge.svg)](https://codecov.io/gh/open-mmlab/mmfewshot)
[![PyPI](https://badge.fury.io/py/mmedit.svg)](https://pypi.org/project/mmedit/)
[![codecov](https://codecov.io/gh/open-mmlab/mmfewshot/branch/main/graph/badge.svg)](https://codecov.io/gh/open-mmlab/mmfewshot)
[![PyPI](https://badge.fury.io/py/mmfewshot.svg)](https://pypi.org/project/mmfewshot/)
[![LICENSE](https://img.shields.io/github/license/open-mmlab/mmfewshot.svg)](https://github.com/open-mmlab/mmfewshot/blob/master/LICENSE)
[![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)
Expand Down Expand Up @@ -88,9 +88,26 @@ Please refer to [install.md](docs/install.md) for installation of mmfewshot and

## Getting Started

Please see [getting_started.md](docs/get_started.md) for the basic usage of mmfewshot.
If you are new of few shot learning, you can start with [learn the basics](docs/intro.md).
If you are familiar with it, check out [getting_started.md](docs/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)

- 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)

## Citation

If you find this project useful in your research, please consider cite:
Expand Down
8 changes: 4 additions & 4 deletions README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
[English](README.md) | 简体中文
[![Documentation](https://readthedocs.org/projects/mmfewshot/badge/?version=latest)](https://mmfewshot.readthedocs.io/en/latest/?badge=latest)
[![actions](https://github.com/open-mmlab/mmfewshot/workflows/build/badge.svg)](https://github.com/open-mmlab/mmfewshot/actions)
[![codecov](https://codecov.io/gh/open-mmlab/mmfewshot/branch/master/graph/badge.svg)](https://codecov.io/gh/open-mmlab/mmfewshot)
[![PyPI](https://badge.fury.io/py/mmedit.svg)](https://pypi.org/project/mmedit/)
[![codecov](https://codecov.io/gh/open-mmlab/mmfewshot/branch/main/graph/badge.svg)](https://codecov.io/gh/open-mmlab/mmfewshot)
[![PyPI](https://badge.fury.io/py/mmfewshot.svg)](https://pypi.org/project/mmfewshot/)
[![LICENSE](https://img.shields.io/github/license/open-mmlab/mmfewshot.svg)](https://github.com/open-mmlab/mmfewshot/blob/master/LICENSE)
[![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)
Expand Down Expand Up @@ -84,8 +84,8 @@ MMFewShot 是一款基于 PyTorch 的少样本学习代码库,是 [OpenMMLab](
请参考[安装文档](docs/install.md)进行安装和参考[数据准备](tools/data/README.md)准备数据集。

## 快速入门

请参考[使用教程](docs/get_started.md)获取MMFewShot的基本用法。
如果初次了解少样本学习,你可以从[基础介绍](docs/intro.md)开始了解少样本学习的基本概念和 MMFewShot 的框架。
如果对少样本学习很熟悉,请参考[使用教程](docs/get_started.md)获取MMFewShot的基本用法。

MMFewShot 也提供了其他更详细的教程,包括:

Expand Down
69 changes: 69 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ classification.core
.. automodule:: mmfewshot.classification.core
:members:

evaluation
^^^^^^^^^^
.. automodule:: mmfewshot.classification.core.evaluation
:members:


classification.datasets
------------------------------
Expand All @@ -24,6 +29,31 @@ classification.models
.. automodule:: mmfewshot.classification.models
:members:

backbones
^^^^^^^^^^
.. automodule:: mmfewshot.classification.models.backbones
:members:

classifier
^^^^^^^^^^
.. automodule:: mmfewshot.classification.models.classifier
:members:

heads
^^^^^^^^^^
.. automodule:: mmfewshot.classification.models.heads
:members:

losses
^^^^^^^^^^
.. automodule:: mmfewshot.classification.models.losses
:members:

utils
^^^^^^^^^^
.. automodule:: mmfewshot.classification.models.utils
:members:


classification.utils
------------------------------
Expand All @@ -45,6 +75,15 @@ detection.core
.. automodule:: mmfewshot.detection.core
:members:

evaluation
^^^^^^^^^^
.. automodule:: mmfewshot.detection.core.evaluation
:members:

utils
^^^^^^^^^^
.. automodule:: mmfewshot.detection.core.utils
:members:

detection.datasets
------------------------------
Expand All @@ -57,6 +96,36 @@ detection.models
.. automodule:: mmfewshot.detection.models
:members:

backbones
^^^^^^^^^^
.. automodule:: mmfewshot.detection.models.backbones
:members:

dense_heads
^^^^^^^^^^
.. automodule:: mmfewshot.detection.models.dense_heads
:members:

detectors
^^^^^^^^^^
.. automodule:: mmfewshot.detection.models.detectors
:members:

losses
^^^^^^^^^^
.. automodule:: mmfewshot.detection.models.losses
:members:

roi_heads
^^^^^^^^^^
.. automodule:: mmfewshot.detection.models.roi_heads
:members:

utils
^^^^^^^^^^
.. automodule:: mmfewshot.detection.models.utils
:members:


detection.utils
------------------------------
Expand Down
7 changes: 7 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Welcome to MMFewShot's documentation!
=======================================

.. toctree::
:maxdepth: 1
:caption: Learn the Basics

intro.md


.. toctree::
:maxdepth: 2
:caption: Get Started
Expand Down
105 changes: 105 additions & 0 deletions docs/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# Learn the Basics

This chapter introduces you to the basic conception of few shot learning, and the framework of
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.
For example, in few shot image classification, a pre-trained model only can see
five bird images (each class has one image and doesn't exist in the pretrained dataset) and
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).


<div align=center>
<img src="https://github.com/open-mmlab/mmfewshot/blob/main/resources/demo.png?raw=true" width=80%/>
</div>

### 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.
- N way K shot: the support set setting, and it means support images contain N classes and
each class has K samples.
- For classification, there will be NxK support images in a support set.
- 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.
For image classification, we first pretrain a model with training set using cross-entropy loss, and then
we can transfer the backbone and fine tune a new classification head.
For detection, we can first pretrain a faster-rcnn on training set, and
then fine tune a new bbox head on a few instances to detect the novel class.
In many cases, the fine-tuning is a simple but effective strategy for few shot learning.

## What is MMFewShot

MMFewShot is the first toolbox that provides a framework for unified implementation and evaluation of few shot classification and detection methods,
and below is its whole framework:

<div align=center>
<img src="https://user-images.githubusercontent.com/15669896/143182168-e2b0a3b8-4dce-4e44-b134-a2577c8290c5.png" width=80%/>
</div>

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`.

- `models` contains models and loss functions.

- `core` provides evaluation tools and customized hooks for model training and evaluation.

- `apis` provides high-level APIs for models training, testing, and inference.

## How to Use this Guide

Here is a detailed step-by-step guide to learn more about MMFewShot:

1. For installation instructions, please see [install](install.md).

2. [get_started](get_started.md) is for the basic usage of 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)

- 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)
69 changes: 69 additions & 0 deletions docs_zh-CN/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ classification.core
.. automodule:: mmfewshot.classification.core
:members:

evaluation
^^^^^^^^^^
.. automodule:: mmfewshot.classification.core.evaluation
:members:


classification.datasets
------------------------------
Expand All @@ -24,6 +29,31 @@ classification.models
.. automodule:: mmfewshot.classification.models
:members:

backbones
^^^^^^^^^^
.. automodule:: mmfewshot.classification.models.backbones
:members:

classifier
^^^^^^^^^^
.. automodule:: mmfewshot.classification.models.classifier
:members:

heads
^^^^^^^^^^
.. automodule:: mmfewshot.classification.models.heads
:members:

losses
^^^^^^^^^^
.. automodule:: mmfewshot.classification.models.losses
:members:

utils
^^^^^^^^^^
.. automodule:: mmfewshot.classification.models.utils
:members:


classification.utils
------------------------------
Expand All @@ -45,6 +75,15 @@ detection.core
.. automodule:: mmfewshot.detection.core
:members:

evaluation
^^^^^^^^^^
.. automodule:: mmfewshot.detection.core.evaluation
:members:

utils
^^^^^^^^^^
.. automodule:: mmfewshot.detection.core.utils
:members:

detection.datasets
------------------------------
Expand All @@ -57,6 +96,36 @@ detection.models
.. automodule:: mmfewshot.detection.models
:members:

backbones
^^^^^^^^^^
.. automodule:: mmfewshot.detection.models.backbones
:members:

dense_heads
^^^^^^^^^^
.. automodule:: mmfewshot.detection.models.dense_heads
:members:

detectors
^^^^^^^^^^
.. automodule:: mmfewshot.detection.models.detectors
:members:

losses
^^^^^^^^^^
.. automodule:: mmfewshot.detection.models.losses
:members:

roi_heads
^^^^^^^^^^
.. automodule:: mmfewshot.detection.models.roi_heads
:members:

utils
^^^^^^^^^^
.. automodule:: mmfewshot.detection.models.utils
:members:


detection.utils
------------------------------
Expand Down

0 comments on commit 217aff6

Please sign in to comment.