Table of Contents
一、项目地址
[paper]:Girdhar R, Gkioxari G, Torresani L, et al. Detect-and-Track: Efficient Pose Estimation in Videos[C]//Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. 2018: 350-359.
推荐看下https://www.bilibili.com/video/av31977792?from=search&seid=5301881634338513872任少卿-From Faster R-CNN to Mask R-CNN的视频
该项目是基于初始版本的 Detectron代码做的。
关于github解决慢的情况: git clone的问题.
二、要求
大多数配置至少需要4个GPU,有些还需要8个GPU。可以通过缩小学习速度和扩大迭代时间来在单个GPU上进行训练,可以在单个GPU上进行测试。不可在CPU上运行。
三、安装
建议用annaconda,它安装 caffe2 and other ops比较简便些.下载项目:
```bash
$ git clone https://github.com/facebookresearch/DetectAndTrack.git
$ cd DetectAndTrack
```
- 先决条件和软件设置(加黑为必须,nccl装caffe2时候也装一下)
The code was tested with the following setup:
0. CentOS 6.5/ubuntu
1. Anaconda (python 2.7)
2. OpenCV 3.4.1
3. GCC 4.9
4. CUDA 9.0//我是CUDA 8.0
5. cuDNN 7.1.2cmake版本最低要求 3.2
6. numpy 1.14.2 (needs >=1.12.1, for the [poseval]evaluation scripts)
7. cmake>= 3.2
也就是需要安装[poseval]evaluation scripts
- [`all_pkg_versions.txt`]包含应该使用此代码的软件包的确切版本。 为了避免冲突包,建议在conda中创建一个新环境,并在那里安装所有需求。 它可以通过以下方式完成:可查看conda虚拟环境。如果根据作者的指令会出现错误(见末尾已知错误)。
```bash $ export ENV_NAME="detect_and_track" # or any other name you prefer $ conda create --name $ENV_NAME --file /home/vivian/HelloWorld/tracker/DetectAndTrack/all_pkg_versions.txt python=2.7 anaconda #你的地址 $ source activate $ENV_NAME ``` #一些指令 1.查看已建好的环境 conda info --envs 2.对虚拟环境中安装额外的包。 即可安装package到your_env_name中 conda install -n your_env_name [package] #例如numpy : conda install --name detect_and_track numpy #也可以激活虚拟环境后,直接conda install numpy 4.激活或停用 # To activate this environment, use $ conda activate detect_and_track $ source activate detect_and_trac $ source activate $ENV_NAME (也可以) # To deactivate an active environment, use # $ source deactivate # $ conda deactivate 5.复制虚拟环境(在detect_and_track安装caffe2后,怕出新的错误 先复制个新环境.但pip安装的包不会复制) conda create -n caffe2 --clone detect_and_track
还有个参考安装方法:$ conda create --name $ENV_NAME --file all_pkg_versions.txt python=2.7 anaconda -c conda-forge
- [Caffe2]、[caffe2 安装说明](又需要安装 [pytorch] 了)(要是按方法②安装ops,先下一步再编译caffe2)
2) Ubuntu14.04配置Detectron,及问题解决
- [ COCO API ] 用COCO API读取 train/test文件,
要把cocoapi的路径放进环境变量???
```bash
$ # COCOAPI=/path/to/clone/cocoapi
$ git clone https://github.com/cocodataset/cocoapi.git $COCOAPI
$ cd $COCOAPI/PythonAPI
$ # Install into global site-packages
$ make install
$ # Alternatively, if you do not have permissions or prefer
$ # not to install the COCO API into global site-packages
$ python2 setup.py install --user
```
执行import pycocotools和from pycocotools.coco import COCO命令不报错说明已经安装成功了
- 编译自定义操作(detectron ops,)
需要一个额外的OP(以`lib/ops/affine_channel_nd_op.*`的形式提供)来运行3D模型,[安装说明]
方法①:因为之前txt文件安装了依赖了,直接到项目目录下执行安装就好.可能会出现protoc版本新旧等等的问题,
如果没问题就算了,不然安装前最好改一下cmakelist.txt文件.Ubuntu14.04配置Detectron,及问题解决
```bash
$ cd ../DetectAndTrack/lib #这里看出来caffe2是和detectandtrack同级的,你可以改成自己的绝对路径
$ make && make ops
$ cd ..
$ python tests/test_zero_even_op.py # test that compilation worked
```
方法②:将`lib/Ops/affine_Channel_nd_op.*‘文件复制到(`caffe2/modules/detectron/`),并重新编译caffe2。这也将使caffe2可以增加OP,编译caffe2。将使caffe2增加OP。pytorch/modules/detectron/
方法③:阅读 [FAQ]。然后为构建自定义操作符(building custom operators)提供cmake支持。所有自定义操作符都内置到一个库中,该库可以从python动态加载。将custom operator implementation放在detectron/ops/ 下,示例:
# DETECTRON=/path/to/clone/detectron
git clone https://github.com/facebookresearch/detectron $DETECTRON
#Install Python dependencies:
pip install -r $DETECTRON/requirements.txt
#Set up Python modules:# 构建自定义操作符库:
cd $DETECTRON && make
#Check that Detectron tests pass (e.g. for SpatialNarrowAsOp test):
python $DETECTRON/detectron/tests/test_spatial_narrow_as_op.py
#我用的下面指令
git clone https://github.com/facebookresearch/detectron $DETECTRON
pip install -r detectron/requirements.txt
cd detectron && make
python detectron/tests/test_spatial_narrow_as_op.py
detectron$ python detectron/tests/test_spatial_narrow_as_op.py
[E init_intrinsics_check.cc:43] CPU feature avx is present on your machine, but the Caffe2 binary is not compiled with it. It means you may not get the full speed of your CPU.
[E init_intrinsics_check.cc:43] CPU feature avx2 is present on your machine, but the Caffe2 binary is not compiled with it. It means you may not get the full speed of your CPU.
[E init_intrinsics_check.cc:43] CPU feature fma is present on your machine, but the Caffe2 binary is not compiled with it. It means you may not get the ful