From 2c2f966fdd930501f0b7ed09cf5baa61df00cf75 Mon Sep 17 00:00:00 2001 From: zhouzaida Date: Mon, 7 Jun 2021 14:16:40 +0800 Subject: [PATCH 01/13] [Docs] Refactor documentation --- docs/api.rst | 2 +- docs/index.rst | 21 +++++-- docs/installation.md | 137 +++++++++++++++++++++++++++++++++++++++++++ docs/introduction.md | 33 +++++++++++ docs/readme.md | 1 - 5 files changed, 188 insertions(+), 6 deletions(-) create mode 100644 docs/installation.md create mode 100644 docs/introduction.md delete mode 120000 docs/readme.md diff --git a/docs/api.rst b/docs/api.rst index 36eed8269a..daa3e65263 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -1,4 +1,4 @@ -API Documentation +API Reference ================= diff --git a/docs/index.rst b/docs/index.rst index 444ba1f2ca..47df65b4f2 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,11 +1,17 @@ - -.. mdinclude:: readme.md - Contents ======== .. toctree:: :maxdepth: 2 + :caption: Getting started + + introduction.md + installation.md + build.md + +.. toctree:: + :maxdepth: 2 + :caption: Learning MMCV io.md image.md @@ -16,9 +22,16 @@ Contents registry.md cnn.md ops.md - build.md deployment.rst + +.. toctree:: + :caption: FAQ + trouble_shooting.md + +.. toctree:: + :caption: API Reference + api.rst diff --git a/docs/installation.md b/docs/installation.md new file mode 100644 index 0000000000..115270eda7 --- /dev/null +++ b/docs/installation.md @@ -0,0 +1,137 @@ +## Installation + +There are two versions of MMCV: + +- **mmcv-full**: comprehensive, with full features and various CUDA ops out of box. It takes longer time to build. +- **mmcv**: lite, without CUDA ops but all other features, similar to mmcv<1.0.0. It is useful when you do not need those CUDA ops. + +**Note**: Do not install both versions in the same environment, otherwise you may encounter errors like `ModuleNotFound`. You need to uninstall one before installing the other. `Installing the full verion is highly recommended if CUDA is avaliable`. + +a. Install the full version. + +Before installing mmcv-full, make sure that PyTorch has been successfully installed following the [official guide](https://pytorch.org/). + +We provide pre-built mmcv packages (recommended) with different PyTorch and CUDA versions to simplify the building. + +i. Install the latest version. + +The rule for installing the latest ``mmcv-full`` is as follows: + +```shell +pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html +``` + +Please replace ``{cu_version}`` and ``{torch_version}`` in the url to your desired one. For example, +to install the latest ``mmcv-full`` with ``CUDA 11`` and ``PyTorch 1.7.0``, use the following command: + +```shell +pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu110/torch1.7.0/index.html +``` + +For more details, please refer the the following tables and delete ``=={mmcv_version}``. + +ii. Install a specified version. + +The rule for installing a specified ``mmcv-full`` is as follows: + +```shell +pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html +``` + +First of all, please refer to the Releases and replace ``{mmcv_version}`` a specified one. e.g. ``1.2.2``. +Then replace ``{cu_version}`` and ``{torch_version}`` in the url to your desired versions. For example, +to install ``mmcv-full==1.2.2`` with ``CUDA 11`` and ``PyTorch 1.7.0``, use the following command: + +```shell +pip install mmcv-full==1.2.2 -f https://download.openmmlab.com/mmcv/dist/cu110/torch1.7.0/index.html +``` + +For more details, please refer the the following tables. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CUDA torch 1.8torch 1.7torch 1.6torch 1.5torch 1.4torch 1.3
11.1
install
pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.8.0/index.html
11.0
install
pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu110/torch1.7.0/index.html
10.2
install
pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.0/index.html
install
pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.7.0/index.html
install
pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.6.0/index.html
install
pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.5.0/index.html
10.1
install
 pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.8.0/index.html
install
 pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.7.0/index.html
install
 pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.6.0/index.html
install
 pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.5.0/index.html
install
pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.4.0/index.html
install
pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.3.0/index.html
9.2
install
 pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu92/torch1.7.0/index.html
install
 pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu92/torch1.6.0/index.html
install
 pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu92/torch1.5.0/index.html
install
pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu92/torch1.4.0/index.html
install
pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu92/torch1.3.0/index.html
cpu
install
 pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.8.0/index.html
install
 pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.7.0/index.html
install
 pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.6.0/index.html
install
 pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.5.0/index.html
install
pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.4.0/index.html
install
pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.3.0/index.html
+ +Another way is to compile locally by running + +```python +pip install mmcv-full +``` + +Note that the local compiling may take up to 10 mins. + +b. Install the lite version. + +```python +pip install mmcv +``` + +c. Install full version with custom operators for onnxruntime + +- Check [here](docs/onnxruntime_op.md) for detailed instruction. + +If you would like to build MMCV from source, please refer to the [guide](build.md). diff --git a/docs/introduction.md b/docs/introduction.md new file mode 100644 index 0000000000..2a0f1564f8 --- /dev/null +++ b/docs/introduction.md @@ -0,0 +1,33 @@ +## Introduction + +
+ +
+ +[![PyPI](https://img.shields.io/pypi/v/mmcv)](https://pypi.org/project/mmcv) [![badge](https://github.com/open-mmlab/mmcv/workflows/build/badge.svg)](https://github.com/open-mmlab/mmcv/actions) [![codecov](https://codecov.io/gh/open-mmlab/mmcv/branch/master/graph/badge.svg)](https://codecov.io/gh/open-mmlab/mmcv) [![license](https://img.shields.io/github/license/open-mmlab/mmcv.svg)](https://github.com/open-mmlab/mmcv/blob/master/LICENSE) + +MMCV is a foundational library for computer vision research and supports many +research projects as below: + +- [MMClassification](https://github.com/open-mmlab/mmclassification): OpenMMLab image classification toolbox and benchmark. +- [MMDetection](https://github.com/open-mmlab/mmdetection): OpenMMLab detection toolbox and benchmark. +- [MMDetection3D](https://github.com/open-mmlab/mmdetection3d): OpenMMLab's next-generation platform for general 3D object detection. +- [MMSegmentation](https://github.com/open-mmlab/mmsegmentation): OpenMMLab semantic segmentation toolbox and benchmark. +- [MMAction2](https://github.com/open-mmlab/mmaction2): OpenMMLab's next-generation action understanding toolbox and benchmark. +- [MMTracking](https://github.com/open-mmlab/mmtracking): OpenMMLab video perception toolbox and benchmark. +- [MMPose](https://github.com/open-mmlab/mmpose): OpenMMLab pose estimation toolbox and benchmark. +- [MMEditing](https://github.com/open-mmlab/mmediting): OpenMMLab image and video editing toolbox. +- [MMOCR](https://github.com/open-mmlab/mmocr): OpenMMLab text detection, recognition and understanding toolbox. +- [MMGeneration](https://github.com/open-mmlab/mmgeneration): OpenMMLab image and video generative models toolbox. + +It provides the following functionalities. + +- Universal IO APIs +- Image/Video processing +- Image and annotation visualization +- Useful utilities (progress bar, timer, ...) +- PyTorch runner with hooking mechanism +- Various CNN architectures +- High-quality implementation of common CUDA ops + +Note: MMCV requires Python 3.6+. diff --git a/docs/readme.md b/docs/readme.md deleted file mode 120000 index 94389aee61..0000000000 --- a/docs/readme.md +++ /dev/null @@ -1 +0,0 @@ -../README.md From a281d43e50e86ae2f6253f31143427c6996dcf80 Mon Sep 17 00:00:00 2001 From: zhouzaida Date: Mon, 7 Jun 2021 14:20:33 +0800 Subject: [PATCH 02/13] [Docs] Refactor documentation --- docs/index.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/index.rst b/docs/index.rst index 47df65b4f2..afa937379d 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -22,6 +22,11 @@ Contents registry.md cnn.md ops.md + +.. toctree:: + :maxdepth: 2 + :caption: Deployment + deployment.rst .. toctree:: From f63d61c49a5ca8c737009eb1315b0835b10b56c9 Mon Sep 17 00:00:00 2001 From: zhouzaida Date: Wed, 16 Jun 2021 11:06:43 +0800 Subject: [PATCH 03/13] refactor docs --- docs/config.md | 153 ++++++++++++++++++++++++++++ docs/{image.md => data_process.md} | 140 ++++++++++++++++++++++++-- docs/deployment.rst | 2 +- docs/index.rst | 29 +++--- docs/utils.md | 154 ----------------------------- docs/video.md | 117 ---------------------- 6 files changed, 303 insertions(+), 292 deletions(-) create mode 100644 docs/config.md rename docs/{image.md => data_process.md} (55%) delete mode 100644 docs/video.md diff --git a/docs/config.md b/docs/config.md new file mode 100644 index 0000000000..9722038125 --- /dev/null +++ b/docs/config.md @@ -0,0 +1,153 @@ +## Config + +`Config` class is used for manipulating config and config files. It supports +loading configs from multiple file formats including **python**, **json** and **yaml**. +It provides dict-like apis to get and set values. + +Here is an example of the config file `test.py`. + +```python +a = 1 +b = dict(b1=[0, 1, 2], b2=None) +c = (1, 2) +d = 'string' +``` + +To load and use configs + +```python +>>> cfg = Config.fromfile('test.py') +>>> print(cfg) +>>> dict(a=1, +... b=dict(b1=[0, 1, 2], b2=None), +... c=(1, 2), +... d='string') +``` + +For all format configs, some predefined variables are supported. It will convert the variable in `{{ var }}` with its real value. + +Currently, it supports four predefined variables: + +`{{ fileDirname }}` - the current opened file's dirname, e.g. /home/your-username/your-project/folder + +`{{ fileBasename }}` - the current opened file's basename, e.g. file.ext + +`{{ fileBasenameNoExtension }}` - the current opened file's basename with no file extension, e.g. file + +`{{ fileExtname }}` - the current opened file's extension, e.g. .ext + +These variable names are referred from [VS Code](https://code.visualstudio.com/docs/editor/variables-reference). + +Here is one examples of config with predefined variables. + +`config_a.py` + +```python +a = 1 +b = './work_dir/{{ fileBasenameNoExtension }}' +c = '{{ fileExtname }}' +``` + +```python +>>> cfg = Config.fromfile('./config_a.py') +>>> print(cfg) +>>> dict(a=1, +... b='./work_dir/config_a', +... c='.py') +``` + +For all format configs, inheritance is supported. To reuse fields in other config files, +specify `_base_='./config_a.py'` or a list of configs `_base_=['./config_a.py', './config_b.py']`. +Here are 4 examples of config inheritance. + +`config_a.py` + +```python +a = 1 +b = dict(b1=[0, 1, 2], b2=None) +``` + +### Inherit from base config without overlapped keys + +`config_b.py` + +```python +_base_ = './config_a.py' +c = (1, 2) +d = 'string' +``` + +```python +>>> cfg = Config.fromfile('./config_b.py') +>>> print(cfg) +>>> dict(a=1, +... b=dict(b1=[0, 1, 2], b2=None), +... c=(1, 2), +... d='string') +``` + +New fields in `config_b.py` are combined with old fields in `config_a.py` + +### Inherit from base config with overlapped keys + +`config_c.py` + +```python +_base_ = './config_a.py' +b = dict(b2=1) +c = (1, 2) +``` + +```python +>>> cfg = Config.fromfile('./config_c.py') +>>> print(cfg) +>>> dict(a=1, +... b=dict(b1=[0, 1, 2], b2=1), +... c=(1, 2)) +``` + +`b.b2=None` in `config_a` is replaced with `b.b2=1` in `config_c.py`. + +### Inherit from base config with ignored fields + +`config_d.py` + +```python +_base_ = './config_a.py' +b = dict(_delete_=True, b2=None, b3=0.1) +c = (1, 2) +``` + +```python +>>> cfg = Config.fromfile('./config_d.py') +>>> print(cfg) +>>> dict(a=1, +... b=dict(b2=None, b3=0.1), +... c=(1, 2)) +``` + +You may also set `_delete_=True` to ignore some fields in base configs. All old keys `b1, b2, b3` in `b` are replaced with new keys `b2, b3`. + +### Inherit from multiple base configs (the base configs should not contain the same keys) + +`config_e.py` + +```python +c = (1, 2) +d = 'string' +``` + +`config_f.py` + +```python +_base_ = ['./config_a.py', './config_e.py'] +``` + +```python +>>> cfg = Config.fromfile('./config_f.py') +>>> print(cfg) +>>> dict(a=1, +... b=dict(b1=[0, 1, 2], b2=None), +... c=(1, 2), +... d='string') +``` diff --git a/docs/image.md b/docs/data_process.md similarity index 55% rename from docs/image.md rename to docs/data_process.md index c6e9bbef45..7f141370a2 100644 --- a/docs/image.md +++ b/docs/data_process.md @@ -1,8 +1,10 @@ -## Image +## Data Process + +### Image This module provides some image processing methods, which requires `opencv` to be installed. -### Read/Write/Show +#### Read/Write/Show To read or write images files, use `imread` or `imwrite`. @@ -34,7 +36,7 @@ for i in range(10): mmcv.imshow(img, win_name='test image', wait_time=200) ``` -### Color space conversion +#### Color space conversion Supported conversion methods: @@ -52,7 +54,7 @@ img2 = mmcv.rgb2gray(img1) img3 = mmcv.bgr2hsv(img) ``` -### Resize +#### Resize There are three resize methods. All `imresize_*` methods have an argument `return_scale`, if this argument is `False`, then the return value is merely the resized image, otherwise @@ -73,7 +75,7 @@ mmcv.imrescale(img, 0.5) mmcv.imrescale(img, (1000, 800)) ``` -### Rotate +#### Rotate To rotate an image by some angle, use `imrotate`. The center can be specified, which is the center of original image by default. There are two modes of rotating, @@ -100,7 +102,7 @@ img_ = mmcv.imrotate(img, 30, center=(100, 100)) img_ = mmcv.imrotate(img, 30, auto_bound=True) ``` -### Flip +#### Flip To flip an image, use `imflip`. @@ -114,7 +116,7 @@ mmcv.imflip(img) mmcv.imflip(img, direction='vertical') ``` -### Crop +#### Crop `imcrop` can crop the image with one or some regions, represented as (x1, y1, x2, y2). @@ -136,7 +138,7 @@ patches = mmcv.imcrop(img, bboxes) patches = mmcv.imcrop(img, bboxes, scale_ratio=1.2) ``` -### Padding +#### Padding There are two methods `impad` and `impad_to_multiple` to pad an image to the specific size with given values. @@ -160,3 +162,125 @@ img_ = mmcv.impad(img, padding=(10, 20, 30, 40), pad_val=[100, 50, 200]) # pad an image so that each edge is a multiple of some value. img_ = mmcv.impad_to_multiple(img, 32) ``` + +### Video + +This module provides the following functionalities. + +- A `VideoReader` class with friendly apis to read and convert videos. +- Some methods for editing (cut, concat, resize) videos. +- Optical flow read/write/warp. + +#### VideoReader + +The `VideoReader` class provides sequence like apis to access video frames. +It will internally cache the frames which have been visited. + +```python +video = mmcv.VideoReader('test.mp4') + +# obtain basic information +print(len(video)) +print(video.width, video.height, video.resolution, video.fps) + +# iterate over all frames +for frame in video: + print(frame.shape) + +# read the next frame +img = video.read() + +# read a frame by index +img = video[100] + +# read some frames +img = video[5:10] +``` + +To convert a video to images or generate a video from a image directory. + +```python +# split a video into frames and save to a folder +video = mmcv.VideoReader('test.mp4') +video.cvt2frames('out_dir') + +# generate video from frames +mmcv.frames2video('out_dir', 'test.avi') +``` + +#### Editing utils + +There are also some methods for editing videos, which wraps the commands of ffmpeg. + +```python +# cut a video clip +mmcv.cut_video('test.mp4', 'clip1.mp4', start=3, end=10, vcodec='h264') + +# join a list of video clips +mmcv.concat_video(['clip1.mp4', 'clip2.mp4'], 'joined.mp4', log_level='quiet') + +# resize a video with the specified size +mmcv.resize_video('test.mp4', 'resized1.mp4', (360, 240)) + +# resize a video with a scaling ratio of 2 +mmcv.resize_video('test.mp4', 'resized2.mp4', ratio=2) +``` + +#### Optical flow + +`mmcv` provides the following methods to operate on optical flows. + +- IO +- Visualization +- Flow warpping + +We provide two options to dump optical flow files: uncompressed and compressed. +The uncompressed way just dumps the floating numbers to a binary file. It is +lossless but the dumped file has a larger size. +The compressed way quantizes the optical flow to 0-255 and dumps it as a +jpeg image. The flow of x-dim and y-dim will be concatenated into a single image. + +1. IO + +```python +flow = np.random.rand(800, 600, 2).astype(np.float32) +# dump the flow to a flo file (~3.7M) +mmcv.flowwrite(flow, 'uncompressed.flo') +# dump the flow to a jpeg file (~230K) +# the shape of the dumped image is (800, 1200) +mmcv.flowwrite(flow, 'compressed.jpg', quantize=True, concat_axis=1) + +# read the flow file, the shape of loaded flow is (800, 600, 2) for both ways +flow = mmcv.flowread('uncompressed.flo') +flow = mmcv.flowread('compressed.jpg', quantize=True, concat_axis=1) +``` + +2. Visualization + +It is possible to visualize optical flows with `mmcv.flowshow()`. + +```python +mmcv.flowshow(flow) +``` + +![progress](_static/flow_visualization.png) + +3. Flow warpping + +```python +img1 = mmcv.imread('img1.jpg') +flow = mmcv.flowread('flow.flo') +warpped_img2 = mmcv.flow_warp(img1, flow) +``` + +img1 (left) and img2 (right) + +![raw images](_static/flow_raw_images.png) + +optical flow (img2 -> img1) + +![optical flow](_static/flow_img2toimg1.png) + +warpped image and difference with ground truth + +![warpped image](_static/flow_warp_diff.png) diff --git a/docs/deployment.rst b/docs/deployment.rst index 68f81f9520..7850300270 100644 --- a/docs/deployment.rst +++ b/docs/deployment.rst @@ -1,5 +1,5 @@ Deployment -======== +================ .. toctree:: :maxdepth: 2 diff --git a/docs/index.rst b/docs/index.rst index afa937379d..cf00ea44a7 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,5 +1,5 @@ -Contents -======== +Welcome to MMCV's documentation! +================================ .. toctree:: :maxdepth: 2 @@ -11,23 +11,29 @@ Contents .. toctree:: :maxdepth: 2 - :caption: Learning MMCV + :caption: Deployment + + deployment.rst + +.. toctree:: + :maxdepth: 2 + :caption: Understand the MMCV + config.md + registry.md + runner.md io.md image.md video.md visualization.md - utils.md - runner.md - registry.md cnn.md ops.md + utils.md .. toctree:: - :maxdepth: 2 - :caption: Deployment + :caption: API Reference - deployment.rst + api.rst .. toctree:: :caption: FAQ @@ -35,10 +41,9 @@ Contents trouble_shooting.md .. toctree:: - :caption: API Reference - - api.rst + :caption: Community + contributing.md Indices and tables diff --git a/docs/utils.md b/docs/utils.md index 991a862f97..9e4c5df6b3 100644 --- a/docs/utils.md +++ b/docs/utils.md @@ -1,159 +1,5 @@ ## Utils -### Config - -`Config` class is used for manipulating config and config files. It supports -loading configs from multiple file formats including **python**, **json** and **yaml**. -It provides dict-like apis to get and set values. - -Here is an example of the config file `test.py`. - -```python -a = 1 -b = dict(b1=[0, 1, 2], b2=None) -c = (1, 2) -d = 'string' -``` - -To load and use configs - -```python ->>> cfg = Config.fromfile('test.py') ->>> print(cfg) ->>> dict(a=1, -... b=dict(b1=[0, 1, 2], b2=None), -... c=(1, 2), -... d='string') -``` - -For all format configs, some predefined variables are supported. It will convert the variable in `{{ var }}` with its real value. - -Currently, it supports four predefined variables: - -`{{ fileDirname }}` - the current opened file's dirname, e.g. /home/your-username/your-project/folder - -`{{ fileBasename }}` - the current opened file's basename, e.g. file.ext - -`{{ fileBasenameNoExtension }}` - the current opened file's basename with no file extension, e.g. file - -`{{ fileExtname }}` - the current opened file's extension, e.g. .ext - -These variable names are referred from [VS Code](https://code.visualstudio.com/docs/editor/variables-reference). - -Here is one examples of config with predefined variables. - -`config_a.py` - -```python -a = 1 -b = './work_dir/{{ fileBasenameNoExtension }}' -c = '{{ fileExtname }}' -``` - -```python ->>> cfg = Config.fromfile('./config_a.py') ->>> print(cfg) ->>> dict(a=1, -... b='./work_dir/config_a', -... c='.py') -``` - -For all format configs, inheritance is supported. To reuse fields in other config files, -specify `_base_='./config_a.py'` or a list of configs `_base_=['./config_a.py', './config_b.py']`. -Here are 4 examples of config inheritance. - -`config_a.py` - -```python -a = 1 -b = dict(b1=[0, 1, 2], b2=None) -``` - -#### Inherit from base config without overlapped keys - -`config_b.py` - -```python -_base_ = './config_a.py' -c = (1, 2) -d = 'string' -``` - -```python ->>> cfg = Config.fromfile('./config_b.py') ->>> print(cfg) ->>> dict(a=1, -... b=dict(b1=[0, 1, 2], b2=None), -... c=(1, 2), -... d='string') -``` - -New fields in `config_b.py` are combined with old fields in `config_a.py` - -#### Inherit from base config with overlapped keys - -`config_c.py` - -```python -_base_ = './config_a.py' -b = dict(b2=1) -c = (1, 2) -``` - -```python ->>> cfg = Config.fromfile('./config_c.py') ->>> print(cfg) ->>> dict(a=1, -... b=dict(b1=[0, 1, 2], b2=1), -... c=(1, 2)) -``` - -`b.b2=None` in `config_a` is replaced with `b.b2=1` in `config_c.py`. - -#### Inherit from base config with ignored fields - -`config_d.py` - -```python -_base_ = './config_a.py' -b = dict(_delete_=True, b2=None, b3=0.1) -c = (1, 2) -``` - -```python ->>> cfg = Config.fromfile('./config_d.py') ->>> print(cfg) ->>> dict(a=1, -... b=dict(b2=None, b3=0.1), -... c=(1, 2)) -``` - -You may also set `_delete_=True` to ignore some fields in base configs. All old keys `b1, b2, b3` in `b` are replaced with new keys `b2, b3`. - -#### Inherit from multiple base configs (the base configs should not contain the same keys) - -`config_e.py` - -```python -c = (1, 2) -d = 'string' -``` - -`config_f.py` - -```python -_base_ = ['./config_a.py', './config_e.py'] -``` - -```python ->>> cfg = Config.fromfile('./config_f.py') ->>> print(cfg) ->>> dict(a=1, -... b=dict(b1=[0, 1, 2], b2=None), -... c=(1, 2), -... d='string') -``` - ### ProgressBar If you want to apply a method to a list of items and track the progress, `track_progress` diff --git a/docs/video.md b/docs/video.md deleted file mode 100644 index a01f377164..0000000000 --- a/docs/video.md +++ /dev/null @@ -1,117 +0,0 @@ -## Video - -This module provides the following functionalities. - -- A `VideoReader` class with friendly apis to read and convert videos. -- Some methods for editing (cut, concat, resize) videos. -- Optical flow read/write/warp. - -### VideoReader - -The `VideoReader` class provides sequence like apis to access video frames. -It will internally cache the frames which have been visited. - -```python -video = mmcv.VideoReader('test.mp4') - -# obtain basic information -print(len(video)) -print(video.width, video.height, video.resolution, video.fps) - -# iterate over all frames -for frame in video: - print(frame.shape) - -# read the next frame -img = video.read() - -# read a frame by index -img = video[100] - -# read some frames -img = video[5:10] -``` - -To convert a video to images or generate a video from a image directory. - -```python -# split a video into frames and save to a folder -video = mmcv.VideoReader('test.mp4') -video.cvt2frames('out_dir') - -# generate video from frames -mmcv.frames2video('out_dir', 'test.avi') -``` - -### Editing utils - -There are also some methods for editing videos, which wraps the commands of ffmpeg. - -```python -# cut a video clip -mmcv.cut_video('test.mp4', 'clip1.mp4', start=3, end=10, vcodec='h264') - -# join a list of video clips -mmcv.concat_video(['clip1.mp4', 'clip2.mp4'], 'joined.mp4', log_level='quiet') - -# resize a video with the specified size -mmcv.resize_video('test.mp4', 'resized1.mp4', (360, 240)) - -# resize a video with a scaling ratio of 2 -mmcv.resize_video('test.mp4', 'resized2.mp4', ratio=2) -``` - -### Optical flow - -`mmcv` provides the following methods to operate on optical flows. - -- IO -- Visualization -- Flow warpping - -We provide two options to dump optical flow files: uncompressed and compressed. -The uncompressed way just dumps the floating numbers to a binary file. It is -lossless but the dumped file has a larger size. -The compressed way quantizes the optical flow to 0-255 and dumps it as a -jpeg image. The flow of x-dim and y-dim will be concatenated into a single image. - -```python -flow = np.random.rand(800, 600, 2).astype(np.float32) -# dump the flow to a flo file (~3.7M) -mmcv.flowwrite(flow, 'uncompressed.flo') -# dump the flow to a jpeg file (~230K) -# the shape of the dumped image is (800, 1200) -mmcv.flowwrite(flow, 'compressed.jpg', quantize=True, concat_axis=1) - -# read the flow file, the shape of loaded flow is (800, 600, 2) for both ways -flow = mmcv.flowread('uncompressed.flo') -flow = mmcv.flowread('compressed.jpg', quantize=True, concat_axis=1) -``` - -It is possible to visualize optical flows with `mmcv.flowshow()`. - -```python -mmcv.flowshow(flow) -``` - -![progress](_static/flow_visualization.png) - -3. Flow warpping - -```python -img1 = mmcv.imread('img1.jpg') -flow = mmcv.flowread('flow.flo') -warpped_img2 = mmcv.flow_warp(img1, flow) -``` - -img1 (left) and img2 (right) - -![raw images](_static/flow_raw_images.png) - -optical flow (img2 -> img1) - -![optical flow](_static/flow_img2toimg1.png) - -warpped image and difference with ground truth - -![warpped image](_static/flow_warp_diff.png) From bd6ab36bf88d75ce3b97c6201935698a6d315edd Mon Sep 17 00:00:00 2001 From: zhouzaida Date: Wed, 16 Jun 2021 14:17:29 +0800 Subject: [PATCH 04/13] refactor docs --- docs/community.rst | 7 ++ docs/community/contributing.md | 69 +++++++++++++++++++ docs/deployment.rst | 10 +-- docs/{ => deployment}/onnx.md | 0 .../onnxruntime_custom_ops.md | 0 docs/{ => deployment}/onnxruntime_op.md | 0 docs/{ => deployment}/tensorrt_custom_ops.md | 0 docs/{ => deployment}/tensorrt_plugin.md | 0 docs/faq.rst | 7 ++ docs/{ => faq}/trouble_shooting.md | 0 docs/getting-started.rst | 9 +++ docs/{ => getting-started}/build.md | 0 docs/{ => getting-started}/installation.md | 0 docs/{ => getting-started}/introduction.md | 0 docs/index.rst | 42 ++--------- docs/understand-the-mmcv.rst | 15 ++++ docs/{ => understand-the-mmcv}/cnn.md | 0 docs/{ => understand-the-mmcv}/config.md | 0 .../{ => understand-the-mmcv}/data_process.md | 8 +-- docs/{ => understand-the-mmcv}/io.md | 0 docs/{ => understand-the-mmcv}/ops.md | 0 docs/{ => understand-the-mmcv}/registry.md | 4 +- docs/{ => understand-the-mmcv}/runner.md | 0 docs/{ => understand-the-mmcv}/utils.md | 4 +- .../visualization.md | 0 25 files changed, 124 insertions(+), 51 deletions(-) create mode 100644 docs/community.rst create mode 100644 docs/community/contributing.md rename docs/{ => deployment}/onnx.md (100%) rename docs/{ => deployment}/onnxruntime_custom_ops.md (100%) rename docs/{ => deployment}/onnxruntime_op.md (100%) rename docs/{ => deployment}/tensorrt_custom_ops.md (100%) rename docs/{ => deployment}/tensorrt_plugin.md (100%) create mode 100644 docs/faq.rst rename docs/{ => faq}/trouble_shooting.md (100%) create mode 100644 docs/getting-started.rst rename docs/{ => getting-started}/build.md (100%) rename docs/{ => getting-started}/installation.md (100%) rename docs/{ => getting-started}/introduction.md (100%) create mode 100644 docs/understand-the-mmcv.rst rename docs/{ => understand-the-mmcv}/cnn.md (100%) rename docs/{ => understand-the-mmcv}/config.md (100%) rename docs/{ => understand-the-mmcv}/data_process.md (97%) rename docs/{ => understand-the-mmcv}/io.md (100%) rename docs/{ => understand-the-mmcv}/ops.md (100%) rename docs/{ => understand-the-mmcv}/registry.md (99%) rename docs/{ => understand-the-mmcv}/runner.md (100%) rename docs/{ => understand-the-mmcv}/utils.md (94%) rename docs/{ => understand-the-mmcv}/visualization.md (100%) diff --git a/docs/community.rst b/docs/community.rst new file mode 100644 index 0000000000..33a24f671d --- /dev/null +++ b/docs/community.rst @@ -0,0 +1,7 @@ +Community +=========== + +.. toctree:: + :maxdepth: 2 + + community/contributing.md diff --git a/docs/community/contributing.md b/docs/community/contributing.md new file mode 100644 index 0000000000..f347c6c10e --- /dev/null +++ b/docs/community/contributing.md @@ -0,0 +1,69 @@ +## Contributing to OpenMMLab + +All kinds of contributions are welcome, including but not limited to the following. + +- Fixes (typo, bugs) +- New features and components + +### Workflow + +1. fork and pull the latest OpenMMLab repository +2. checkout a new branch (do not use master branch for PRs) +3. commit your changes +4. create a PR + +Note: If you plan to add some new features that involve large changes, it is encouraged to open an issue for discussion first. + +### Code style + +#### Python + +We adopt [PEP8](https://www.python.org/dev/peps/pep-0008/) as the preferred code style. + +We use the following tools for linting and formatting: + +- [flake8](http://flake8.pycqa.org/en/latest/): A wrapper around some linter tools. +- [yapf](https://github.com/google/yapf): A formatter for Python files. +- [isort](https://github.com/timothycrosley/isort): A Python utility to sort imports. +- [markdownlint](https://github.com/markdownlint/markdownlint): A linter to check markdown files and flag style issues. +- [docformatter](https://github.com/myint/docformatter): A formatter to format docstring. + +Style configurations of yapf and isort can be found in [setup.cfg](./setup.cfg). + +We use [pre-commit hook](https://pre-commit.com/) that checks and formats for `flake8`, `yapf`, `isort`, `trailing whitespaces`, `markdown files`, +fixes `end-of-files`, `double-quoted-strings`, `python-encoding-pragma`, `mixed-line-ending`, sorts `requirments.txt` automatically on every commit. +The config for a pre-commit hook is stored in [.pre-commit-config](./.pre-commit-config.yaml). + +After you clone the repository, you will need to install initialize pre-commit hook. + +```shell +pip install -U pre-commit +``` + +From the repository folder + +```shell +pre-commit install +``` + +Try the following steps to install ruby when you encounter an issue on installing markdownlint + +```shell +# install rvm +curl -L https://get.rvm.io | bash -s -- --autolibs=read-fail +[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" +rvm autolibs disable + +# install ruby +rvm install 2.7.1 +``` + +Or refer to [this repo](https://github.com/innerlee/setup) and take [`zzruby.sh`](https://github.com/innerlee/setup/blob/master/zzruby.sh) according its instruction. + +After this on every commit check code linters and formatter will be enforced. + +>Before you create a PR, make sure that your code lints and is formatted by yapf. + +#### C++ and CUDA + +We follow the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html). diff --git a/docs/deployment.rst b/docs/deployment.rst index 7850300270..bfbf776ac0 100644 --- a/docs/deployment.rst +++ b/docs/deployment.rst @@ -4,8 +4,8 @@ Deployment .. toctree:: :maxdepth: 2 - onnx.md - onnxruntime_op.md - onnxruntime_custom_ops.md - tensorrt_plugin.md - tensorrt_custom_ops.md + deployment/onnx.md + deployment/onnxruntime_op.md + deployment/onnxruntime_custom_ops.md + deployment/tensorrt_plugin.md + deployment/tensorrt_custom_ops.md diff --git a/docs/onnx.md b/docs/deployment/onnx.md similarity index 100% rename from docs/onnx.md rename to docs/deployment/onnx.md diff --git a/docs/onnxruntime_custom_ops.md b/docs/deployment/onnxruntime_custom_ops.md similarity index 100% rename from docs/onnxruntime_custom_ops.md rename to docs/deployment/onnxruntime_custom_ops.md diff --git a/docs/onnxruntime_op.md b/docs/deployment/onnxruntime_op.md similarity index 100% rename from docs/onnxruntime_op.md rename to docs/deployment/onnxruntime_op.md diff --git a/docs/tensorrt_custom_ops.md b/docs/deployment/tensorrt_custom_ops.md similarity index 100% rename from docs/tensorrt_custom_ops.md rename to docs/deployment/tensorrt_custom_ops.md diff --git a/docs/tensorrt_plugin.md b/docs/deployment/tensorrt_plugin.md similarity index 100% rename from docs/tensorrt_plugin.md rename to docs/deployment/tensorrt_plugin.md diff --git a/docs/faq.rst b/docs/faq.rst new file mode 100644 index 0000000000..fdb8aaeec8 --- /dev/null +++ b/docs/faq.rst @@ -0,0 +1,7 @@ +FAQ +==== + +.. toctree:: + :maxdepth: 2 + + faq/trouble_shooting.md diff --git a/docs/trouble_shooting.md b/docs/faq/trouble_shooting.md similarity index 100% rename from docs/trouble_shooting.md rename to docs/faq/trouble_shooting.md diff --git a/docs/getting-started.rst b/docs/getting-started.rst new file mode 100644 index 0000000000..fae5f8dd7a --- /dev/null +++ b/docs/getting-started.rst @@ -0,0 +1,9 @@ +Getting started +=================== + +.. toctree:: + :maxdepth: 2 + + getting-started/introduction.md + getting-started/installation.md + getting-started/build.md diff --git a/docs/build.md b/docs/getting-started/build.md similarity index 100% rename from docs/build.md rename to docs/getting-started/build.md diff --git a/docs/installation.md b/docs/getting-started/installation.md similarity index 100% rename from docs/installation.md rename to docs/getting-started/installation.md diff --git a/docs/introduction.md b/docs/getting-started/introduction.md similarity index 100% rename from docs/introduction.md rename to docs/getting-started/introduction.md diff --git a/docs/index.rst b/docs/index.rst index cf00ea44a7..0f5aa89c84 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -3,47 +3,13 @@ Welcome to MMCV's documentation! .. toctree:: :maxdepth: 2 - :caption: Getting started - - introduction.md - installation.md - build.md - -.. toctree:: - :maxdepth: 2 - :caption: Deployment + getting-started.rst deployment.rst - -.. toctree:: - :maxdepth: 2 - :caption: Understand the MMCV - - config.md - registry.md - runner.md - io.md - image.md - video.md - visualization.md - cnn.md - ops.md - utils.md - -.. toctree:: - :caption: API Reference - + understand-the-mmcv.rst api.rst - -.. toctree:: - :caption: FAQ - - trouble_shooting.md - -.. toctree:: - :caption: Community - - contributing.md + faq.rst + community.rst Indices and tables diff --git a/docs/understand-the-mmcv.rst b/docs/understand-the-mmcv.rst new file mode 100644 index 0000000000..fed944ad69 --- /dev/null +++ b/docs/understand-the-mmcv.rst @@ -0,0 +1,15 @@ +Understand the MMCV +===================== + +.. toctree:: + :maxdepth: 2 + + understand-the-mmcv/config.md + understand-the-mmcv/registry.md + understand-the-mmcv/runner.md + understand-the-mmcv/io.md + understand-the-mmcv/data_process.md + understand-the-mmcv/visualization.md + understand-the-mmcv/cnn.md + understand-the-mmcv/ops.md + understand-the-mmcv/utils.md diff --git a/docs/cnn.md b/docs/understand-the-mmcv/cnn.md similarity index 100% rename from docs/cnn.md rename to docs/understand-the-mmcv/cnn.md diff --git a/docs/config.md b/docs/understand-the-mmcv/config.md similarity index 100% rename from docs/config.md rename to docs/understand-the-mmcv/config.md diff --git a/docs/data_process.md b/docs/understand-the-mmcv/data_process.md similarity index 97% rename from docs/data_process.md rename to docs/understand-the-mmcv/data_process.md index 7f141370a2..35b9121ff2 100644 --- a/docs/data_process.md +++ b/docs/understand-the-mmcv/data_process.md @@ -263,7 +263,7 @@ It is possible to visualize optical flows with `mmcv.flowshow()`. mmcv.flowshow(flow) ``` -![progress](_static/flow_visualization.png) +![progress](../_static/flow_visualization.png) 3. Flow warpping @@ -275,12 +275,12 @@ warpped_img2 = mmcv.flow_warp(img1, flow) img1 (left) and img2 (right) -![raw images](_static/flow_raw_images.png) +![raw images](../_static/flow_raw_images.png) optical flow (img2 -> img1) -![optical flow](_static/flow_img2toimg1.png) +![optical flow](../_static/flow_img2toimg1.png) warpped image and difference with ground truth -![warpped image](_static/flow_warp_diff.png) +![warpped image](../_static/flow_warp_diff.png) diff --git a/docs/io.md b/docs/understand-the-mmcv/io.md similarity index 100% rename from docs/io.md rename to docs/understand-the-mmcv/io.md diff --git a/docs/ops.md b/docs/understand-the-mmcv/ops.md similarity index 100% rename from docs/ops.md rename to docs/understand-the-mmcv/ops.md diff --git a/docs/registry.md b/docs/understand-the-mmcv/registry.md similarity index 99% rename from docs/registry.md rename to docs/understand-the-mmcv/registry.md index 3793224b6d..242a962a20 100644 --- a/docs/registry.md +++ b/docs/understand-the-mmcv/registry.md @@ -62,7 +62,7 @@ converter_cfg = dict(type='Converter1', a=a_value, b=b_value) converter = CONVERTERS.build(converter_cfg) ``` -## Customize Build Function +### Customize Build Function Suppose we would like to customize how `converters` are built, we could implement a customized `build_func` and pass it into the registry. @@ -89,7 +89,7 @@ Note: in this example, we demonstrate how to use the `build_func` argument to cu The functionality is similar to the default `build_from_cfg`. In most cases, default one would be sufficient. `build_model_from_cfg` is also implemented to build PyTorch module in `nn.Sequentail`, you may directly use them instead of implementing by yourself. -## Hierarchy Registry +### Hierarchy Registry You could also build modules from more than one OpenMMLab frameworks, e.g. you could use all backbones in [MMClassification](https://github.com/open-mmlab/mmclassification) for object detectors in [MMDetection](https://github.com/open-mmlab/mmdetection), you may also combine an object detection model in [MMDetection](https://github.com/open-mmlab/mmdetection) and semantic segmentation model in [MMSegmentation](https://github.com/open-mmlab/mmsegmentation). diff --git a/docs/runner.md b/docs/understand-the-mmcv/runner.md similarity index 100% rename from docs/runner.md rename to docs/understand-the-mmcv/runner.md diff --git a/docs/utils.md b/docs/understand-the-mmcv/utils.md similarity index 94% rename from docs/utils.md rename to docs/understand-the-mmcv/utils.md index 9e4c5df6b3..6936688b3b 100644 --- a/docs/utils.md +++ b/docs/understand-the-mmcv/utils.md @@ -18,7 +18,7 @@ mmcv.track_progress(func, tasks) ``` The output is like the following. -![progress](_static/progress.gif) +![progress](../_static/progress.gif) There is another method `track_parallel_progress`, which wraps multiprocessing and progress visualization. @@ -27,7 +27,7 @@ progress visualization. mmcv.track_parallel_progress(func, tasks, 8) # 8 workers ``` -![progress](_static/parallel_progress.gif) +![progress](../_static/parallel_progress.gif) If you want to iterate or enumerate a list of items and track the progress, `track_iter_progress` is a good choice. It will display a progress bar to tell the progress and ETA. diff --git a/docs/visualization.md b/docs/understand-the-mmcv/visualization.md similarity index 100% rename from docs/visualization.md rename to docs/understand-the-mmcv/visualization.md From 9b03ea6b69aacded18a43ecc344b52bf25b4c72d Mon Sep 17 00:00:00 2001 From: zhouzaida Date: Wed, 16 Jun 2021 14:20:56 +0800 Subject: [PATCH 05/13] set sphinx==3.1.2 --- requirements/docs.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements/docs.txt b/requirements/docs.txt index e14f32b690..7f4b88d7bd 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -1,3 +1,4 @@ m2r +sphinx==3.1.2 sphinx_markdown_tables torch From f734c872b986a0a096c902d3de6ae247fc545de7 Mon Sep 17 00:00:00 2001 From: zhouzaida Date: Wed, 16 Jun 2021 14:24:02 +0800 Subject: [PATCH 06/13] fix typo --- docs/deployment/onnx.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/deployment/onnx.md b/docs/deployment/onnx.md index c561622379..90c5540071 100644 --- a/docs/deployment/onnx.md +++ b/docs/deployment/onnx.md @@ -1,4 +1,4 @@ -# Introduction of `onnx` module in MMCV (Experimental) +# Introduction of onnx module in MMCV (Experimental) ## register_extra_symbolics From 5931ac0a89e2cae3be278b3c1d041a6ef7823900 Mon Sep 17 00:00:00 2001 From: zhouzaida Date: Sun, 20 Jun 2021 13:47:53 +0800 Subject: [PATCH 07/13] modify according to comment --- docs/community/contributing.md | 70 +--------------------------------- 1 file changed, 1 insertion(+), 69 deletions(-) mode change 100644 => 120000 docs/community/contributing.md diff --git a/docs/community/contributing.md b/docs/community/contributing.md deleted file mode 100644 index f347c6c10e..0000000000 --- a/docs/community/contributing.md +++ /dev/null @@ -1,69 +0,0 @@ -## Contributing to OpenMMLab - -All kinds of contributions are welcome, including but not limited to the following. - -- Fixes (typo, bugs) -- New features and components - -### Workflow - -1. fork and pull the latest OpenMMLab repository -2. checkout a new branch (do not use master branch for PRs) -3. commit your changes -4. create a PR - -Note: If you plan to add some new features that involve large changes, it is encouraged to open an issue for discussion first. - -### Code style - -#### Python - -We adopt [PEP8](https://www.python.org/dev/peps/pep-0008/) as the preferred code style. - -We use the following tools for linting and formatting: - -- [flake8](http://flake8.pycqa.org/en/latest/): A wrapper around some linter tools. -- [yapf](https://github.com/google/yapf): A formatter for Python files. -- [isort](https://github.com/timothycrosley/isort): A Python utility to sort imports. -- [markdownlint](https://github.com/markdownlint/markdownlint): A linter to check markdown files and flag style issues. -- [docformatter](https://github.com/myint/docformatter): A formatter to format docstring. - -Style configurations of yapf and isort can be found in [setup.cfg](./setup.cfg). - -We use [pre-commit hook](https://pre-commit.com/) that checks and formats for `flake8`, `yapf`, `isort`, `trailing whitespaces`, `markdown files`, -fixes `end-of-files`, `double-quoted-strings`, `python-encoding-pragma`, `mixed-line-ending`, sorts `requirments.txt` automatically on every commit. -The config for a pre-commit hook is stored in [.pre-commit-config](./.pre-commit-config.yaml). - -After you clone the repository, you will need to install initialize pre-commit hook. - -```shell -pip install -U pre-commit -``` - -From the repository folder - -```shell -pre-commit install -``` - -Try the following steps to install ruby when you encounter an issue on installing markdownlint - -```shell -# install rvm -curl -L https://get.rvm.io | bash -s -- --autolibs=read-fail -[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" -rvm autolibs disable - -# install ruby -rvm install 2.7.1 -``` - -Or refer to [this repo](https://github.com/innerlee/setup) and take [`zzruby.sh`](https://github.com/innerlee/setup/blob/master/zzruby.sh) according its instruction. - -After this on every commit check code linters and formatter will be enforced. - ->Before you create a PR, make sure that your code lints and is formatted by yapf. - -#### C++ and CUDA - -We follow the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html). diff --git a/docs/community/contributing.md b/docs/community/contributing.md new file mode 120000 index 0000000000..f939e75f21 --- /dev/null +++ b/docs/community/contributing.md @@ -0,0 +1 @@ +../../CONTRIBUTING.md \ No newline at end of file From c6ca4ce6a7680fbfef1d1343bf10607ac25e6f98 Mon Sep 17 00:00:00 2001 From: zhouzaida Date: Sun, 20 Jun 2021 13:48:04 +0800 Subject: [PATCH 08/13] modify according to comment --- CONTRIBUTING.md | 10 +++++----- docs/understand-mmcv.rst | 15 +++++++++++++++ .../cnn.md | 0 .../config.md | 0 .../data_process.md | 0 .../io.md | 0 .../ops.md | 0 .../registry.md | 0 .../runner.md | 0 .../utils.md | 0 .../visualization.md | 0 docs/understand-the-mmcv.rst | 15 --------------- 12 files changed, 20 insertions(+), 20 deletions(-) create mode 100644 docs/understand-mmcv.rst rename docs/{understand-the-mmcv => understand-mmcv}/cnn.md (100%) rename docs/{understand-the-mmcv => understand-mmcv}/config.md (100%) rename docs/{understand-the-mmcv => understand-mmcv}/data_process.md (100%) rename docs/{understand-the-mmcv => understand-mmcv}/io.md (100%) rename docs/{understand-the-mmcv => understand-mmcv}/ops.md (100%) rename docs/{understand-the-mmcv => understand-mmcv}/registry.md (100%) rename docs/{understand-the-mmcv => understand-mmcv}/runner.md (100%) rename docs/{understand-the-mmcv => understand-mmcv}/utils.md (100%) rename docs/{understand-the-mmcv => understand-mmcv}/visualization.md (100%) delete mode 100644 docs/understand-the-mmcv.rst diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7a987d9b1b..f347c6c10e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,11 +1,11 @@ -# Contributing to OpenMMLab +## Contributing to OpenMMLab All kinds of contributions are welcome, including but not limited to the following. - Fixes (typo, bugs) - New features and components -## Workflow +### Workflow 1. fork and pull the latest OpenMMLab repository 2. checkout a new branch (do not use master branch for PRs) @@ -14,9 +14,9 @@ All kinds of contributions are welcome, including but not limited to the followi Note: If you plan to add some new features that involve large changes, it is encouraged to open an issue for discussion first. -## Code style +### Code style -### Python +#### Python We adopt [PEP8](https://www.python.org/dev/peps/pep-0008/) as the preferred code style. @@ -64,6 +64,6 @@ After this on every commit check code linters and formatter will be enforced. >Before you create a PR, make sure that your code lints and is formatted by yapf. -### C++ and CUDA +#### C++ and CUDA We follow the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html). diff --git a/docs/understand-mmcv.rst b/docs/understand-mmcv.rst new file mode 100644 index 0000000000..c2d885ce30 --- /dev/null +++ b/docs/understand-mmcv.rst @@ -0,0 +1,15 @@ +Understand MMCV +================= + +.. toctree:: + :maxdepth: 2 + + understand-mmcv/config.md + understand-mmcv/registry.md + understand-mmcv/runner.md + understand-mmcv/io.md + understand-mmcv/data_process.md + understand-mmcv/visualization.md + understand-mmcv/cnn.md + understand-mmcv/ops.md + understand-mmcv/utils.md diff --git a/docs/understand-the-mmcv/cnn.md b/docs/understand-mmcv/cnn.md similarity index 100% rename from docs/understand-the-mmcv/cnn.md rename to docs/understand-mmcv/cnn.md diff --git a/docs/understand-the-mmcv/config.md b/docs/understand-mmcv/config.md similarity index 100% rename from docs/understand-the-mmcv/config.md rename to docs/understand-mmcv/config.md diff --git a/docs/understand-the-mmcv/data_process.md b/docs/understand-mmcv/data_process.md similarity index 100% rename from docs/understand-the-mmcv/data_process.md rename to docs/understand-mmcv/data_process.md diff --git a/docs/understand-the-mmcv/io.md b/docs/understand-mmcv/io.md similarity index 100% rename from docs/understand-the-mmcv/io.md rename to docs/understand-mmcv/io.md diff --git a/docs/understand-the-mmcv/ops.md b/docs/understand-mmcv/ops.md similarity index 100% rename from docs/understand-the-mmcv/ops.md rename to docs/understand-mmcv/ops.md diff --git a/docs/understand-the-mmcv/registry.md b/docs/understand-mmcv/registry.md similarity index 100% rename from docs/understand-the-mmcv/registry.md rename to docs/understand-mmcv/registry.md diff --git a/docs/understand-the-mmcv/runner.md b/docs/understand-mmcv/runner.md similarity index 100% rename from docs/understand-the-mmcv/runner.md rename to docs/understand-mmcv/runner.md diff --git a/docs/understand-the-mmcv/utils.md b/docs/understand-mmcv/utils.md similarity index 100% rename from docs/understand-the-mmcv/utils.md rename to docs/understand-mmcv/utils.md diff --git a/docs/understand-the-mmcv/visualization.md b/docs/understand-mmcv/visualization.md similarity index 100% rename from docs/understand-the-mmcv/visualization.md rename to docs/understand-mmcv/visualization.md diff --git a/docs/understand-the-mmcv.rst b/docs/understand-the-mmcv.rst deleted file mode 100644 index fed944ad69..0000000000 --- a/docs/understand-the-mmcv.rst +++ /dev/null @@ -1,15 +0,0 @@ -Understand the MMCV -===================== - -.. toctree:: - :maxdepth: 2 - - understand-the-mmcv/config.md - understand-the-mmcv/registry.md - understand-the-mmcv/runner.md - understand-the-mmcv/io.md - understand-the-mmcv/data_process.md - understand-the-mmcv/visualization.md - understand-the-mmcv/cnn.md - understand-the-mmcv/ops.md - understand-the-mmcv/utils.md From 197d710a3f78f0f0ef3f89aa26b9891b59a6719d Mon Sep 17 00:00:00 2001 From: zhouzaida Date: Sun, 20 Jun 2021 13:50:07 +0800 Subject: [PATCH 09/13] modify according to comment --- docs/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index 0f5aa89c84..55fdd904f4 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -6,7 +6,7 @@ Welcome to MMCV's documentation! getting-started.rst deployment.rst - understand-the-mmcv.rst + understand-mmcv.rst api.rst faq.rst community.rst From 4a7b42b5b06c50bc9a17f7114d63cfa75ad915a3 Mon Sep 17 00:00:00 2001 From: zhouzaida Date: Mon, 28 Jun 2021 18:02:01 +0800 Subject: [PATCH 10/13] [Docs] delete unnecessary file --- docs/understand-mmcv/config.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/understand-mmcv/config.md b/docs/understand-mmcv/config.md index 009102cce7..2d0447f2f0 100644 --- a/docs/understand-mmcv/config.md +++ b/docs/understand-mmcv/config.md @@ -152,7 +152,7 @@ _base_ = ['./config_a.py', './config_e.py'] ... d='string') ``` -#### Reference variables from base +### Reference variables from base You can reference variables defined in base using the following grammar. From d38824fd8d5f2f5f3418132108387f32c03c887a Mon Sep 17 00:00:00 2001 From: zhouzaida Date: Fri, 2 Jul 2021 10:48:30 +0800 Subject: [PATCH 11/13] fix title --- docs/{trouble_shooting.md => faq.md} | 2 +- docs/index.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename docs/{trouble_shooting.md => faq.md} (98%) diff --git a/docs/trouble_shooting.md b/docs/faq.md similarity index 98% rename from docs/trouble_shooting.md rename to docs/faq.md index fb0976d072..ab0dd135f9 100644 --- a/docs/trouble_shooting.md +++ b/docs/faq.md @@ -1,4 +1,4 @@ -## Trouble Shooting +## Frequently Asked Questions We list some common troubles faced by many users and their corresponding solutions here. Feel free to enrich the list if you find any frequent issues and have ways to help others to solve them. diff --git a/docs/index.rst b/docs/index.rst index e462f4150b..89ac9a5dbe 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -8,7 +8,7 @@ Welcome to MMCV's documentation! deployment.rst understand-mmcv.rst api.rst - trouble_shooting.md + faq.md community.rst From 79310f5d5b436d6609a8917008bc14d8259e9bb2 Mon Sep 17 00:00:00 2001 From: zhouzaida Date: Fri, 2 Jul 2021 14:26:21 +0800 Subject: [PATCH 12/13] rename --- docs/get_started.rst | 9 +++++++++ docs/{getting-started => get_started}/build.md | 0 .../installation.md | 0 .../introduction.md | 0 docs/getting-started.rst | 9 --------- docs/index.rst | 4 ++-- docs/understand-mmcv.rst | 15 --------------- docs/understand_mmcv.rst | 15 +++++++++++++++ docs/{understand-mmcv => understand_mmcv}/cnn.md | 0 .../config.md | 0 .../data_process.md | 0 docs/{understand-mmcv => understand_mmcv}/io.md | 0 docs/{understand-mmcv => understand_mmcv}/ops.md | 0 .../registry.md | 0 .../runner.md | 0 .../{understand-mmcv => understand_mmcv}/utils.md | 0 .../visualization.md | 0 17 files changed, 26 insertions(+), 26 deletions(-) create mode 100644 docs/get_started.rst rename docs/{getting-started => get_started}/build.md (100%) rename docs/{getting-started => get_started}/installation.md (100%) rename docs/{getting-started => get_started}/introduction.md (100%) delete mode 100644 docs/getting-started.rst delete mode 100644 docs/understand-mmcv.rst create mode 100644 docs/understand_mmcv.rst rename docs/{understand-mmcv => understand_mmcv}/cnn.md (100%) rename docs/{understand-mmcv => understand_mmcv}/config.md (100%) rename docs/{understand-mmcv => understand_mmcv}/data_process.md (100%) rename docs/{understand-mmcv => understand_mmcv}/io.md (100%) rename docs/{understand-mmcv => understand_mmcv}/ops.md (100%) rename docs/{understand-mmcv => understand_mmcv}/registry.md (100%) rename docs/{understand-mmcv => understand_mmcv}/runner.md (100%) rename docs/{understand-mmcv => understand_mmcv}/utils.md (100%) rename docs/{understand-mmcv => understand_mmcv}/visualization.md (100%) diff --git a/docs/get_started.rst b/docs/get_started.rst new file mode 100644 index 0000000000..ade40d101d --- /dev/null +++ b/docs/get_started.rst @@ -0,0 +1,9 @@ +Getting started +=================== + +.. toctree:: + :maxdepth: 2 + + getting_started/introduction.md + getting_started/installation.md + getting_started/build.md diff --git a/docs/getting-started/build.md b/docs/get_started/build.md similarity index 100% rename from docs/getting-started/build.md rename to docs/get_started/build.md diff --git a/docs/getting-started/installation.md b/docs/get_started/installation.md similarity index 100% rename from docs/getting-started/installation.md rename to docs/get_started/installation.md diff --git a/docs/getting-started/introduction.md b/docs/get_started/introduction.md similarity index 100% rename from docs/getting-started/introduction.md rename to docs/get_started/introduction.md diff --git a/docs/getting-started.rst b/docs/getting-started.rst deleted file mode 100644 index fae5f8dd7a..0000000000 --- a/docs/getting-started.rst +++ /dev/null @@ -1,9 +0,0 @@ -Getting started -=================== - -.. toctree:: - :maxdepth: 2 - - getting-started/introduction.md - getting-started/installation.md - getting-started/build.md diff --git a/docs/index.rst b/docs/index.rst index 89ac9a5dbe..f8f3b59077 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -4,9 +4,9 @@ Welcome to MMCV's documentation! .. toctree:: :maxdepth: 2 - getting-started.rst + get_started.rst deployment.rst - understand-mmcv.rst + understand_mmcv.rst api.rst faq.md community.rst diff --git a/docs/understand-mmcv.rst b/docs/understand-mmcv.rst deleted file mode 100644 index c2d885ce30..0000000000 --- a/docs/understand-mmcv.rst +++ /dev/null @@ -1,15 +0,0 @@ -Understand MMCV -================= - -.. toctree:: - :maxdepth: 2 - - understand-mmcv/config.md - understand-mmcv/registry.md - understand-mmcv/runner.md - understand-mmcv/io.md - understand-mmcv/data_process.md - understand-mmcv/visualization.md - understand-mmcv/cnn.md - understand-mmcv/ops.md - understand-mmcv/utils.md diff --git a/docs/understand_mmcv.rst b/docs/understand_mmcv.rst new file mode 100644 index 0000000000..ef26d386f5 --- /dev/null +++ b/docs/understand_mmcv.rst @@ -0,0 +1,15 @@ +Understand MMCV +================= + +.. toctree:: + :maxdepth: 2 + + understand_mmcv/config.md + understand_mmcv/registry.md + understand_mmcv/runner.md + understand_mmcv/io.md + understand_mmcv/data_process.md + understand_mmcv/visualization.md + understand_mmcv/cnn.md + understand_mmcv/ops.md + understand_mmcv/utils.md diff --git a/docs/understand-mmcv/cnn.md b/docs/understand_mmcv/cnn.md similarity index 100% rename from docs/understand-mmcv/cnn.md rename to docs/understand_mmcv/cnn.md diff --git a/docs/understand-mmcv/config.md b/docs/understand_mmcv/config.md similarity index 100% rename from docs/understand-mmcv/config.md rename to docs/understand_mmcv/config.md diff --git a/docs/understand-mmcv/data_process.md b/docs/understand_mmcv/data_process.md similarity index 100% rename from docs/understand-mmcv/data_process.md rename to docs/understand_mmcv/data_process.md diff --git a/docs/understand-mmcv/io.md b/docs/understand_mmcv/io.md similarity index 100% rename from docs/understand-mmcv/io.md rename to docs/understand_mmcv/io.md diff --git a/docs/understand-mmcv/ops.md b/docs/understand_mmcv/ops.md similarity index 100% rename from docs/understand-mmcv/ops.md rename to docs/understand_mmcv/ops.md diff --git a/docs/understand-mmcv/registry.md b/docs/understand_mmcv/registry.md similarity index 100% rename from docs/understand-mmcv/registry.md rename to docs/understand_mmcv/registry.md diff --git a/docs/understand-mmcv/runner.md b/docs/understand_mmcv/runner.md similarity index 100% rename from docs/understand-mmcv/runner.md rename to docs/understand_mmcv/runner.md diff --git a/docs/understand-mmcv/utils.md b/docs/understand_mmcv/utils.md similarity index 100% rename from docs/understand-mmcv/utils.md rename to docs/understand_mmcv/utils.md diff --git a/docs/understand-mmcv/visualization.md b/docs/understand_mmcv/visualization.md similarity index 100% rename from docs/understand-mmcv/visualization.md rename to docs/understand_mmcv/visualization.md From 88f306043b662a3854004391db5e1fed1649a6d5 Mon Sep 17 00:00:00 2001 From: zhouzaida Date: Fri, 2 Jul 2021 14:42:16 +0800 Subject: [PATCH 13/13] rename --- docs/get_started.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/get_started.rst b/docs/get_started.rst index ade40d101d..e8366a887a 100644 --- a/docs/get_started.rst +++ b/docs/get_started.rst @@ -1,9 +1,9 @@ -Getting started +Get started =================== .. toctree:: :maxdepth: 2 - getting_started/introduction.md - getting_started/installation.md - getting_started/build.md + get_started/introduction.md + get_started/installation.md + get_started/build.md