Skip to content

Commit 597b8a6

Browse files
johnzjaxvjiarui
andauthored
Windows Support (Experimental) (open-mmlab#75)
* Windows basic support * getting_started updated for Windows. * add experimental * install.md restructured to seperate Windows & Linux. * fix problems in install.md * fix mmcv version problem. * Fix fastscnn resize problems. (open-mmlab#82) * Fix fast_scnn resize problems * Fix fast_scnn resize problems 1 * Fix fast_scnn resize problems 2 * test for pascal voc * [Doc] Add annotaion format note (open-mmlab#77) * update pytorch version to 1.6.0 in install.md * del fastscnn_pascal config * del create_symlink=True * Merge instructions for Linux & Windows * mmcv version updated * redundant newline deleted * Update docs/install.md Co-authored-by: Jerry Jiarui XU <[email protected]> * Update docs/install.md Co-authored-by: Jerry Jiarui XU <[email protected]> Co-authored-by: Jerry Jiarui XU <[email protected]>
1 parent 2981245 commit 597b8a6

File tree

3 files changed

+73
-21
lines changed

3 files changed

+73
-21
lines changed

docs/install.md

Lines changed: 66 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
## Installation
2-
3-
### Requirements
1+
## Requirements
42

5-
- Linux (Windows is not officially supported)
3+
- Linux or Windows(Experimental)
64
- Python 3.6+
75
- PyTorch 1.3 or higher
86
- [mmcv](https://github.com/open-mmlab/mmcv)
97

10-
### Install mmsegmentation
8+
## Installation
119

1210
a. Create a conda virtual environment and activate it.
1311

@@ -17,22 +15,51 @@ conda activate open-mmlab
1715
```
1816

1917
b. Install PyTorch and torchvision following the [official instructions](https://pytorch.org/).
20-
Here we use PyTorch 1.5.0 and CUDA 10.1.
18+
Here we use PyTorch 1.6.0 and CUDA 10.1.
2119
You may also switch to other version by specifying the version number.
2220

2321
```shell
24-
conda install pytorch=1.5.0 torchvision cudatoolkit=10.1 -c pytorch
22+
conda install pytorch=1.6.0 torchvision cudatoolkit=10.1 -c pytorch
2523
```
2624

2725
c. Install [MMCV](https://mmcv.readthedocs.io/en/latest/) following the [official instructions](https://mmcv.readthedocs.io/en/latest/#installation).
28-
Either `mmcv` or `mmcv-full` is compatible with MMSegmentation, but for methods like CCNet and PSANet, CUDA ops in `mmcv-full` is required
26+
Either `mmcv` or `mmcv-full` is compatible with MMSegmentation, but for methods like CCNet and PSANet, CUDA ops in `mmcv-full` is required.
27+
28+
**Install mmcv for Linux:**
2929

3030
The pre-build mmcv-full (with PyTorch 1.5 and CUDA 10.1) can be installed by running: (other available versions could be found [here](https://mmcv.readthedocs.io/en/latest/#install-with-pip))
3131

3232
```shell
3333
pip install mmcv-full==latest+torch1.5.0+cu101 -f https://openmmlab.oss-accelerate.aliyuncs.com/mmcv/dist/index.html
3434
```
3535

36+
**Install mmcv for Windows (Experimental):**
37+
38+
For Windows, the installation of MMCV requires native C++ compilers, such as cl.exe. Please add the compiler to %PATH%.
39+
40+
A typical path for cl.exe looks like the following if you have Windows SDK and Visual Studio installed on your computer:
41+
42+
```shell
43+
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.26.28801\bin\Hostx86\x64
44+
```
45+
46+
Or you should download the cl compiler from web and then set up the path.
47+
48+
Then, clone mmcv from github and install mmcv via pip:
49+
50+
```shell
51+
git clone https://github.com/open-mmlab/mmcv.git
52+
cd mmcv
53+
pip install -e .
54+
```
55+
56+
Or simply:
57+
```shell
58+
pip install mmcv
59+
```
60+
61+
Currently, mmcv-full is not supported on Windows.
62+
3663
d. Install MMSegmentation.
3764

3865
```shell
@@ -47,37 +74,60 @@ pip install git+https://github.com/open-mmlab/mmsegmentation.git # install the m
4774

4875
Instead, if you would like to install MMSegmentation in `dev` mode, run following
4976
```shell
50-
git clone https://github.com/open-mmlab/mmsegmentation
77+
git clone https://github.com/open-mmlab/mmsegmentation.git
5178
cd mmsegmentation
5279
pip install -e . # or "python setup.py develop"
5380
```
5481

5582
Note:
5683

57-
1. The `version+git_hash` will also be saved in trained models meta, e.g. 0.5.0+c415a2e.
84+
1. When training or testing models on Windows, please ensure that all the '\\' in paths are replaced with '/'. Add .replace('\\', '/') to your python code wherever path strings occur.
85+
86+
2. The `version+git_hash` will also be saved in trained models meta, e.g. 0.5.0+c415a2e.
5887

59-
2. When MMsegmentation is installed on `dev` mode, any local modifications made to the code will take effect without the need to reinstall it.
88+
3. When MMsegmentation is installed on `dev` mode, any local modifications made to the code will take effect without the need to reinstall it.
6089

61-
3. If you would like to use `opencv-python-headless` instead of `opencv-python`,
90+
4. If you would like to use `opencv-python-headless` instead of `opencv-python`,
6291
you can install it before installing MMCV.
6392

64-
4. Some dependencies are optional. Simply running `pip install -e .` will only install the minimum runtime requirements.
93+
5. Some dependencies are optional. Simply running `pip install -e .` will only install the minimum runtime requirements.
6594
To use optional dependencies like `cityscapessripts` either install them manually with `pip install -r requirements/optional.txt` or specify desired extras when calling `pip` (e.g. `pip install -e .[optional]`). Valid keys for the extras field are: `all`, `tests`, `build`, and `optional`.
6695

67-
### A from-scratch setup script
96+
97+
## A from-scratch setup script
98+
### Linux
6899

69100
Here is a full script for setting up mmsegmentation with conda and link the dataset path (supposing that your dataset path is $DATA_ROOT).
70101

71102
```shell
72103
conda create -n open-mmlab python=3.7 -y
73104
conda activate open-mmlab
74105

75-
conda install pytorch=1.5.0 torchvision cudatoolkit=10.1 -c pytorch
106+
conda install pytorch=1.6.0 torchvision cudatoolkit=10.1 -c pytorch
76107
pip install mmcv-full==latest+torch1.5.0+cu101 -f https://openmmlab.oss-accelerate.aliyuncs.com/mmcv/dist/index.html
77-
git clone https://github.com/open-mmlab/mmsegmentation
108+
git clone https://github.com/open-mmlab/mmsegmentation.git
78109
cd mmsegmentation
79110
pip install -e . # or "python setup.py develop"
80111

81112
mkdir data
82113
ln -s $DATA_ROOT data
83114
```
115+
116+
### Windows(Experimental)
117+
Here is a full script for setting up mmsegmentation with conda and link the dataset path (supposing that your dataset path is
118+
%DATA_ROOT%. Notice: It must be an absolute path).
119+
120+
```shell
121+
conda create -n open-mmlab python=3.7 -y
122+
conda activate open-mmlab
123+
124+
conda install pytorch=1.6.0 torchvision cudatoolkit=10.1 -c pytorch
125+
set PATH=full\path\to\your\cpp\compiler;%PATH%
126+
pip install mmcv
127+
128+
git clone https://github.com/open-mmlab/mmsegmentation.git
129+
cd mmsegmentation
130+
pip install -e . # or "python setup.py develop"
131+
132+
mklink /D data %DATA_ROOT%
133+
```

mmseg/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from .version import __version__, version_info
44

55
MMCV_MIN = '1.0.5'
6-
MMCV_MAX = '1.1.0'
6+
MMCV_MAX = '1.1.1'
77

88

99
def digit_version(version_str):

mmseg/utils/collect_env.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,12 @@ def collect_env():
4040
devices[torch.cuda.get_device_name(k)].append(str(k))
4141
for name, devids in devices.items():
4242
env_info['GPU ' + ','.join(devids)] = name
43-
44-
gcc = subprocess.check_output('gcc --version | head -n1', shell=True)
45-
gcc = gcc.decode('utf-8').strip()
46-
env_info['GCC'] = gcc
43+
try:
44+
gcc = subprocess.check_output('gcc --version | head -n1', shell=True)
45+
gcc = gcc.decode('utf-8').strip()
46+
env_info['GCC'] = gcc
47+
except subprocess.CalledProcessError:
48+
env_info['GCC'] = 'n/a'
4749

4850
env_info['PyTorch'] = torch.__version__
4951
env_info['PyTorch compiling details'] = get_build_config()

0 commit comments

Comments
 (0)