Ubuntu18.04 Install MMTracking
Prerequisites
- GitHub/mmtracking_v0.5.1
- 全程挂着VPN
- info
➜ ~ cat /etc/issue
Ubuntu 18.04.5 LTS \n \l
➜ ~ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2020 NVIDIA Corporation
Built on Tue_Sep_15_19:10:02_PDT_2020
Cuda compilation tools, release 11.1, V11.1.74
Build cuda_11.1.TC455_06.29069683_0
➜ ~ nvidia-smi
Thu Apr 8 15:07:03 2021
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 455.23.05 Driver Version: 455.23.05 CUDA Version: 11.1 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 GeForce RTX 208... Off | 00000000:01:00.0 Off | N/A |
| 0% 39C P8 19W / 250W | 1MiB / 7982MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
| 1 GeForce RTX 208... Off | 00000000:03:00.0 On | N/A |
| 0% 41C P8 5W / 250W | 563MiB / 7979MiB | 2% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 999 G /usr/lib/xorg/Xorg 0MiB |
| 0 N/A N/A 1645 G /usr/bin/gnome-shell 0MiB |
| 0 N/A N/A 3017 G ...token=1615079527519864750 0MiB |
| 0 N/A N/A 14340 G ...gAAAAAAAAA --shared-files 0MiB |
| 0 N/A N/A 14787 G ...AAAAAAAA== --shared-files 0MiB |
| 0 N/A N/A 19450 G ...AAAAAAAA== --shared-files 0MiB |
| 1 N/A N/A 999 G /usr/lib/xorg/Xorg 259MiB |
| 1 N/A N/A 1645 G /usr/bin/gnome-shell 118MiB |
| 1 N/A N/A 3017 G ...token=1615079527519864750 16MiB |
| 1 N/A N/A 14340 G ...gAAAAAAAAA --shared-files 105MiB |
| 1 N/A N/A 14787 G ...AAAAAAAA== --shared-files 3MiB |
| 1 N/A N/A 19450 G ...AAAAAAAA== --shared-files 55MiB |
+-----------------------------------------------------------------------------+
➜ ~ conda --version
conda 4.4.10
➜ ~
- Linux or macOS
- Python 3.6+
- PyTorch 1.3+
- CUDA 9.2+ (If you build PyTorch from source, CUDA 9.0 is also compatible)
- GCC 5+
- MMCV 1.2.4
- MMDetection 2.8.0
Installation
1.创建conda虚拟环境
conda create -n open-mmlab python=3.7 -y
conda activate open-mmlab
2.安装pytorch和torchvision
# 我使用的pip安装
pip install torchvision==0.8.0
# 使用的清华源,会自动安装好pytoch1.7.0和其他依赖库
# Test
(open-mmlab) ➜ ~ python
Python 3.7.10 (default, Feb 26 2021, 18:47:35)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> import torchvision
>>> torch.__version__
'1.7.0'
>>> torchvision.__version__
'0.8.0'
>>> torch.cuda.is_available()
True
>>> exit()
3.安装mmdet和mmcv-full
- GitHub/mmvc-full
- 我使用的版本mmcv-full==1.2.5,mmdet==2.8.0
pip install mmcv-full==1.2.5 -f https://download.openmmlab.com/mmcv/dist/cu110/torch1.7.0/index.html
pip install mmdet==2.8.0
4.下载MMTracking repository
git clone https://github.com/open-mmlab/mmtracking.git
cd mmtracking
# 或者下载releases/v0.5.1
# https://github.com/open-mmlab/mmtracking/releases
# sudo unzip mmtracking-0.5.1.zip
# cd mmtracking-0.5.1
5.Install build requirements and then install MMTracking
# 权限
sudo chmod 777 setup.py
sudo chmod 777 demo
pip install -r requirements/build.txt
pip install -v -e . # or "python setup.py develop"
成功如下:
......
Using /home/optivi/.conda/envs/open-mmlab/lib/python3.7/site-packages
Searching for typing-extensions==3.7.4.3
Best match: typing-extensions 3.7.4.3
Adding typing-extensions 3.7.4.3 to easy-install.pth file
Using /home/optivi/.conda/envs/open-mmlab/lib/python3.7/site-packages
Finished processing dependencies for mmtrack==0.5.0
demo
- deepsort tracking
python demo/demo_mot.py configs/mot/deepsort/sort_faster-rcnn_fpn_4e_mot17-private.py --input demo/demo.mp4 --output mot.mp4
log如下:
2021-04-08 14:04:45,547 - mmtrack - INFO - load detector from: https://download.openmmlab.com/mmtracking/mot/faster_rcnn/faster-rcnn_r50_fpn_4e_mot17-ffa52ae7.pth
Downloading: "https://download.openmmlab.com/mmtracking/mot/faster_rcnn/faster-rcnn_r50_fpn_4e_mot17-ffa52ae7.pth" to /home/optivi/.cache/torch/hub/checkpoints/faster-rcnn_r50_fpn_4e_mot17-ffa52ae7.pth
100.0%
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 8/8, 8.3 task/s, elapsed: 1s, ETA: 0smaking the output video at mot.mp4 with a FPS of 3
OpenCV: FFMPEG: tag 0x44495658/'XVID' is not supported with codec id 12 and format 'mp4 / MP4 (MPEG-4 Part 14)'
OpenCV: FFMPEG: fallback to use tag 0x7634706d/'mp4v'
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 8/8, 42.4 task/s, elapsed: 0s, ETA: 0s
- tracktor tracking
python demo/demo_mot.py configs/mot/tracktor/tracktor_faster-rcnn_r50_fpn_4e_mot17-private.py --input demo/test2.mp4 --output test2.mp4
log如下:
2021-04-08 14:25:46,452 - mmtrack - INFO - load detector from: https://download.openmmlab.com/mmtracking/mot/faster_rcnn/faster-rcnn_r50_fpn_4e_mot17-ffa52ae7.pth
2021-04-08 14:25:46,526 - mmtrack - INFO - load reid from: https://download.openmmlab.com/mmtracking/mot/reid/tracktor_reid_r50_iter25245-a452f51f.pth
Downloading: "https://download.openmmlab.com/mmtracking/mot/reid/tracktor_reid_r50_iter25245-a452f51f.pth" to /home/optivi/.cache/torch/hub/checkpoints/tracktor_reid_r50_iter25245-a452f51f.pth
100.0%
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 800/800, 7.3 task/s, elapsed: 110s, ETA: 0smaking the output video at test1.mp4 with a FPS of 30
OpenCV: FFMPEG: tag 0x44495658/'XVID' is not supported with codec id 12 and format 'mp4 / MP4 (MPEG-4 Part 14)'
OpenCV: FFMPEG: fallback to use tag 0x7634706d/'mp4v'
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 800/800, 47.4 task/s, elapsed: 17s, ETA: 0s