Commit Graph

59 Commits (55c51e173452f3c7d84c980a4c9534e2193517a8)

Author SHA1 Message Date
takuoko 55c51e1734
[Feature] Register a new activatation layer SiLU to ACTIVATION_LAYERS (#2256) 2022-09-13 22:38:23 +08:00
Mashiro 14c3e175fa
[Fix] num_channels can not be divisible by num_groups in test_build_norm_layer (#2085) 2022-06-30 19:28:34 +08:00
Zaida Zhou 45fa3e44a2
Add pyupgrade pre-commit hook (#1937)
* add pyupgrade

* add options for pyupgrade

* minor refinement
2022-05-18 11:47:14 +08:00
pc e70a318ae9
[Fix] Fix parrots unit tests (#1913) 2022-05-09 16:59:32 +08:00
Zaida Zhou 6e9ce18323
Add copyright pre-commit-hook (#1742)
* first commit

* Add copyright pre-commit-hook
2022-02-24 09:24:25 +08:00
Wenhao Wu c1de4c9bbf
[Feature] Add spconv ops from mmdet3d (#1581)
* add ops (spconv) of mmdet3d

* fix typo

* refactor code

* resolve comments in #1452

* fix compile error

* fix bugs

* fix bug

* transform from 'types.h' to 'extension.h'

* fix bug

* transform from 'types.h' to 'extension.h' in parrots

* add extension.h in pybind.cpp

* add unittest

* Recover code

* (1) Remove prettyprint.h
(2) Switch `T` to `scalar_t`
(3) Remove useless lines
(4) Refine example in docstring of sparse_modules.py

* (1) rename from `cu.h` to `cuh`
(2) remove useless files
(3) move cpu files to `pytorch/cpu`

* reorganize files

* Add docstring for sparse_functional.py

* use dispatcher

* remove template

* use dispatch in cuda ops

* resolve Segmentation fault

* remove useless files

* fix lint

* fix lint

* fix lint

* fix unittest in test_build_layers.py

* add tensorview into include_dirs when compiling

* recover all deleted files

* fix lint and comments

* recover setup.py

* replace tv::GPU as tv::TorchGPU & support device guard

* fix lint

Co-authored-by: hdc <hudingchang.vendor@sensetime.com>
Co-authored-by: grimoire <yaoqian@sensetime.com>
2022-02-18 15:53:10 +08:00
RangiLyu 62c1b7f68b
[Enhance] Use PyTorch HSwish implementation. (#1709)
* [Enhance] Use PyTorch HSwish implementation.

* fix conv test

* upgrade version

* add version comments
2022-02-12 14:34:35 +08:00
Mashiro 26aba2f533
[Fix] Fix an incorrect assignment in the BaseTransformerLayer (#1670)
* fix BaseTransformerLayer

* Add BaseTransformerLayer unit test without ffn_cfg embed_dims

* Optimize code logic
2022-01-28 23:43:53 +08:00
Jiazhen Wang b8d78336a7
[Fix] Align HSigmoid with pytorch official implementation(#1622)
* [Fix] align hsigmoid with pytorch official

* [Fix] add warnings for Hsigmoid

* [Fix] fix format

* [Fix] add unittest

* [Fix] fix docstring
2022-01-20 14:25:10 +08:00
Jiazhen Wang fb486b96fd
[Fix] Fix some warnings in unittest (#1522)
* [Fix] fix some warnings in unittest

* [Impl] standardize some warnings

* [Fix] fix warning type in test_deprecation

* [Fix] fix warning type

* [Fix] continue fixing

* [Fix] fix some details

* [Fix] fix docstring

* [Fix] del useless statement

* [Fix] keep compatibility for torch < 1.5.0
2021-12-22 10:57:10 +08:00
Shilong Zhang 001f3f6610
[Feature]Add patch embed and patch merge (#1305) 2021-12-14 21:52:37 +08:00
Tong Gao c522b47e6a
fix the wrong function reference bug in BaseTransformerLayer when batch_first is True (#1418) 2021-11-02 20:57:50 +08:00
Tong Gao 642d281823
[Feature] Add revert_sync_batchnorm (#1253)
* [Feature] Add revert_sync_batchnorm

* support mmsyncbn (to be tested)

* Test passed

* Update docstring, rename the test file

* remove test_sync_bn

* add comment

* add mmcv.ops check

* Add a comment

* Add notes and relax test req

Co-authored-by: gaotongxiao <gaotongxiao@gmail.con>
2021-09-08 10:59:39 +08:00
young 99088c81a8
[Fix] Restrict the warning message (#1267)
* restrict the warning message

* and an important keyword in warning description

* a more elegant way of condition

* link format code too long

* fix the stupid spelling mistake

* Use issubclass to restrict warning message.

* maybe this version is more elegant.

* conv + bias + norm warning pytest

* 'created' a warning, hahaha

* isort and yapf format revision

* isort and yapf format revision

* flake8 fail issue

* I have to right this way in order to solve the conflicts between yapf and flake8, sigh...

* fixed test bug

* Add ruby windows installer source.

* Simplified the code and remove ruby source from CONTRIBUTING.md

* use _BatchNorm to simplify the code

* bug fix and add instanceNorm case into warning

* change the warning message to make it more clear

* fix unit test
2021-09-07 19:45:14 +08:00
Jerry Jiarui XU c47c9196d0
[Docs] Add header for files (#1181)
* [Docs] Add header for files

* change to OpenMMLab

* add headers for .cpp, .cu, .h, .cuh

* replace Open-MMLab with OpenMMLab
2021-08-08 22:10:55 +08:00
Jintao Lin 9c26a1049e
empty tensor inference backward compatible (#1131)
* empty tensor inference backward continity

* update

* add 3d
2021-06-24 17:04:03 +08:00
Shilong Zhang e05fb56031
Refactor the baseclass related to transformer (#978)
* minor changes

* change to modulist

* change to Sequential

* replace dropout with attn_drop and proj_drop in MultiheadAttention

* add operation_name for attn

* add drop path and move all ffn args to ffncfgs

* fix typo

* fix a bug when use default value of ffn_cfgs

* fix ffns

* add deprecate warning

* fix deprecate warning

* change to pop kwargs

* support register FFN of transformer

* support batch first

* fix batch first wapper

* fix forward wapper

* fix typo

* fix lint

* add unitest for transformer

* fix unitest

* fix equal

* use allclose

* fix comments

* fix comments

* change configdict to dict

* move drop to a file

* add comments for drop path

* add noqa 501

* move bnc wapper to MultiheadAttention

* move bnc wapper to MultiheadAttention

* use dep warning

* resolve comments

* add unitest:

* rename residual to identity

* revert runner

* msda residual to identity

* rename inp_identity to identity

* fix name

* fix transformer

* remove key in msda

* remove assert for key

Co-authored-by: HIT-cwh <2892770585@qq.com>
Co-authored-by: bkhuang <congee524@gmail.com>
Co-authored-by: Wenwei Zhang <40779233+ZwwWayne@users.noreply.github.com>
2021-06-11 18:09:31 +08:00
Miao Zheng 50c255bc2d
[Feature] Support to use name of the base classes in init_cfg (#1057)
* [Fix] Support names of base classes matching in init_cfg

* revise bool to len
2021-06-01 22:35:19 +08:00
Zaida Zhou 55b4847a41
[Feature] Add truncated normal weight init (#935)
* [Feature] Add truncated normal weight init

* [Feature] Add truncated normal weight init

* [Feature] Add truncated normal weight init

* update docstring

* delete modelA.pth

* modify according to comment

* use kstest to check truncated normal

* delete modelA.pth

* fix test.txt
2021-05-23 20:54:54 +08:00
Guangchen Lin 5be9593499
[Fix] fix generalized attention fp16 (#1036)
* fix generalized attention fp16

* fix building without gpu error

* add comment

* Cast tensor at initialization
2021-05-23 15:16:27 +08:00
Miao Zheng 2fadb1a5ec
[Fix] Revise override in init_cfg (#930)
* [Fix] Config deep copy in initialize_override

* add asserts&comments

* add test

* test org init_cfg

* test override without name

* typo
2021-04-12 14:05:28 +08:00
Jerry Jiarui XU 375605fba8
add model registry (#760)
* add model registry

* fixed infer scoep

* fixed build func

* add docstring

* add md

* support multi level

* clean comments

* add docs

* fixed parent

* add more doc

* add value error, add docstring

* fixed docs

* change to local/global search

* resolve comments

* fixed test

* update some docstring

* update docs (minior)

* update docs

* update docs
2021-04-10 21:33:34 +08:00
Miao Zheng 65fec73509
[Refactoring] Revise function of layers and override keys in init_cfg (#893)
* [Refactoring]Approve init_cfg

* revise unit test

* revise according to comments

* add comment for wholemodule
2021-03-26 16:57:59 +08:00
Miao Zheng 5f5e8e83c2
[Refactoring] Add Caffe2Xavier Initializer (#902)
* [Refactoring] Add Caffe2Xavier Initializer

* fix lint
2021-03-24 13:25:36 +08:00
ZhangShilong 371a21728f
fix bug of convmodule (#889)
* fix bug of convmodule

* fix bug of convmodule

* fix unitest

* remove assert
2021-03-20 23:08:20 +08:00
zhouzaida 97730c2316
[Feature] support to calculate FLOPs of GN, IN, LN (#897)
* [Feature] support to calculate FLOPs of GN, IN, LN

* Update flops_counter.py

* Update flops_counter.py
2021-03-19 14:04:49 +08:00
Miao Zheng a4c3702628
add initializers and BaseModule for unified parameter initialization (#780)
* add initializers and BaseModule for unified parameter initialization

* fix circle import

* bug fix

* add is_init flag in BaseModule

* fix docstring

* sort import and fix doc format

* fix bug

* fix docformat and double quote string

* fix import sort

* import sort

* sort import

* revise according to comments

* fix doc format

* revise according to comments

* revise import and fix typo

* polish code

* revise minors

* revice minors

* revise apply function

* revise bias initialization with probability

* add type test for bias_prob

* revise minors
2021-02-07 11:13:57 +08:00
BigBigDream 655f3c3fe9
fix mmcv_ci test_wrappers.py for parrots (#758) 2020-12-24 19:50:46 +08:00
Rui Xu 826d3a7b68
[Bug] Avoid recursion error when using customized norm layer without _abbr_ (#732)
* avoid recursion error when using customized norm layer without _abbr_

* fix unittest bug
2020-12-22 10:19:52 +08:00
Rui Xu cd96a84add
[Feature] Add clamp activation layer. (#685)
* add clamp without unittest

* add clamp-act with unit test

* fix name bug

* use logical and

* fix logical_and

* fix linting

* rename ClampLayer to Clamp

* rename ClampLayer to Clamp

Co-authored-by: nbei <631557085@qq.com>
2020-12-09 10:28:32 +08:00
Wenwei Zhang dfa36dfe3b
Merge pull request #652 from dreamerlin/3d
[Feature] Add 3D support in wrapper
2020-11-20 16:33:54 +08:00
yamengxi ec43b671ab
[Enhance]enhance hsigmoid (#657)
* enhance hsigmoid

* delete int
2020-11-19 21:26:26 +08:00
dreamerlin e70dca8f86 add conv3d 2020-11-18 21:24:20 +08:00
dreamerlin 144e7567a7 use pytest.mark.parametrize 2020-11-18 15:35:21 +08:00
dreamerlin 86d9f4684a add MaxPool3d 2020-11-15 19:07:46 +08:00
dreamerlin 8ccea20234 add ConvTranspose3d 2020-11-15 18:56:02 +08:00
Kai Chen 03214fd446
Support pytorch 1.7 and update the CI (#631)
* support pytorch 1.7 and update the CI

* fix CI

* fix onnxruntime version in macos
2020-10-31 17:58:15 +08:00
Wenwei Zhang 005c408748
Fix wrappers version comparison (#602)
* add version check in wrappers

* fix assersion

* use digital version for version comparison

* fix unit tests

* reformat

* fall back to compare the first two version

* fix unittest

* fix unittest

* fix unit test

* clean unnecessary change
2020-10-06 12:44:56 +08:00
GT9505 acee61d7c5
register deconv in CONV_LAYERS (#582)
* register deconv in CONV_LAYERS

* use ConvTranspose2d implemented in MMCV

* remove repetitive register_module

* update

* add unittest for deconv
2020-09-27 17:51:00 +08:00
Wenwei Zhang c937d3953d
Mv wrappers into bricks and use wrappers in registry (#550)
* Mv wrappers into bricks and use wrappers in registry

* resolve import issues

* fix import issues

* set nn op forward to torch 1.6.1

* fix CI bug and add warning

* Fix CI by using patch mock

* mv warnings inside deprecated module's initialization
2020-09-12 21:59:17 +08:00
Xiaojie Li 49e32c2688
Implementation of 2D convolution in tensorflow with `padding` as "same" (#529)
* update impad

* fix docstring

* add shape for impad

* fix unit test

* remove old version & fix doc

* fix linting

* fix doc

* add linear decay learning rate scheduler

* fix impad

* fix setup.cfg

* fix linting

* add yapf

* add swish

* fix lr_updater

* fix lr_updater.py

* update swish

* add swish

* fix inplace

* fix typo

* update

* add same padding

* fix docstring

* add unittest

* fix register

* change name

Co-authored-by: lixiaojie <lixiaojie@sensetime.com>
2020-09-09 23:57:48 +08:00
Xiaojie Li c3d8eb34ff
add Swish activation (#522)
* update impad

* fix docstring

* add shape for impad

* fix unit test

* remove old version & fix doc

* fix linting

* fix doc

* add linear decay learning rate scheduler

* fix impad

* fix setup.cfg

* fix linting

* add yapf

* add swish

* fix lr_updater

* fix lr_updater.py

* update swish

* add swish

* fix inplace

* fix typo

Co-authored-by: lixiaojie <lixiaojie@sensetime.com>
2020-08-27 00:39:17 +08:00
Jerry Jiarui XU 56e71a718b
Add Depthwise Seperable ConvModule (#477) 2020-08-09 17:29:02 +08:00
Jintao Lin 6ece0e5d19
Add pairwise function for 'gaussian' and 'concatenation' mode in NonLocal. (#424)
* add pairwise function for 'gaussian' and 'concatenation' mode

* rename test function

* decrease the complexity of nonlocal unittest

* fix typo and make unittest more complete

* add unittest when zero_init is False

* minor fix

* pack theta and phi

Co-authored-by: Jiarui XU <xvjiarui0826@gmail.com>
2020-07-17 23:44:50 +08:00
Jerry Jiarui XU 7cfc839ea5
Add MMSyncBN in registry (#420)
* Add MMSyncBN in registery

* skip mmsyncbn test
2020-07-15 19:23:09 +08:00
Cao Yuhang 926ac07bb8
Move fuse conv bn to mmcv (#382)
* move fuse conv bn to mmcv

* update doc

* update test conv bn

* rename

* fix doc and variable name

* change func name
2020-07-08 19:03:15 +08:00
Jerry Jiarui XU 42f03d84de
Refactor plugins: move from ops to cnn (#380)
* Refator plugins: move from ops to cnn

* minior update

* minior update
2020-07-03 01:37:58 +08:00
louzana 2c6fc5fd9b
fix bug of building ConvModule with HSigmoid using inplace=True and a… (#369)
* fix bug of building ConvModule with HSigmoid using inplace=True and add corresponding unittest

* fix linting
2020-06-28 23:27:14 +08:00
zhuyuanhao c0f5492ee9
add ext ops, support parrots (#310)
* add ext ops, support parrots

* fix lint

* fix lint

* update op from mmdetection

* support non-pytorch env

* fix import bug

* test not import mmcv.op

* rename mmcv.op to mmcv.ops

* fix compile warning

* 1. fix syncbn warning in pytorch 1.5
2. support only cpu compile
3. add point_sample from mmdet

* fix text bug

* update docstrings

* fix line endings

* minor updates

* remove non_local from ops

* bug fix for nonlocal2d

* rename ops_ext to _ext and _ext to _flow_warp_ext

* update the doc

* try clang-format github action

* fix github action

* add ops to api.rst

* fix cpp format

* fix clang format issues

* remove .clang-format

Co-authored-by: Kai Chen <chenkaidev@gmail.com>
2020-06-28 23:15:47 +08:00
Jintao Lin 9bc0b96d02
Add utils to calculate model complexity and adjust folder structure for mmcv/cnn/utils . (#366)
* Add utils to calculate model complexity info

* remove _InstanceNorm in unittest

* add docstring and increase unittest coverage

* fix deconv_flops_counter_hook to accept different data shape

* test when model is not a common instance

* put flops_counter.py and weight_init.py into mmcv/cnn/utils folder

* fix import name

* reformat some docstrings

* update the scripts with latest one and remove redundant codes

* directly represent a model without string and eval()

* reformat code
2020-06-26 21:38:29 +08:00