win10 anaconda mmsegmentation installation

Description:

mmsegmentation is a relatively new, deep learning platform that can run and test multiple networks and is more convenient to use, but the original program is generally installed on the linux platform. Although the author gives some installation instructions under windows, However, the author also said that it is experimental and not necessarily stable. This article mainly installs the platform in the win10 environment.

One, install cuda environment

1. Install the graphics driver for cuda

If you have not downloaded the graphics card, you can first download the latest graphics card driver, download address , according to your actual situation, select the corresponding graphics card driver, here I choose the SD type. Here is the correspondence between the graphics card driver and the cuda version. You must choose the appropriate driver to avoid not supporting the cuda version you want to use . When installing, choose to install only the graphics card option, and all the next steps can be done.
Insert picture description here

2. Install the program for cuda

Download cuda, cuda download address

Choose the right model according to your configurationInsert picture description here

installation

The installation must choose a custom installation, only the cuda part can be installed, thinking that we have already installed the graphics card driver

3. Configure cudnn

Download cudnn, download URL

Note: The download process requires landing, not registered, then you can sign up for a
download file decompression, cuda file folder to show off the cover directly to the folder cuda installation directory, usually the default path like this:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1

Two, install mmsegmentation

The main reference content is the original description of the project , part of the content is slightly modified according to the actual situation

Environmental requirements

  • Python 3.6+
  • PyTorch 1.3+
  • CUDA 9.2+ (If you build PyTorch from source, CUDA 9.0 is also compatible)
  • GCC 5+ (vs support is required under windows)
  • MMCV

Note: If mmcv already installed, you need to run the pip uninstall mmcvuninstall. mmcv mmcv-full and can not exist, otherwise it will generate ModuleNotFoundErroran error.

installation

Note: Anaconda has been installed before, and after downloading, follow the brainless installation in the next step.

a. Create a virtual environment and activate it

conda create -n open-mmlab python=3.7 -y
conda activate open-mmlab

b. Install pytorch official instructions according to the official website instructions .
Here we use PyTorch 1.7.1 and CUDA 11.0.
According to your own environment, there may be other commands. The commands generated on the official website shall prevail.

My screenshot

conda install pytorch torchvision torchaudio cudatoolkit=11.0 -c pytorch

c. Install MMCV according to official instructions .

For windows, you need the support of the local C++ compiler, and confirm that it has been added to the environment variable. Generally, Visual Studio is already installed.

Then, clone mmcv and then need to install mmcv with pip:

# 克隆项目
git clone https://github.com/open-mmlab/mmcv.git
# 进入路径
cd mmcv
# 设置全部安装
set MMCV_WITH_OPS = 1
# 编译
python setup.py build_ext # if success, cl will be launched to compile ops
# 开发模式安装
python setup.py develop

d. Install MMSegmentation.

git clone https://github.com/open-mmlab/mmsegmentation.git
cd mmsegmentation
pip install -e .  # 或者用 "python setup.py develop"

Note:

1. When training or testing the model on Windows, please make sure that all "\" in the path are replaced with "/". Add .replace('\','/') to any python code where the path string appears.
2. version + git_hashIt will also be saved in the trained model meta, for example 0.5.0 + c415a2e.
3. When MMsegmentation is installed in "dev" mode, any local modifications to the code will take effect without the need to reinstall it.
4. If you want to use opencv-python-headlessinstead opencv-python,
you can install it before installing MMCV.
5. Some dependencies are optional. Simply running pip install -e .will only install the minimum runtime requirements.
To use cityscapessriptsoptional dependencies such as , please pip install -r requirements / optional.txtinstall them manually, or pipspecify required additional items (for example pip install -e。[optional]) when calling . The valid keys for the extras field are: all, tests, build and optional.

Whether the test was successful

a. First install jupyter notebook:

conda install jupyter notebook

b. Open the test file model test

1. First run jupyter notebook

jupyter notebook

2. Then open the test file and run the test script:

Display the picture normally
Insert picture description here

Single picture test:

python demo/image_demo.py ${IMAGE_FILE} ${CONFIG_FILE} ${CHECKPOINT_FILE} [--device ${DEVICE_NAME}] [--palette-thr ${PALETTE}]

Take me as an example:

D:\open-mmlab\mmsegmentation>python demo/image_demo.py demo/demo.png configs/pspnet/pspnet_r50-d8_512x1024_40k_cityscapes.py checkpoints/pspnet_r50-d8_512x1024_40k_cityscapes_20200605_003338-2966598c.pth --device cuda:0 --palette cityscapes

Insert picture description here

Guess you like

Origin blog.csdn.net/lebusini/article/details/113090619