simpledet 的配置

  • simpledet 的配置

  • 1. 經過 docker 配置 simpledet

  • 1.1 系統要求

    ubuntu16.04python

    python >=3.5git

  • 1.2 下載 docker 鏡像

    匹配的版本爲 ubuntu16.04, cuda9.0, cudnn7, python3。github

    https://gitlab.com/nvidia/cuda/blob/ubuntu16.04/9.0/devel/cudnn7/Dockerfiledocker

  • 1.3 運行 docker

    nvidia-docker run -v $HOST-SIMPLEDET-DIR:$CONTAINER-WORKDIR -it nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04 bashapache

  • 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 下載模型json

    在 simpledet 目錄下新建 experiments 目錄,並將下載好的模型(https://github.com/TuSimple/simpledet/tree/master/models/tridentnet)放至該路徑下,如ubuntu

    experiments/
      tridentnet_r101v2c4_c5_1x/
          checkpoint-0006.params
          checkpoint-symbol.json
          log.txt
          coco_minival2014_result.json
  • 2.2 構建 coco roidb 測試集,將coco數據集按如下目錄結構進行存放api

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.pybash

相關文章
相關標籤/搜索