1
0
mirror of https://github.com/open-mmlab/mmsegmentation.git synced 2025-06-03 22:03:48 +08:00

Windows Support (Experimental) ()

* 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. ()

* 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 ()

* 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 <xvjiarui0826@gmail.com>

* Update docs/install.md

Co-authored-by: Jerry Jiarui XU <xvjiarui0826@gmail.com>

Co-authored-by: Jerry Jiarui XU <xvjiarui0826@gmail.com>
This commit is contained in:
John Zhu 2020-08-28 11:34:44 +08:00 committed by GitHub
parent 298124566b
commit 597b8a61c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 73 additions and 21 deletions

@ -1,13 +1,11 @@
## Installation ## Requirements
### Requirements - Linux or Windows(Experimental)
- Linux (Windows is not officially supported)
- Python 3.6+ - Python 3.6+
- PyTorch 1.3 or higher - PyTorch 1.3 or higher
- [mmcv](https://github.com/open-mmlab/mmcv) - [mmcv](https://github.com/open-mmlab/mmcv)
### Install mmsegmentation ## Installation
a. Create a conda virtual environment and activate it. a. Create a conda virtual environment and activate it.
@ -17,15 +15,17 @@ conda activate open-mmlab
``` ```
b. Install PyTorch and torchvision following the [official instructions](https://pytorch.org/). b. Install PyTorch and torchvision following the [official instructions](https://pytorch.org/).
Here we use PyTorch 1.5.0 and CUDA 10.1. Here we use PyTorch 1.6.0 and CUDA 10.1.
You may also switch to other version by specifying the version number. You may also switch to other version by specifying the version number.
```shell ```shell
conda install pytorch=1.5.0 torchvision cudatoolkit=10.1 -c pytorch conda install pytorch=1.6.0 torchvision cudatoolkit=10.1 -c pytorch
``` ```
c. Install [MMCV](https://mmcv.readthedocs.io/en/latest/) following the [official instructions](https://mmcv.readthedocs.io/en/latest/#installation). c. Install [MMCV](https://mmcv.readthedocs.io/en/latest/) following the [official instructions](https://mmcv.readthedocs.io/en/latest/#installation).
Either `mmcv` or `mmcv-full` is compatible with MMSegmentation, but for methods like CCNet and PSANet, CUDA ops in `mmcv-full` is required Either `mmcv` or `mmcv-full` is compatible with MMSegmentation, but for methods like CCNet and PSANet, CUDA ops in `mmcv-full` is required.
**Install mmcv for Linux:**
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)) 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))
@ -33,6 +33,33 @@ The pre-build mmcv-full (with PyTorch 1.5 and CUDA 10.1) can be installed by run
pip install mmcv-full==latest+torch1.5.0+cu101 -f https://openmmlab.oss-accelerate.aliyuncs.com/mmcv/dist/index.html pip install mmcv-full==latest+torch1.5.0+cu101 -f https://openmmlab.oss-accelerate.aliyuncs.com/mmcv/dist/index.html
``` ```
**Install mmcv for Windows (Experimental):**
For Windows, the installation of MMCV requires native C++ compilers, such as cl.exe. Please add the compiler to %PATH%.
A typical path for cl.exe looks like the following if you have Windows SDK and Visual Studio installed on your computer:
```shell
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.26.28801\bin\Hostx86\x64
```
Or you should download the cl compiler from web and then set up the path.
Then, clone mmcv from github and install mmcv via pip:
```shell
git clone https://github.com/open-mmlab/mmcv.git
cd mmcv
pip install -e .
```
Or simply:
```shell
pip install mmcv
```
Currently, mmcv-full is not supported on Windows.
d. Install MMSegmentation. d. Install MMSegmentation.
```shell ```shell
@ -47,24 +74,28 @@ pip install git+https://github.com/open-mmlab/mmsegmentation.git # install the m
Instead, if you would like to install MMSegmentation in `dev` mode, run following Instead, if you would like to install MMSegmentation in `dev` mode, run following
```shell ```shell
git clone https://github.com/open-mmlab/mmsegmentation git clone https://github.com/open-mmlab/mmsegmentation.git
cd mmsegmentation cd mmsegmentation
pip install -e . # or "python setup.py develop" pip install -e . # or "python setup.py develop"
``` ```
Note: Note:
1. The `version+git_hash` will also be saved in trained models meta, e.g. 0.5.0+c415a2e. 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.
2. When MMsegmentation is installed on `dev` mode, any local modifications made to the code will take effect without the need to reinstall it. 2. The `version+git_hash` will also be saved in trained models meta, e.g. 0.5.0+c415a2e.
3. If you would like to use `opencv-python-headless` instead of `opencv-python`, 3. When MMsegmentation is installed on `dev` mode, any local modifications made to the code will take effect without the need to reinstall it.
4. If you would like to use `opencv-python-headless` instead of `opencv-python`,
you can install it before installing MMCV. you can install it before installing MMCV.
4. Some dependencies are optional. Simply running `pip install -e .` will only install the minimum runtime requirements. 5. Some dependencies are optional. Simply running `pip install -e .` will only install the minimum runtime requirements.
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`. 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`.
### A from-scratch setup script
## A from-scratch setup script
### Linux
Here is a full script for setting up mmsegmentation with conda and link the dataset path (supposing that your dataset path is $DATA_ROOT). Here is a full script for setting up mmsegmentation with conda and link the dataset path (supposing that your dataset path is $DATA_ROOT).
@ -72,12 +103,31 @@ Here is a full script for setting up mmsegmentation with conda and link the data
conda create -n open-mmlab python=3.7 -y conda create -n open-mmlab python=3.7 -y
conda activate open-mmlab conda activate open-mmlab
conda install pytorch=1.5.0 torchvision cudatoolkit=10.1 -c pytorch conda install pytorch=1.6.0 torchvision cudatoolkit=10.1 -c pytorch
pip install mmcv-full==latest+torch1.5.0+cu101 -f https://openmmlab.oss-accelerate.aliyuncs.com/mmcv/dist/index.html pip install mmcv-full==latest+torch1.5.0+cu101 -f https://openmmlab.oss-accelerate.aliyuncs.com/mmcv/dist/index.html
git clone https://github.com/open-mmlab/mmsegmentation git clone https://github.com/open-mmlab/mmsegmentation.git
cd mmsegmentation cd mmsegmentation
pip install -e . # or "python setup.py develop" pip install -e . # or "python setup.py develop"
mkdir data mkdir data
ln -s $DATA_ROOT data ln -s $DATA_ROOT data
``` ```
### Windows(Experimental)
Here is a full script for setting up mmsegmentation with conda and link the dataset path (supposing that your dataset path is
%DATA_ROOT%. Notice: It must be an absolute path).
```shell
conda create -n open-mmlab python=3.7 -y
conda activate open-mmlab
conda install pytorch=1.6.0 torchvision cudatoolkit=10.1 -c pytorch
set PATH=full\path\to\your\cpp\compiler;%PATH%
pip install mmcv
git clone https://github.com/open-mmlab/mmsegmentation.git
cd mmsegmentation
pip install -e . # or "python setup.py develop"
mklink /D data %DATA_ROOT%
```

@ -3,7 +3,7 @@ import mmcv
from .version import __version__, version_info from .version import __version__, version_info
MMCV_MIN = '1.0.5' MMCV_MIN = '1.0.5'
MMCV_MAX = '1.1.0' MMCV_MAX = '1.1.1'
def digit_version(version_str): def digit_version(version_str):

@ -40,10 +40,12 @@ def collect_env():
devices[torch.cuda.get_device_name(k)].append(str(k)) devices[torch.cuda.get_device_name(k)].append(str(k))
for name, devids in devices.items(): for name, devids in devices.items():
env_info['GPU ' + ','.join(devids)] = name env_info['GPU ' + ','.join(devids)] = name
try:
gcc = subprocess.check_output('gcc --version | head -n1', shell=True) gcc = subprocess.check_output('gcc --version | head -n1', shell=True)
gcc = gcc.decode('utf-8').strip() gcc = gcc.decode('utf-8').strip()
env_info['GCC'] = gcc env_info['GCC'] = gcc
except subprocess.CalledProcessError:
env_info['GCC'] = 'n/a'
env_info['PyTorch'] = torch.__version__ env_info['PyTorch'] = torch.__version__
env_info['PyTorch compiling details'] = get_build_config() env_info['PyTorch compiling details'] = get_build_config()