Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 4 additions & 25 deletions .circleci/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,37 +145,16 @@ workflows:
not:
<< pipeline.parameters.lint_only >>
jobs:
- build_cuda:
name: minimum_version_gpu
torch: 1.6.0
# Use double quotation mark to explicitly specify its type
# as string instead of number
mmcv: https://download.openmmlab.com/mmcv/dev-2.x/cu101/torch1.6.0/mmcv_full-2.0.0rc0-cp37-cp37m-manylinux1_x86_64.whl
cuda: "10.1"
filters:
branches:
only:
- dev-1.x
- build_cpu:
name: minimum_version_cpu
torch: 1.6.0
torchvision: 0.7.0
python: 3.6.9 # The lowest python 3.6.x version available on CircleCI images
mmcv: https://download.openmmlab.com/mmcv/dev-2.x/cpu/torch1.6.0/mmcv_full-2.0.0rc0-cp36-cp36m-manylinux1_x86_64.whl
# requires:
# - lint
filters:
branches:
only:
- dev-1.x
- build_cpu:
name: maximum_version_cpu
torch: 1.9.0
torchvision: 0.10.0
python: 3.9.0
mmcv: https://download.openmmlab.com/mmcv/dev-2.x/cpu/torch1.9.0/mmcv_full-2.0.0rc0-cp39-cp39-manylinux1_x86_64.whl
requires:
- minimum_version_cpu
filters:
branches:
only:
- dev-1.x
- hold:
type: approval
requires:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/merge_stage_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ concurrency:
# runs-on: ubuntu-18.04
# strategy:
# matrix:
# python-version: [3.6, 3.8, 3.9]
# python-version: [3.7, 3.8, 3.9]
# torch: [1.8.1]
# include:
# - torch: 1.8.1
Expand Down
76 changes: 57 additions & 19 deletions mmrotate/__init__.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,70 @@
# Copyright (c) OpenMMLab. All rights reserved.
import warnings

import mmcv
import mmdet
from packaging.version import parse

from .core import * # noqa: F401, F403
from .datasets import * # noqa: F401, F403
from .models import * # noqa: F401, F403
from .version import __version__, short_version


def digit_version(version_str):
"""Digit version."""
digit_version = []
for x in version_str.split('.'):
if x.isdigit():
digit_version.append(int(x))
elif x.find('rc') != -1:
patch_version = x.split('rc')
digit_version.append(int(patch_version[0]) - 1)
digit_version.append(int(patch_version[1]))
return digit_version
def digit_version(version_str: str, length: int = 4):
"""Convert a version string into a tuple of integers.

This method is usually used for comparing two versions. For pre-release
versions: alpha < beta < rc.
Args:
version_str (str): The version string.
length (int): The maximum number of version levels. Default: 4.
Returns:
tuple[int]: The version info in digits (integers).
"""
version = parse(version_str)
assert version.release, f'failed to parse version {version_str}'
release = list(version.release)
release = release[:length]
if len(release) < length:
release = release + [0] * (length - len(release))
if version.is_prerelease:
mapping = {'a': -3, 'b': -2, 'rc': -1}
val = -4
# version.pre can be None
if version.pre:
if version.pre[0] not in mapping:
warnings.warn(f'unknown prerelease version {version.pre[0]}, '
'version checking may go wrong')
else:
val = mapping[version.pre[0]]
release.extend([val, version.pre[-1]])
else:
release.extend([val, 0])

elif version.is_postrelease:
release.extend([1, version.post])
else:
release.extend([0, 0])
return tuple(release)


mmcv_minimum_version = '1.4.5'
mmcv_maximum_version = '1.6.0'
mmcv_minimum_version = '2.0.0rc0'
mmcv_maximum_version = '2.0.0'
mmcv_version = digit_version(mmcv.__version__)

assert (mmcv_version >= digit_version(mmcv_minimum_version)
and mmcv_version <= digit_version(mmcv_maximum_version)), \
f'MMCV=={mmcv.__version__} is used but incompatible. ' \
f'Please install mmcv>={mmcv_minimum_version}, <={mmcv_maximum_version}.'
f'MMCV {mmcv.__version__} is incompatible with MMRotate {__version__}. ' \
f'Please use MMCV >= {mmcv_minimum_version}, ' \
f'<= {mmcv_maximum_version} instead.'

mmdet_minimum_version = '2.21.0'
mmdet_maximum_version = '3.0.0'
mmdet_version = digit_version(mmdet.__version__)

assert (mmdet_version >= digit_version(mmdet_minimum_version)
and mmdet_version <= digit_version(mmdet_maximum_version)), \
f'MMDetection {mmdet.__version__} is incompatible ' \
f'with MMRotate {__version__}. ' \
f'Please use MMDetection >= {mmdet_minimum_version}, ' \
f'<= {mmdet_maximum_version} instead.'

__all__ = ['__version__', 'short_version']
__all__ = ['__version__', 'short_version', 'digit_version']
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ line_length = 79
multi_line_output = 0
known_standard_library = setuptools
known_first_party = mmrotate
known_third_party = PIL,cv2,e2cnn,matplotlib,mmcv,mmdet,numpy,pytest,pytorch_sphinx_theme,terminaltables,torch,ts,yaml
known_third_party = PIL,cv2,e2cnn,matplotlib,mmcv,mmdet,numpy,packaging,pytorch_sphinx_theme,terminaltables,torch,ts,yaml
no_lines_before = STDLIB,LOCALFOLDER
default_section = THIRDPARTY

Expand Down
73 changes: 0 additions & 73 deletions tests/test_data/test_datasets/test_dota.py

This file was deleted.

46 changes: 0 additions & 46 deletions tests/test_data/test_datasets/test_rotate.py

This file was deleted.

4 changes: 0 additions & 4 deletions tests/test_data/test_pipelines/__init__.py

This file was deleted.

Loading