1, Anoconda building environment name: Foster
1.1 build a virtual environment
Create a virtual environment called foster, in which all future operations will be performed. This can avoid mutual interference between different versions of python or frameworks. python = allows you to specify the version of python. If you do not enter the content in brackets, the system will install the latest version of python.
conda create -n faster python=3.6
Record the location of the environment and wait for pycharm to use it
environment location: /home/lyl/anaconda3/envs/faster
1.2 activate virtual environment
source activate pytorch
As you can see, a fast appears at the front of the command line to indicate that we have entered the virtual environment. All operations in the future are carried out under this virtual environment.
1.3 exiting virtual environment
If you need to exit the virtual environment, you can use the following command.
source deactivate
1.4 remove virtual environment
If there is any problem in the process of configuration, you can exit the virtual environment first, then remove the virtual environment, and then reconfigure it
conda remove -n faster --all
1.5 installing pytorch
Access the official website of pytorch for installation instructions
On the homepage of the official website, choose the installation mode of conda according to your system, CUDA and python version. Mine is
conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
Stable indicates the latest tested and supported version of pytorch. This should be suitable for many users, indicating that the latest version of pytorch has reached 1.4. Make sure you meet the following prerequisites, such as numpy, depending on your package manager. Anaconda is our recommended package manager because it installs all dependencies. You can also install earlier versions of PyTorch . Note that LibTorch is only available for C + +.
Please ensure that you have met the prerequisites below (e.g., numpy), depending on your package manager. Anaconda is our recommended package manager since it installs all dependencies. You can also install previous versions of PyTorch. Note that LibTorch is only available for C++.
As shown in the first figure, the code on github of foster RCNN needs 0.4.0, not the highest 1.4
CUDA 10.0 build
2 Ubuntu 18.04 change the system image to Tsinghua image source
The reason for the source change is that I just used the above steps to build python=3.6 without success and it is super slow. After the source change, it seems to be a little happier
Open Terminal
2.1 make a backup of the file provided by the system
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
2.2 modify configuration
Open file:
sudo gedit /etc/apt/sources.list
Paste the following content to the front of the open file, paste it all, save it, and close it.
# The source image is annotated by default to improve the speed of apt update. If necessary, you can cancel the annotation by yourself deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse # Pre release software source, not recommended # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
If you are confused about the above address, or your Ubuntu system is not 18.04, you can open the following address, select your Ubuntu version, and copy the links inside to the text.
https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
2.3 update
Update source: sudo apt get update
Update software: sudo apt get upgrade