Skip to content

Commit

Permalink
Merge branch 'master' into fix_indep
Browse files Browse the repository at this point in the history
  • Loading branch information
kennymckormick committed Aug 10, 2021
2 parents a8d199e + 94a677d commit 09b9af5
Show file tree
Hide file tree
Showing 345 changed files with 523 additions and 95 deletions.
2 changes: 2 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
version: 2

formats: all

python:
version: 3.7
install:
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) Open-MMLab. All rights reserved.
Copyright (c) OpenMMLab. All rights reserved

Apache License
Version 2.0, January 2004
Expand Down
Binary file added docs/_static/community/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/community/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/community/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
92 changes: 92 additions & 0 deletions docs/community/pr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
## Pull Request (PR)

### What is PR

`PR` is the abbreviation of `Pull Request`. Here's the definition of `PR` in the [official document](https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests) of Github.

> Pull requests let you tell others about changes you've pushed to a branch in a repository on GitHub. Once a pull request is opened, you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the base branch.
## Basic Workflow

1. Get the most recent codebase
2. Checkout a new branch from the master branch
3. Commit your changes
4. Push your changes and create a PR
5. Discuss and review your code
6. Merge your branch to the master branch

### Procedures in detail

1. Get the most recent codebase
+ When you work on your first PR
- Fork the OpenMMLab repository: click the **fork** button at the top right corner of Github page
![avatar](../_static/community/1.png)

- Clone forked repository to local
```bash
git clone git@github.com:XXX/mmcv.git
```

- Add source repository to upstream
```bash
git remote add upstream git@github.com:open-mmlab/mmcv
```

+ After your first PR
- Checkout master branch of the local repository and pull the latest master branch of the source repository
```bash
git checkout master
git pull upstream master
```

2. Checkout a new branch from the master branch
```bash
git checkout -b branchname
```

NOTE: To make commit history clear, we strongly recommend you checkout the master branch before create a new branch.

3. Commit your changes
```bash
# coding
git add [files]
git commit -m 'messages'
```

4. Push your changes to the forked repository and create a PR
+ Push the branch to your forked remote repository
```bash
git push origin branchname
```

+ Create a PR
![avatar](../_static/community/2.png)

+ Revise PR message template to describe your motivation and modifications made in this PR. You can also link the related issue to the PR manually in the PR message (For more information, checkout the [official guidance](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue)).

5. Discuss and review your code
+ After creating a pull request, you can ask a specific person to review the changes you've proposed
![avatar](../_static/community/3.png)
+ Modify your codes according to reviewers' suggestions and then push your changes

6. Merge your branch to the master branch and delete the branch
```bash
git branch -d branchname # delete local branch
git push origin --delete branchname # delete remote branch
```

### PR Specs

1. Use [pre-commit](https://pre-commit.com) hook to avoid issues of code style
2. One short-time branch should be matched with only one PR
3. Accomplish a detailed change in one PR. Avoid large PR
>- Bad: Support Faster R-CNN
>- Acceptable: Add a box head to Faster R-CNN
>- Good: Add a parameter to box head to support custom conv-layer number
4. Provide clear and significant commit message
5. Provide clear and meaningful PR description
>- Task name should be clarified in title. The general format is: [Prefix] Short description of the PR (Suffix)
>- Prefix: add new feature [Feature], fix bug [Fix], related to documents [Docs], in developing [WIP] (which will not be reviewed temporarily)
>- Introduce main changes, results and influences on other modules in short description
>- Associate related issues and pull requests with a milestone
90 changes: 90 additions & 0 deletions docs_zh_CN/community/pr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
## 拉取请求

### 什么是拉取请求?

`拉取请求` (Pull Request), [GitHub 官方文档](https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests)定义如下。

>拉取请求是一种通知机制。你修改了他人的代码,将你的修改通知原来作者,希望他合并你的修改。
### 基本的工作流:

1. 获取最新的代码库
2. 从主分支创建最新的分支进行开发
3. 提交修改
4. 推送你的修改并创建一个`拉取请求`
5. 讨论、审核代码
6. 将开发分支合并到主分支

### 具体步骤

1. 获取最新的代码库
+ 当你第一次提 PR 时
- 复刻 OpenMMLab 原代码库,点击 GitHub 页面右上角的 **Fork** 按钮即可
![avatar](../_static/community/1.png)

- 克隆复刻的代码库到本地
```bash
git clone git@github.com:XXX/mmcv.git
```

- 添加原代码库为上游代码库
```bash
git remote add upstream git@github.com:open-mmlab/mmcv
```
+ 从第二个 PR 起
- 检出本地代码库的主分支,然后从最新的原代码库的主分支拉取更新
```bash
git checkout master
git pull upstream master
```

2. 从主分支创建一个新的开发分支
```bash
git checkout -b branchname
```
注意:为了保证提交历史清晰可读,我们强烈推荐您先检出主分支 (master),再创建新的分支。

3. 提交你的修改
```bash
# coding
git add [files]
git commit -m 'messages'
```

4. 推送你的修改到复刻的代码库,并创建一个`拉取请求`
+ 推送当前分支到远端复刻的代码库
```bash
git push origin branchname
```

+ 创建一个`拉取请求`
![avatar](../_static/community/2.png)

+ 修改`拉取请求`信息模板,描述修改原因和修改内容。还可以在 PR 描述中,手动关联到相关的`议题` (issue),(更多细节,请参考[官方文档](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue))。

5. 讨论并评审你的代码
+ 创建`拉取请求`时,可以关联给相关人员进行评审
![avatar](../_static/community/3.png)

+ 根据评审人员的意见修改代码,并推送修改

6. `拉取请求`合并之后删除该分支
```bash
git branch -d branchname # delete local branch
git push origin --delete branchname # delete remote branch
```

### PR 规范

1. 使用 [pre-commit hook](https://pre-commit.com),尽量减少代码风格相关问题
2. 一个PR对应一个短期分支
3. 粒度要细,一个PR只做一件事情,避免超大的PR
>- Bad:实现Faster R-CNN
>- Acceptable:给 Faster R-CNN 添加一个 box head
>- Good:给 box head 增加一个参数来支持自定义的 conv 层数
4. 每次 Commit 时需要提供清晰且有意义 commit 信息
5. 提供清晰且有意义的`拉取请求`描述
>- 标题写明白任务名称,一般格式:[Prefix] Short description of the pull request (Suffix)
>- prefix: 新增功能 [Feature], 修 bug [Fix], 文档相关 [Docs], 开发中 [WIP] (暂时不会被review)
>- 描述里介绍`拉取请求`的主要修改内容,结果,以及对其他部分的影响, 参考`拉取请求`模板
>- 关联相关的`议题` (issue) 和其他`拉取请求`
2 changes: 1 addition & 1 deletion mmcv/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Open-MMLab. All rights reserved.
# Copyright (c) OpenMMLab. All rights reserved.
# flake8: noqa
from .arraymisc import *
from .fileio import *
Expand Down
2 changes: 1 addition & 1 deletion mmcv/arraymisc/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Open-MMLab. All rights reserved.
# Copyright (c) OpenMMLab. All rights reserved.
from .quantization import dequantize, quantize

__all__ = ['quantize', 'dequantize']
2 changes: 1 addition & 1 deletion mmcv/arraymisc/quantization.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Open-MMLab. All rights reserved.
# Copyright (c) OpenMMLab. All rights reserved.
import numpy as np


Expand Down
2 changes: 1 addition & 1 deletion mmcv/cnn/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Open-MMLab. All rights reserved.
# Copyright (c) OpenMMLab. All rights reserved.
from .alexnet import AlexNet
# yapf: disable
from .bricks import (ACTIVATION_LAYERS, CONV_LAYERS, NORM_LAYERS,
Expand Down
2 changes: 1 addition & 1 deletion mmcv/cnn/alexnet.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Open-MMLab. All rights reserved.
# Copyright (c) OpenMMLab. All rights reserved.
import logging

import torch.nn as nn
Expand Down
1 change: 1 addition & 0 deletions mmcv/cnn/bricks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
from .activation import build_activation_layer
from .context_block import ContextBlock
from .conv import build_conv_layer
Expand Down
1 change: 1 addition & 0 deletions mmcv/cnn/bricks/activation.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
Expand Down
1 change: 1 addition & 0 deletions mmcv/cnn/bricks/context_block.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import torch
from torch import nn

Expand Down
1 change: 1 addition & 0 deletions mmcv/cnn/bricks/conv.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
from torch import nn

from .registry import CONV_LAYERS
Expand Down
1 change: 1 addition & 0 deletions mmcv/cnn/bricks/conv2d_adaptive_padding.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import math

from torch import nn
Expand Down
1 change: 1 addition & 0 deletions mmcv/cnn/bricks/conv_module.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import warnings

import torch.nn as nn
Expand Down
1 change: 1 addition & 0 deletions mmcv/cnn/bricks/conv_ws.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
Expand Down
1 change: 1 addition & 0 deletions mmcv/cnn/bricks/depthwise_separable_conv_module.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn

from .conv_module import ConvModule
Expand Down
1 change: 1 addition & 0 deletions mmcv/cnn/bricks/drop.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn

Expand Down
1 change: 1 addition & 0 deletions mmcv/cnn/bricks/generalized_attention.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import math

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions mmcv/cnn/bricks/hsigmoid.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn

from .registry import ACTIVATION_LAYERS
Expand Down
1 change: 1 addition & 0 deletions mmcv/cnn/bricks/hswish.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn

from .registry import ACTIVATION_LAYERS
Expand Down
1 change: 1 addition & 0 deletions mmcv/cnn/bricks/non_local.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
from abc import ABCMeta

import torch
Expand Down
1 change: 1 addition & 0 deletions mmcv/cnn/bricks/norm.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import inspect

import torch.nn as nn
Expand Down
1 change: 1 addition & 0 deletions mmcv/cnn/bricks/padding.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn

from .registry import PADDING_LAYERS
Expand Down
1 change: 1 addition & 0 deletions mmcv/cnn/bricks/registry.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
from mmcv.utils import Registry

CONV_LAYERS = Registry('conv layer')
Expand Down
1 change: 1 addition & 0 deletions mmcv/cnn/bricks/scale.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn

Expand Down
1 change: 1 addition & 0 deletions mmcv/cnn/bricks/swish.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn

Expand Down
1 change: 1 addition & 0 deletions mmcv/cnn/bricks/transformer.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import copy
import warnings

Expand Down
1 change: 1 addition & 0 deletions mmcv/cnn/bricks/upsample.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
import torch.nn.functional as F

Expand Down
1 change: 1 addition & 0 deletions mmcv/cnn/bricks/wrappers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
r"""Modified from https://github.com/facebookresearch/detectron2/blob/master/detectron2/layers/wrappers.py # noqa: E501
Wrap some nn modules to support empty tensor input. Currently, these wrappers
Expand Down
1 change: 1 addition & 0 deletions mmcv/cnn/builder.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
from ..runner import Sequential
from ..utils import Registry, build_from_cfg

Expand Down
2 changes: 1 addition & 1 deletion mmcv/cnn/resnet.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Open-MMLab. All rights reserved.
# Copyright (c) OpenMMLab. All rights reserved.
import logging

import torch.nn as nn
Expand Down
2 changes: 1 addition & 1 deletion mmcv/cnn/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Open-MMLab. All rights reserved.
# Copyright (c) OpenMMLab. All rights reserved.
from .flops_counter import get_model_complexity_info
from .fuse_conv_bn import fuse_conv_bn
from .weight_init import (INITIALIZERS, Caffe2XavierInit, ConstantInit,
Expand Down
1 change: 1 addition & 0 deletions mmcv/cnn/utils/fuse_conv_bn.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn

Expand Down
2 changes: 1 addition & 1 deletion mmcv/cnn/utils/weight_init.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Open-MMLab. All rights reserved.
# Copyright (c) OpenMMLab. All rights reserved.
import copy
import math
import warnings
Expand Down
2 changes: 1 addition & 1 deletion mmcv/cnn/vgg.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Open-MMLab. All rights reserved.
# Copyright (c) OpenMMLab. All rights reserved.
import logging

import torch.nn as nn
Expand Down
1 change: 1 addition & 0 deletions mmcv/engine/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
from .test import (collect_results_cpu, collect_results_gpu, multi_gpu_test,
single_gpu_test)

Expand Down
1 change: 1 addition & 0 deletions mmcv/engine/test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import pickle
import shutil
Expand Down
2 changes: 1 addition & 1 deletion mmcv/fileio/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Open-MMLab. All rights reserved.
# Copyright (c) OpenMMLab. All rights reserved.
from .file_client import BaseStorageBackend, FileClient
from .handlers import BaseFileHandler, JsonHandler, PickleHandler, YamlHandler
from .io import dump, load, register_handler
Expand Down
1 change: 1 addition & 0 deletions mmcv/fileio/file_client.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import inspect
from abc import ABCMeta, abstractmethod
from urllib.request import urlopen
Expand Down
2 changes: 1 addition & 1 deletion mmcv/fileio/handlers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Open-MMLab. All rights reserved.
# Copyright (c) OpenMMLab. All rights reserved.
from .base import BaseFileHandler
from .json_handler import JsonHandler
from .pickle_handler import PickleHandler
Expand Down
2 changes: 1 addition & 1 deletion mmcv/fileio/handlers/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Open-MMLab. All rights reserved.
# Copyright (c) OpenMMLab. All rights reserved.
from abc import ABCMeta, abstractmethod


Expand Down
Loading

0 comments on commit 09b9af5

Please sign in to comment.