Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI for windows #7228

Merged
merged 29 commits into from
Feb 24, 2022
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
a643031
[Fix] Fix wrong img name in onnx2tensorrt.py (#7157)
jamiechoi1995 Feb 16, 2022
7a9bc49
[Docs] fix albumentations installed way (#7143)
BIGWangYuDong Feb 16, 2022
6d5be11
Add mmrotate (#7216)
zytx121 Feb 22, 2022
37a1150
fix description for args in CSPDarknet (#7187)
HJoonKwon Feb 22, 2022
2b2c2b8
Update build.yml
zytx121 Feb 23, 2022
5c342a2
Update build.yml
zytx121 Feb 23, 2022
cb608b5
Update build.yml
zytx121 Feb 23, 2022
2dd7623
Update build.yml
zytx121 Feb 23, 2022
8304876
Update build.yml
zytx121 Feb 23, 2022
eaa1c4d
Update build.yml
zytx121 Feb 23, 2022
81e92f7
Update build.yml
zytx121 Feb 23, 2022
8672bc3
Update build.yml
zytx121 Feb 23, 2022
d3d931d
Update build.yml
zytx121 Feb 23, 2022
d21c49c
Update build.yml
zytx121 Feb 23, 2022
11c4fa0
Update build.yml
zytx121 Feb 23, 2022
eb5012b
Update build.yml
zytx121 Feb 23, 2022
296119a
fix test_find_latest_checkpoint
zytx121 Feb 23, 2022
c1ba3aa
fix data_infos__default_db_directories
zytx121 Feb 23, 2022
c835880
fix test_custom_classes_override_default
zytx121 Feb 23, 2022
b88f393
Update test_custom_dataset.py
zytx121 Feb 23, 2022
23d326f
Update test_common.py
zytx121 Feb 23, 2022
bac3d70
Update assign_result.py
zytx121 Feb 23, 2022
f2fc109
use os.path.join
zytx121 Feb 23, 2022
f999ac2
fix bug
zytx121 Feb 23, 2022
5a930d2
Update test_common.py
zytx121 Feb 23, 2022
fe59c24
Update assign_result.py
zytx121 Feb 23, 2022
02f3edb
Update sampling_result.py
zytx121 Feb 23, 2022
ff9f221
os.path -> osp
zytx121 Feb 23, 2022
511b795
os.path -> osp
zytx121 Feb 23, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,50 @@ jobs:
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false

build_windows:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2022]
python: [3.8]
platform: [cpu, cu111]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Upgrade pip
run: pip install pip --upgrade --user
- name: Install PyTorch
# As a complement to Linux CI, we test on PyTorch LTS version
run: pip install torch==1.8.2+${{ matrix.platform }} torchvision==0.9.2+${{ matrix.platform }} -f https://download.pytorch.org/whl/lts/1.8/torch_lts.html
- name: Install MMCV
run: pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.8/index.html --only-binary mmcv-full
- name: Install unittest dependencies
run: |
python -V
python -m pip install pycocotools
python -m pip install -r requirements/tests.txt -r requirements/optional.txt
python -m pip install albumentations>=0.3.2 --no-binary imgaug,albumentations
python -m pip install git+https://github.com/cocodataset/panopticapi.git
python -c 'import mmcv; print(mmcv.__version__)'
- name: Show pip list
run: pip list
- name: Build and install
run: pip install -e .
- name: Run unittests
run: coverage run --branch --source mmdet -m pytest tests -sv
- name: Generate coverage report
run: |
coverage xml
coverage report -m
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
file: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -320,3 +320,4 @@ If you use this toolbox or benchmark in your research, please cite this project.
- [MMHuman3D](https://github.com/open-mmlab/mmhuman3d): OpenMMLab 3D human parametric model toolbox and benchmark.
- [MMSelfSup](https://github.com/open-mmlab/mmselfsup): OpenMMLab self-supervised learning toolbox and benchmark.
- [MMRazor](https://github.com/open-mmlab/mmrazor): OpenMMLab Model Compression Toolbox and Benchmark.
- [MMRotate](https://github.com/open-mmlab/mmrotate): OpenMMLab rotated object detection toolbox and benchmark.
1 change: 1 addition & 0 deletions README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ MMDetection 是一款由来自不同高校和企业的研发人员共同参与
- [MMHuman3D](https://github.com/open-mmlab/mmhuman3d): OpenMMLab 人体参数化模型工具箱与测试基准
- [MMSelfSup](https://github.com/open-mmlab/mmselfsup): OpenMMLab 自监督学习工具箱与测试基准
- [MMRazor](https://github.com/open-mmlab/mmrazor): OpenMMLab 模型压缩工具箱与测试基准
- [MMRotate](https://github.com/open-mmlab/mmrotate): OpenMMLab 旋转框检测工具箱与测试基准

## 欢迎加入 OpenMMLab 社区

Expand Down
11 changes: 7 additions & 4 deletions docs/en/get_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Or you can still install MMDetection manually:
# for LVIS dataset
pip install git+https://github.com/lvis-dataset/lvis-api.git
# for albumentations
pip install albumentations>=0.3.2 --no-binary imgaug,albumentations
pip install -r requirements/albu.txt
```

**Note:**
Expand All @@ -148,9 +148,12 @@ you can install it before installing MMCV.
c. Some dependencies are optional. Simply running `pip install -v -e .` will
only install the minimum runtime requirements. To use optional dependencies like `albumentations` and `imagecorruptions` either install them manually with `pip install -r requirements/optional.txt` or specify desired extras when calling `pip` (e.g. `pip install -v -e .[optional]`). Valid keys for the extras field are: `all`, `tests`, `build`, and `optional`.

d. If you would like to use `albumentations`, we suggest using
`pip install albumentations>=0.3.2 --no-binary imgaug,albumentations`. If you simply use
`pip install albumentations>=0.3.2`, it will install `opencv-python-headless` simultaneously (even though you have already installed `opencv-python`). We should not allow `opencv-python` and `opencv-python-headless` installed at the same time, because it might cause unexpected issues. Please refer to [official documentation](https://albumentations.ai/docs/getting_started/installation/#note-on-opencv-dependencies) for more details.
d. If you would like to use `albumentations`, we suggest using `pip install -r requirements/albu.txt` or
`pip install -U albumentations --no-binary qudida,albumentations`. If you simply use `pip install albumentations>=0.3.2`,
it will install `opencv-python-headless` simultaneously (even though you have already
installed `opencv-python`). We recommended checking the environment after installing `albumentation` to
ensure that `opencv-python` and `opencv-python-headless` are not installed at the same time, because it might cause unexpected issues if they both installed. Please refer
to [official documentation](https://albumentations.ai/docs/getting_started/installation/#note-on-opencv-dependencies) for more details.

### Install without GPU support

Expand Down
4 changes: 2 additions & 2 deletions docs/zh_cn/get_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ MIM 能够自动地安装 OpenMMLab 的项目以及对应的依赖包。
# 安装 LVIS 数据集依赖
pip install git+https://github.com/lvis-dataset/lvis-api.git
# 安装 albumentations 依赖
pip install albumentations>=0.3.2 --no-binary imgaug,albumentations
pip install -r requirements/albu.txt
```

**注意:**
Expand All @@ -153,7 +153,7 @@ MIM 能够自动地安装 OpenMMLab 的项目以及对应的依赖包。

(3) 一些安装依赖是可以选择的。例如只需要安装最低运行要求的版本,则可以使用 `pip install -v -e .` 命令。如果希望使用可选择的像 `albumentations` 和 `imagecorruptions` 这种依赖项,可以使用 `pip install -r requirements/optional.txt` 进行手动安装,或者在使用 `pip` 时指定所需的附加功能(例如 `pip install -v -e .[optional]`),支持附加功能的有效键值包括 `all`、`tests`、`build` 以及 `optional` 。

(4) 如果希望使用 `albumentations`,我们建议使用 `pip install albumentations>=0.3.2 --no-binary imgaug,albumentations` 进行安装。 如果简单地使用 `pip install albumentations>=0.3.2` 进行安装,则会同时安装 `opencv-python-headless`(即便已经安装了 `opencv-python` 也会再次安装)。我们不允许同时安装 `opencv-python` 和 `opencv-python-headless`,因为这样可能会导致一些问题。更多细节请参考[官方文档](https://albumentations.ai/docs/getting_started/installation/#note-on-opencv-dependencies)。
(4) 如果希望使用 `albumentations`,我们建议使用 `pip install -r requirements/albu.txt` 或者 `pip install -U albumentations --no-binary qudida,albumentations` 进行安装。 如果简单地使用 `pip install albumentations>=0.3.2` 进行安装,则会同时安装 `opencv-python-headless`(即便已经安装了 `opencv-python` 也会再次安装)。我们建议在安装 `albumentations` 后检查环境,以确保没有同时安装 `opencv-python` 和 `opencv-python-headless`,因为同时安装可能会导致一些问题。更多细节请参考[官方文档](https://albumentations.ai/docs/getting_started/installation/#note-on-opencv-dependencies)。

### 只在 CPU 安装

Expand Down
2 changes: 1 addition & 1 deletion mmdet/core/bbox/assigners/assign_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def random(cls, **kwargs):
true_idxs = np.arange(num_gts)
rng.shuffle(true_idxs)
true_idxs = torch.from_numpy(true_idxs)
gt_inds[is_assigned] = true_idxs[:n_assigned]
gt_inds[is_assigned] = true_idxs[:n_assigned].long()

gt_inds = torch.from_numpy(
rng.randint(1, num_gts + 1, size=num_preds))
Expand Down
2 changes: 1 addition & 1 deletion mmdet/core/bbox/samplers/sampling_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(self, pos_inds, neg_inds, bboxes, gt_bboxes, assign_result,
if len(gt_bboxes.shape) < 2:
gt_bboxes = gt_bboxes.view(-1, 4)

self.pos_gt_bboxes = gt_bboxes[self.pos_assigned_gt_inds, :]
self.pos_gt_bboxes = gt_bboxes[self.pos_assigned_gt_inds.long(), :]

if assign_result.labels is not None:
self.pos_gt_labels = assign_result.labels[pos_inds]
Expand Down
4 changes: 2 additions & 2 deletions mmdet/models/backbones/csp_darknet.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ class CSPDarknet(BaseModule):
arch (str): Architecture of CSP-Darknet, from {P5, P6}.
Default: P5.
deepen_factor (float): Depth multiplier, multiply number of
channels in each layer by this amount. Default: 1.0.
widen_factor (float): Width multiplier, multiply number of
blocks in CSP layer by this amount. Default: 1.0.
widen_factor (float): Width multiplier, multiply number of
channels in each layer by this amount. Default: 1.0.
out_indices (Sequence[int]): Output from which stages.
Default: (2, 3, 4).
frozen_stages (int): Stages to be frozen (stop grad and set eval
Expand Down
1 change: 1 addition & 0 deletions requirements/albu.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
albumentations>=0.3.2 --no-binary qudida,albumentations
11 changes: 9 additions & 2 deletions tests/test_data/test_datasets/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import logging
import os
import os.path as osp
import platform
import shutil
import tempfile
from unittest.mock import MagicMock, patch

Expand Down Expand Up @@ -107,8 +109,11 @@ def _create_dummy_results():
def test_dataset_init(config_path):
use_symlink = False
if not os.path.exists('./data'):
os.symlink('./tests/data', './data')
use_symlink = True
if platform.system() != 'Windows':
os.symlink('./tests/data', './data')
use_symlink = True
else:
shutil.copytree('./tests/data', './data')
data_config = mmcv.Config.fromfile(config_path)
if 'data' not in data_config:
return
Expand All @@ -119,6 +124,8 @@ def test_dataset_init(config_path):
dataset[0]
if use_symlink:
os.unlink('./data')
else:
shutil.rmtree('./data')


def test_dataset_evaluation():
Expand Down
14 changes: 7 additions & 7 deletions tests/test_data/test_datasets/test_custom_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,16 @@ def test_custom_classes_override_default(dataset):

# Test sending file path
import tempfile
tmp_file = tempfile.NamedTemporaryFile()
with open(tmp_file.name, 'w') as f:
f.write('bus\ncar\n')
with tempfile.TemporaryDirectory() as tmpdir:
path = tmpdir + 'classes.txt'
with open(path, 'w') as f:
f.write('bus\ncar\n')
custom_dataset = dataset_class(
ann_file=MagicMock(),
pipeline=[],
classes=tmp_file.name,
classes=path,
test_mode=True,
img_prefix='VOC2007' if dataset == 'VOCDataset' else '')
tmp_file.close()

assert custom_dataset.CLASSES != original_classes
assert custom_dataset.CLASSES == ['bus', 'car']
Expand Down Expand Up @@ -113,7 +113,7 @@ def test_data_infos__default_db_directories(self):

self.assertListEqual([{
'id': '000001',
'filename': 'JPEGImages/000001.jpg',
'filename': f'JPEGImages{os.sep}000001.jpg',
'width': 353,
'height': 500
}], custom_ds.data_infos)
Expand All @@ -133,7 +133,7 @@ def test_data_infos__overridden_db_subdirectories(self):

self.assertListEqual([{
'id': '000001',
'filename': 'images/000001.jpg',
'filename': f'images{os.sep}000001.jpg',
'width': 353,
'height': 500
}], custom_ds.data_infos)
19 changes: 10 additions & 9 deletions tests/test_utils/test_misc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright (c) OpenMMLab. All rights reserved.
import os
import tempfile

import numpy as np
Expand Down Expand Up @@ -172,32 +173,32 @@ def test_find_latest_checkpoint():
# There are no checkpoints in the path.
assert latest is None

path = tmpdir + '/none'
path = os.path.join(tmpdir, 'none')
ZwwWayne marked this conversation as resolved.
Show resolved Hide resolved
latest = find_latest_checkpoint(path)
# The path does not exist.
assert latest is None

with tempfile.TemporaryDirectory() as tmpdir:
with open(tmpdir + '/latest.pth', 'w') as f:
with open(os.path.join(tmpdir, 'latest.pth'), 'w') as f:
f.write('latest')
path = tmpdir
latest = find_latest_checkpoint(path)
assert latest == tmpdir + '/latest.pth'
assert latest == os.path.join(tmpdir, 'latest.pth')

with tempfile.TemporaryDirectory() as tmpdir:
with open(tmpdir + '/iter_4000.pth', 'w') as f:
with open(os.path.join(tmpdir, 'iter_4000.pth'), 'w') as f:
f.write('iter_4000')
with open(tmpdir + '/iter_8000.pth', 'w') as f:
with open(os.path.join(tmpdir, 'iter_8000.pth'), 'w') as f:
f.write('iter_8000')
path = tmpdir
latest = find_latest_checkpoint(path)
assert latest == tmpdir + '/iter_8000.pth'
assert latest == os.path.join(tmpdir, 'iter_8000.pth')

with tempfile.TemporaryDirectory() as tmpdir:
with open(tmpdir + '/epoch_1.pth', 'w') as f:
with open(os.path.join(tmpdir, 'epoch_1.pth'), 'w') as f:
f.write('epoch_1')
with open(tmpdir + '/epoch_2.pth', 'w') as f:
with open(os.path.join(tmpdir, 'epoch_2.pth'), 'w') as f:
f.write('epoch_2')
path = tmpdir
latest = find_latest_checkpoint(path)
assert latest == tmpdir + '/epoch_2.pth'
assert latest == os.path.join(tmpdir, 'epoch_2.pth')
2 changes: 1 addition & 1 deletion tools/deployment/onnx2tensorrt.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def parse_args():
parsed directly from config file and are deprecated and will be \
removed in future releases.')
if not args.input_img:
args.input_img = osp.join(osp.dirname(__file__), '../demo/demo.jpg')
args.input_img = osp.join(osp.dirname(__file__), '../../demo/demo.jpg')

cfg = Config.fromfile(args.config)

Expand Down