diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/mmcv/__init__.py b/mmcv/__init__.py index e87858c594..ec2d6b1304 100644 --- a/mmcv/__init__.py +++ b/mmcv/__init__.py @@ -1,26 +1,13 @@ # Copyright (c) OpenMMLab. All rights reserved. # flake8: noqa -import warnings - from .arraymisc import * -from .fileio import * from .image import * -from .utils import * +# from .transforms import * from .version import * from .video import * from .visualization import * - +from .utils import * # The following modules are not imported to this level, so mmcv may be used # without PyTorch. -# - runner -# - parallel # - op -# - device - -warnings.warn( - 'On January 1, 2023, MMCV will release v2.0.0, in which it will remove ' - 'components related to the training process and add a data transformation ' - 'module. In addition, it will rename the package names mmcv to mmcv-lite ' - 'and mmcv-full to mmcv. ' - 'See https://github.com/open-mmlab/mmcv/blob/master/docs/en/compatibility.md ' - 'for more details.') +# - utils \ No newline at end of file diff --git a/mmcv/ops/__init__.py b/mmcv/ops/__init__.py index bdad553736..c2948dfaa2 100755 --- a/mmcv/ops/__init__.py +++ b/mmcv/ops/__init__.py @@ -1,6 +1,6 @@ # Copyright (c) OpenMMLab. All rights reserved. from mmcv.utils import IS_MLU_AVAILABLE -from .active_rotated_filter import active_rotated_filter +# from .active_rotated_filter import active_rotated_filter from .assign_score_withk import assign_score_withk from .ball_query import ball_query from .bbox import bbox_overlaps diff --git a/mmcv/parallel/distributed.py b/mmcv/parallel/distributed.py index bf34cb5906..0483f5b1b2 100644 --- a/mmcv/parallel/distributed.py +++ b/mmcv/parallel/distributed.py @@ -5,7 +5,7 @@ from torch.nn.parallel.distributed import (DistributedDataParallel, _find_tensors) -from mmcv import print_log +from mmcv.utils.logging import print_log from mmcv.utils import TORCH_VERSION, digit_version from .scatter_gather import ScatterInputs, scatter_kwargs diff --git a/mmcv/utils/ext_loader.py b/mmcv/utils/ext_loader.py index a31e107dfe..d7845826d7 100644 --- a/mmcv/utils/ext_loader.py +++ b/mmcv/utils/ext_loader.py @@ -10,6 +10,8 @@ if torch.__version__ != 'parrots': def load_ext(name, funcs): + if name == '_ext': + return 0 ext = importlib.import_module('mmcv.' + name) for fun in funcs: assert hasattr(ext, fun), f'{fun} miss in module {name}' diff --git a/mmcv/utils/misc.py b/mmcv/utils/misc.py index 7957ea89b7..1313c74197 100644 --- a/mmcv/utils/misc.py +++ b/mmcv/utils/misc.py @@ -8,6 +8,7 @@ from importlib import import_module from inspect import getfullargspec from itertools import repeat +import platform # From PyTorch internals @@ -251,10 +252,16 @@ def _check_py_package(package): def _check_executable(cmd): - if subprocess.call(f'which {cmd}', shell=True) != 0: - return False - else: - return True + if platform.system() == 'Linux': + if subprocess.call(f'which {cmd}', shell=True) != 0: + return False + else: + return True + if platform.system() == 'Windows': + if subprocess.call(f'where {cmd}', shell=True) != 0: + return False + else: + return True def requires_package(prerequisites): diff --git a/mmcv/video/__init__.py b/mmcv/video/__init__.py index 73199b01de..dfdf494d2e 100644 --- a/mmcv/video/__init__.py +++ b/mmcv/video/__init__.py @@ -1,5 +1,5 @@ # Copyright (c) OpenMMLab. All rights reserved. -from .io import Cache, VideoReader, frames2video +from .mm_io import Cache, VideoReader, frames2video from .optflow import (dequantize_flow, flow_from_bytes, flow_warp, flowread, flowwrite, quantize_flow, sparse_flow_from_bytes) from .processing import concat_video, convert_video, cut_video, resize_video diff --git a/mmcv/video/io.py b/mmcv/video/mm_io.py similarity index 92% rename from mmcv/video/io.py rename to mmcv/video/mm_io.py index 0b2b688763..894c1a3719 100644 --- a/mmcv/video/io.py +++ b/mmcv/video/mm_io.py @@ -7,6 +7,7 @@ CAP_PROP_FRAME_HEIGHT, CAP_PROP_FRAME_WIDTH, CAP_PROP_POS_FRAMES, VideoWriter_fourcc) +# if error here, please add mmcv_forked/ to PYTHON_PATH from mmcv.utils import (check_file_exist, mkdir_or_exist, scandir, track_progress) @@ -38,6 +39,12 @@ def get(self, key, default=None): val = self._cache[key] if key in self._cache else default return val +def encule_de_la_mort(): + """ + Doctest de merde, qui nous fait un autre point d'entrée vers VideoReader + >>> print("bites de merde") + """ + pass class VideoReader: """Video class with similar usage to a list object. @@ -49,15 +56,18 @@ class VideoReader: Cache is used when decoding videos. So if the same frame is visited for the second time, there is no need to decode again if it is stored in the cache. + # import dependencies.mmcv_forked.mmcv.video.io, dependencies.mmcv_forked.mmcv.visualization + # from dependencies.mmcv_forked.mmcv.video import VideoReader Examples: - >>> import mmcv - >>> v = mmcv.VideoReader('sample.mp4') + >>> import dependencies.mmcv_forked.mmcv as mmcv + >>> import dependencies.mmcv_forked.mmcv.video + >>> import dependencies.mmcv_forked.mmcv.visualization + >>> from path_config import PATHS + >>> v = mmcv.video.VideoReader(str(PATHS.examples_vid / 'in.mp4')) >>> len(v) # get the total frame number with `len()` - 120 - >>> for img in v: # v is iterable - >>> mmcv.imshow(img) - >>> v[5] # get the 6th frame + 8 + >>> mmcv.visualization.imshow(v[5], wait_time=1) # get the 6th frame """ def __init__(self, filename, cache_capacity=10): diff --git a/mmcv/video/processing.py b/mmcv/video/processing.py index 90e2a4c022..88d0b0e34e 100644 --- a/mmcv/video/processing.py +++ b/mmcv/video/processing.py @@ -45,8 +45,8 @@ def convert_video(in_file: str, options.append(f'-loglevel {v}') else: options.append(f'-{k} {v}') - cmd = f'ffmpeg -y {pre_options} -i {in_file} {" ".join(options)} ' \ - f'{out_file}' + cmd = f'ffmpeg -y {pre_options} -i "{in_file}" {" ".join(options)} ' \ + f'"{out_file}"' if print_cmd: print(cmd) subprocess.call(cmd, shell=True)