Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
MMCV
Commits
f3a2be99
"tests/vscode:/vscode.git/clone" did not exist on "653428bdc7880ebc45b759e675df09ae6eb146f8"
Unverified
Commit
f3a2be99
authored
Sep 29, 2020
by
Kai Chen
Committed by
GitHub
Sep 29, 2020
Browse files
lint markdown files (#592)
parent
9141d91d
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
45 additions
and
33 deletions
+45
-33
.github/workflows/build.yml
.github/workflows/build.yml
+5
-9
.pre-commit-config.yaml
.pre-commit-config.yaml
+13
-8
CONTRIBUTING.md
CONTRIBUTING.md
+6
-3
README.md
README.md
+0
-1
docs/image.md
docs/image.md
+8
-0
docs/io.md
docs/io.md
+3
-0
docs/utils.md
docs/utils.md
+5
-6
docs/video.md
docs/video.md
+0
-1
mmcv/cnn/bricks/conv2d_adaptive_padding.py
mmcv/cnn/bricks/conv2d_adaptive_padding.py
+5
-5
No files found.
.github/workflows/build.yml
View file @
f3a2be99
...
...
@@ -14,16 +14,12 @@ jobs:
uses
:
actions/setup-python@v2
with
:
python-version
:
3.7
-
name
:
Install
linting dependencies
-
name
:
Install
pre-commit hook
run
:
|
python -m pip install --upgrade pip
pip install flake8 yapf isort==4.3.21
-
name
:
Lint with flake8
run
:
flake8 --max-complexity 20 .
-
name
:
Lint with isort
run
:
isort --recursive --check-only --diff mmcv/ tests/ examples/
-
name
:
Format python codes with yapf
run
:
yapf -r -d mmcv/ tests/ examples/
pip install pre-commit
pre-commit install
-
name
:
Linting
run
:
pre-commit run --all-files
-
name
:
Format c/cuda codes with clang-format
uses
:
DoozyX/clang-format-lint-action@v0.6
with
:
...
...
.pre-commit-config.yaml
View file @
f3a2be99
...
...
@@ -29,16 +29,21 @@ repos:
args
:
[
"
--remove"
]
-
id
:
mixed-line-ending
args
:
[
"
--fix=lf"
]
-
repo
:
https://github.com/jumanjihouse/pre-commit-hooks
rev
:
2.1.4
hooks
:
-
id
:
markdownlint
args
:
[
"
-r"
,
"
~MD002,~MD013,~MD029,~MD033,~MD034"
]
-
repo
:
https://github.com/myint/docformatter
rev
:
v1.3.1
hooks
:
-
id
:
docformatter
args
:
[
"
--in-place"
,
"
--wrap-descriptions"
,
"
79"
]
-
repo
:
local
hooks
:
-
id
:
clang-format
name
:
clang-format
description
:
Format files with ClangFormat
entry
:
clang-format -style=google -i
language
:
system
files
:
\.(c|cc|cxx|cpp|cu|h|hpp|hxx|cuh|proto)$
#
- repo: local
#
hooks:
#
- id: clang-format
#
name: clang-format
#
description: Format files with ClangFormat
#
entry: clang-format -style=google -i
#
language: system
#
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|cuh|proto)$
CONTRIBUTING.md
View file @
f3a2be99
...
...
@@ -17,9 +17,11 @@ Note: If you plan to add some new features that involve large changes, it is enc
## 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/
)
: linter
-
[
yapf
](
https://github.com/google/yapf
)
: formatter
-
[
isort
](
https://github.com/timothycrosley/isort
)
: sort imports
...
...
@@ -32,19 +34,20 @@ The config for a pre-commit hook is stored in [.pre-commit-config](./.pre-commit
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
```
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
)
.
README.md
View file @
f3a2be99
...
...
@@ -148,7 +148,6 @@ Note: If you would like to use `opencv-python-headless` instead of `opencv-pytho
e.g., in a minimum container environment or servers without GUI,
you can first install it before installing MMCV to skip the installation of
`opencv-python`
.
### TroubleShooting
If you meet issues when running or compiling mmcv, we list some common issues in
[
TROUBLESHOOTING.md
](
docs/trouble_shooting.md
)
.
docs/image.md
View file @
f3a2be99
...
...
@@ -3,6 +3,7 @@
This module provides some image processing methods, which requires
`opencv`
to be installed.
### Read/Write/Show
To read or write images files, use
`imread`
or
`imwrite`
.
```
python
...
...
@@ -34,7 +35,9 @@ for i in range(10):
```
### Color space conversion
Supported conversion methods:
-
bgr2gray
-
gray2bgr
-
bgr2rgb
...
...
@@ -50,6 +53,7 @@ img3 = mmcv.bgr2hsv(img)
```
### 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
is a tuple
`(resized_img, scale)`
.
...
...
@@ -70,6 +74,7 @@ mmcv.imrescale(img, (1000, 800))
```
### 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,
one is to keep the image size unchanged so that some parts of the image will be
...
...
@@ -96,6 +101,7 @@ img_ = mmcv.imrotate(img, 30, auto_bound=True)
```
### Flip
To flip an image, use
`imflip`
.
```
python
...
...
@@ -109,6 +115,7 @@ mmcv.imflip(img, direction='vertical')
```
### Crop
`imcrop`
can crop the image with one or some regions, represented as (x1, y1, x2, y2).
```
python
...
...
@@ -130,6 +137,7 @@ patches = mmcv.imcrop(img, bboxes, scale_ratio=1.2)
```
### Padding
There are two methods
`impad`
and
`impad_to_multiple`
to pad an image to the
specific size with given values.
...
...
docs/io.md
View file @
f3a2be99
...
...
@@ -3,6 +3,7 @@
This module provides two universal API to load and dump files of different formats.
### Load and dump data
`mmcv`
provides a universal api for loading and dumping data, currently
supported formats are json, yaml and pickle.
...
...
@@ -82,6 +83,7 @@ class PickleHandler(mmcv.BaseFileHandler):
### Load a text file as a list or dict
For example
`a.txt`
is a text file with 5 lines.
```
a
b
...
...
@@ -104,6 +106,7 @@ Then use `list_from_file` to load the list from a.txt.
```
For example
`b.txt`
is a text file with 5 lines.
```
1 cat
2 dog cow
...
...
docs/utils.md
View file @
f3a2be99
...
...
@@ -38,7 +38,7 @@ Currently, it supports four predefined variables:
`{{ fileExtname }}`
- the current opened file's extension, e.g. .ext
These variable names are referred from https://code.visualstudio.com/docs/editor/variables-reference.
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.
...
...
@@ -58,7 +58,6 @@ c = '{{ fileExtname }}'
...
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.
...
...
@@ -70,7 +69,7 @@ a = 1
b
=
dict
(
b1
=
[
0
,
1
,
2
],
b2
=
None
)
```
#### Inherit from base config without overlaped keys
.
#### Inherit from base config without overlaped keys
`config_b.py`
...
...
@@ -91,7 +90,7 @@ d = 'string'
New fields in
`config_b.py`
are combined with old fields in
`config_a.py`
#### Inherit from base config with overlaped keys
.
#### Inherit from base config with overlaped keys
`config_c.py`
...
...
@@ -111,7 +110,7 @@ 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
.
#### Inherit from base config with ignored fields
`config_d.py`
...
...
@@ -131,7 +130,7 @@ 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)
.
#### Inherit from multiple base configs (the base configs should not contain the same keys)
`config_e.py`
...
...
docs/video.md
View file @
f3a2be99
...
...
@@ -6,7 +6,6 @@ This module provides the following functionalities.
-
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.
...
...
mmcv/cnn/bricks/conv2d_adaptive_padding.py
View file @
f3a2be99
...
...
@@ -8,11 +8,11 @@ from .registry import CONV_LAYERS
@
CONV_LAYERS
.
register_module
()
class
Conv2dAdaptivePadding
(
nn
.
Conv2d
):
"""
Implementation of 2D convolution in tensorflow with `padding` as
"same",
which applies padding to input (if needed) so that input image
gets fully
covered by filter and stride you specified. For stride 1, this
will ensure
that output image size is same as input. For stride of 2,
output dimensions
will be half, for example.
"""Implementation of 2D convolution in tensorflow with `padding` as
"same",
which applies padding to input (if needed) so that input image
gets fully
covered by filter and stride you specified. For stride 1, this
will ensure
that output image size is same as input. For stride of 2,
output dimensions
will be half, for example.
Args:
in_channels (int): Number of channels in the input image
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment