本文将引导快速使用 Detectron2 ,介绍用摄像头测试实时目标检测。
- Detectron2: https://github.com/facebookresearch/detectron2
环境准备
基础环境
- Ubuntu 18.04
- 系统安装,可见 制作 USB 启动盘,及系统安装
- Nvidia Driver
- 驱动安装,可见 Ubuntu 初始配置 - Nvidia 驱动
- Anaconda Python
- 从这里下载 Linux 版本,并安装
Detectron2
安装,
# 创建 Python 虚拟环境
conda create -n detectron2 python=3.8 -y
conda activate detectron2
# 安装 PyTorch with CUDA
conda install pytorch==1.7.1 torchvision==0.8.2 cudatoolkit=10.2 -c pytorch -y
# 安装 Detectron2
git clone https://github.com/facebookresearch/detectron2.git
python -m pip install -e detectron2
# 安装 OpenCV ,捕获相机图像及显示
pip install opencv-python
检查,
$ python - <<EOF
im