diff --git a/mmseg/utils/collect_env.py b/mmseg/utils/collect_env.py index 3fcead459..8293a05fb 100644 --- a/mmseg/utils/collect_env.py +++ b/mmseg/utils/collect_env.py @@ -1,68 +1,13 @@ -import os.path as osp -import subprocess -import sys -from collections import defaultdict - -import cv2 -import mmcv -import torch -import torchvision -from mmcv.utils import get_build_config, get_git_hash +from mmcv.utils import collect_env as collect_base_env +from mmcv.utils import get_git_hash import mmseg def collect_env(): """Collect the information of the running environments.""" - env_info = {} - env_info['sys.platform'] = sys.platform - env_info['Python'] = sys.version.replace('\n', '') - - cuda_available = torch.cuda.is_available() - env_info['CUDA available'] = cuda_available - - if cuda_available: - from mmcv.utils.parrots_wrapper import CUDA_HOME - env_info['CUDA_HOME'] = CUDA_HOME - - if CUDA_HOME is not None and osp.isdir(CUDA_HOME): - try: - nvcc = osp.join(CUDA_HOME, 'bin/nvcc') - nvcc = subprocess.check_output( - '"{}" -V | tail -n1'.format(nvcc), shell=True) - nvcc = nvcc.decode('utf-8').strip() - except subprocess.SubprocessError: - nvcc = 'Not Available' - env_info['NVCC'] = nvcc - - devices = defaultdict(list) - for k in range(torch.cuda.device_count()): - devices[torch.cuda.get_device_name(k)].append(str(k)) - for name, devids in devices.items(): - env_info['GPU ' + ','.join(devids)] = name - try: - gcc = subprocess.check_output('gcc --version | head -n1', shell=True) - gcc = gcc.decode('utf-8').strip() - env_info['GCC'] = gcc - except subprocess.CalledProcessError: - env_info['GCC'] = 'n/a' - - env_info['PyTorch'] = torch.__version__ - env_info['PyTorch compiling details'] = get_build_config() - - env_info['TorchVision'] = torchvision.__version__ - - env_info['OpenCV'] = cv2.__version__ - - env_info['MMCV'] = mmcv.__version__ + env_info = collect_base_env() env_info['MMSegmentation'] = f'{mmseg.__version__}+{get_git_hash()[:7]}' - try: - from mmcv.ops import get_compiler_version, get_compiling_cuda_version - env_info['MMCV Compiler'] = get_compiler_version() - env_info['MMCV CUDA Compiler'] = get_compiling_cuda_version() - except ImportError: - env_info['MMCV Compiler'] = 'n/a' - env_info['MMCV CUDA Compiler'] = 'n/a' return env_info diff --git a/setup.cfg b/setup.cfg index 9721e1c5c..594abb8ec 100644 --- a/setup.cfg +++ b/setup.cfg @@ -8,6 +8,6 @@ line_length = 79 multi_line_output = 0 known_standard_library = setuptools known_first_party = mmseg -known_third_party = PIL,cityscapesscripts,cv2,matplotlib,mmcv,numpy,onnxruntime,pytablewriter,pytest,scipy,torch,torchvision +known_third_party = PIL,cityscapesscripts,matplotlib,mmcv,numpy,onnxruntime,pytablewriter,pytest,scipy,torch no_lines_before = STDLIB,LOCALFOLDER default_section = THIRDPARTY