* Fix the bug met in using nasfpn
Fix the bug met in using nasfpn which is mentioned at https://github.com/open-mmlab/mmdetection/issues/5987.
Avoid the strong restrictions of _resize function in BaseMergeCell:
1. When Downsampling the feature map, the feature map's shape must be divisible by the target size. We pad zero around feature map before max_pool2d opt to make it always divisible. (line 102 ~ 107)
2. Considering the different downsampling scale of H and W, shape[-2] and shape[-1] are involed in the definition of kernel_size. (line 110)
* Update merge_cells.py
check flake8 & isort
* Update merge_cells.py
* Update merge_cells.py
yapf
* Update mmcv/ops/merge_cells.py
X_pad rename to padding_x
Co-authored-by: Mashiro <57566630+HAOCHENYE@users.noreply.github.com>
* Update merge_cells.py
format the code style after renameing the X_pad to padding_x
* Update test_merge_cells.py
Mainly test the downsampling resize in BaseMergeCell. The smaller target size is set to (14, 7), the classical feature map's size in the last few stages of the backbone, which will product different downsampling scales in different dims.
* Update test_merge_cells.py
add "# Copyright (c) OpenMMLab. All rights reserved."
* Update merge_cells.py
format the variable name
* Update test_merge_cells.py
Testing divisible and indivisible situations simultaneously
* Update mmcv/ops/merge_cells.py
fix the bug when h is indivisible and w is divisible, the pad_w will be padded unreasonable.
Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
* Update mmcv/ops/merge_cells.py
fix the bug when w is indivisible and h is divisible, the pad_h will be padded unreasonable.
Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
* fix undefined error
* Update merge_cells.py
make pad_h, pad_w more readable
* Update test_merge_cells.py
use @pytest.mark.parametrize instead of 'for' methor
* Update merge_cells.py
* Update test_merge_cells.py
isort
* Update merge_cells.py
isort
Co-authored-by: Mashiro <57566630+HAOCHENYE@users.noreply.github.com>
Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
* Add type hints
* Add type hints
* Fix int float about scalar
* Add type hints for mmcv/tensorrt
* Update mmcv/tensorrt/tensorrt_utils.py
Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
* Update mmcv/arraymisc/quantization.py
Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
* Ignore type hint for dtype
Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
* config dump fix
dump should not depend on how config was loaded only where it is dumped
changed checks for type to the given filename instead of the source filename
* defined test_fromdict and fixed dump function
it might be more convoluted than it needs to be but the formatting depends on the extension of the argument or the extension of the self.filename
* config dump defaults to returning pretty_text, test_fromdict renamed to test_dump_from_dict
* some reformatting in docstrings
* refine unittest
* fix unit test as comment
* Refine docstring
* minor refinement
* import mmcv
* fix lint
Co-authored-by: HAOCHENYE <21724054@zju.edu.cn>
Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
* [fix]:fix type hint in file_client and mmcv
* [fix]:fix type hint in tests files
* [fix]:fix type hint in tests files
* [fix]:fix pre-commit.yaml to igore test for mypy
* [fix]:fix pre-commit.yaml to igore test for mypy
* [fix]:fix precommit.yml
* [fix]:fix precommit.yml
* Update __init__.py
delete unused type-ignore comment
* fix bug of can't pickle env objs
* use utf-8 to support Chinese
* use __del__ instead close
* move try import to init
* remove getitem
* use client instead
* add rotated_feature_align cpu implementation
* add rotated_feature_align onnxruntime implementation
* Update code for advices from grimoire
Remove useless comment from mmcv/ops/csrc/pytorch/cpu/rotated_feature_align.cpp
Replace ambiguous function name atomicAdd in mmcv/ops/csrc/pytorch/cpu/rotated_feature_align.cpp
Simplify unit test with parameter in tests/test_ops/test_rotated_feature_align.py
Use fma in interpolate in mmcv/ops/csrc/onnxruntime/cpu/rotated_feature_align.cpp mmcv/ops/csrc/pytorch/cpu/rotated_feature_align.cpp
* Inline the function to reduce the overhead of the function call
Use fma in interpolate
* enhance get_torchvision_models
* simplify logic
* Dump ckpt in torchvision lower than 0.13.0 to a json file
* add json
* refactor load urls logic
* fix unit test
* change url key to lower letters
* check torchvision version rather than check torch version in unittest
* Fix CI and refine test logic of torchvision version
* add comment
* support compare pre-release version
* support loaad modeel like torchvision
* refine comment.
* fix unit test and comment
* fxi unit test bug
* support get model by lower weights
* Fixed version comparison to include prerelease versions
Currently all tagged versions of torch 1.11.0 have version 1.11.0a0. Previously the comparison to 1.11.0 failed and self._sync_params() was still used, causing an error. This fix should include all versions of 1.11.
* Same update
Didn't realize that 1.11.0 was mentioned multiple times in the file. This fixes the other instances.
To have the same shape of MLU copy and Scatter.forward, a 1-dim list has to be added.
Origin MMDP / MMDDP with this scatter_gather returns a list of tensor for each targets, and here MLU copy returns the same shape Tensor in a list of just one default target.
* Make sure padding size is not negative
If Resize maintains aspect ratio, could be the case that image shape is bigger than resize value.
* Test pad shape smaller than image shape
* Fix lint
* Remove whitespaces
* Speed up Registry initialization
This PR addresses https://github.com/open-mmlab/mmcv/issues/1843.
Instead of calling inspect.stack() to read the entire stack and its
associated source files from disk, walk up the stack to get only the
specific frame that we need (see [1] for additional information).
This makes imports in downstream projects ~2.5x faster in my local dev
environment. For mmaction2, for example:
Before:
$ python -m timeit -n1 -r1 "from mmaction.apis import init_recognizer, inference_recognizer"
1 loop, best of 1: 1.94 sec per loop
After:
$ python -m timeit -n1 -r1 "from mmaction.apis import init_recognizer, inference_recognizer"
1 loop, best of 1: 754 msec per loop
[1] https://stackoverflow.com/a/42636264/895769
* Add comment with PR tag
Explain why we avoid `inspect.stack()` with link to PR