detectron2訓練自己的數據實現目標檢測和關鍵點檢測——ubuntu18.04安裝測試detectron2
1. 配置
基本配置 | 版本號 |
---|---|
CPU | Intel® Core™ i5-8400 CPU @ 2.80GHz × 6 |
GPU | GeForce RTX 2070 SUPER/PCIe/SSE2 |
OS | Ubuntu18.04 |
python | 3.6.9 |
gcc | 5.5 |
g++ | 5.5 |
cuda | 10.0 |
pytorch | 1.5 |
1.1 環境要求
根據官網的提示, 環境有以下的幾個要求:
- Python ≥ 3.6
- PyTorch ≥ 1.4
- torchvision that matches the PyTorch installation.
- pycocotools.
- OpenCV, optional, needed by demo and visualization
2. 環境安裝
2.1 torch 和 torchvision
pip install --pre torch torchvision -f https://download.pytorch.org/whl/nightly/cu100/torch_nightly.html
因爲我的cuda版本是10.0, 所以選擇這個下載, 去https://pytorch.org/下載適合自己的版本.
2.2 cocoapi (pycocotools)
pip install cython
git clone https://github.com/cocodataset/cocoapi.git
cd cocoapi/PythonAPI
python setup.py build_ext install
2.3 下載安裝detectron2
git clone https://github.com/facebookresearch/detectron2.git
cd detectron2
python -m pip install -e .
3. 測試detectron2
在detectron2/demo文件夾下
python demo.py --config-file ../configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml --input 11.jpg --opts MODEL.WEIGHTS detectron2://COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x/137849600/model_final_f10217.pkl
自動下載的預訓練權重放在 .torch/fvcore_cache/detectron2/COCO-InstanceSegmentation/下
如果網速過慢, 可以網頁上下載之後放在本地, 指定固定的路徑.
接下來開始製作自己的數據集並且完成目標檢測和關鍵點檢測的訓練, ,見我的下一個博客
detectron2訓練自己的數據實現目標檢測和關鍵點檢測(二) 製作轉換自己的數據集
參考:
https://github.com/facebookresearch/detectron2/blob/master/INSTALL.md
https://www.cnblogs.com/jiajiewu/p/12822267.html
https://blog.csdn.net/linghu8812/article/details/105701408
https://www.aiuai.cn/aifarm1288.html