-
simpledet 的配置
-
1. 通过 docker 配置 simpledet
-
1.1 系统要求
ubuntu16.04
python >=3.5
-
1.2 下载 docker 镜像
匹配的版本为 ubuntu16.04, cuda9.0, cudnn7, python3。
https://gitlab.com/nvidia/cuda/blob/ubuntu16.04/9.0/devel/cudnn7/Dockerfile
-
1.3 运行 docker
nvidia-docker run -v $HOST-SIMPLEDET-DIR:$CONTAINER-WORKDIR -it nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04 bash
-
1.4 安装所需环境
# Install dependency
sudo apt-get update
sudo apt-get install -y build-essential git
sudo apt-get install -y libopenblas-dev
-
1.5 下载 simpledet 和 pycocotools, mxnext 项目
git clone <https://github.com/TuSimple/simpledet.git>
cd /path/to/simpledet
make
# Install a patched cocotools for python3
git clone <https://github.com/RogerChern/cocoapi>
cd cocoapi/PythonAPI
python3 setup.py install
# setup mxnext, a wrapper of mxnet symbolic API
cd /path/to/simpledet
git clone <https://github.com/RogerChern/mxnext>
-
1.6 安装mxnet
# Specify simpledet directory
export SIMPLEDET_DIR=/path/to/simpledet
export COCOAPI_DIR=/path/to/cocoapi
git clone https://github.com/apache/incubator-mxnet mxnet
cd mxnet
git checkout 1.3.1
git submodule init
git submodule update
echo "USE_OPENCV = 0" >> ./config.mk
echo "USE_BLAS = openblas" >> ./config.mk
echo "USE_CUDA = 1" >> ./config.mk
echo "USE_CUDA_PATH = /usr/local/cuda" >> ./config.mk
echo "USE_CUDNN = 1" >> ./config.mk
echo "USE_NCCL = 1" >> ./config.mk
echo "USE_DIST_KVSTORE = 1" >> ./config.mk
cp -r $SIMPLEDET_DIR/operator_cxx/* src/operator/
mkdir -p src/coco_api
cp -r $COCOAPI_DIR/common src/coco_api/
make -j
cd python
python3 setup.py install
-
2. 使用 coco 测试集进行模型测试
-
2.1 下载模型
在 simpledet 目录下新建 experiments 目录,并将下载好的模型(https://github.com/TuSimple/simpledet/tree/master/models/tridentnet)放至该路径下,如
experiments/
tridentnet_r101v2c4_c5_1x/
checkpoint-0006.params
checkpoint-symbol.json
log.txt
coco_minival2014_result.json
- 2.2 构建 coco roidb 测试集,将coco数据集按以下目录结构进行存放
data/
coco/
annotations/
instances_train2014.json
instances_valminusminival2014.json
instances_minival2014.json
image_info_testdev2017.json
images/
train2014
val2014
test2017
- 2.3 执行转换命令,例如:
python3 utils/generate_roidb.py --dataset coco --dataset-split train2014
python3 utils/generate_roidb.py --dataset coco --dataset-split valminusminival2014
python3 utils/generate_roidb.py --dataset coco --dataset-split minival2014
python3 utils/generate_roidb.py --dataset coco --dataset-split test-dev2017
- 2.4 测试
python3 detection_test.py --config config/detection_config.py
-
3. 单张图像的检测
详见 https://github.com/danpe1327/simpledet/blob/master/detect_image.py