detectron2训练自己的数据实现目标检测和关键点检测(一) ubuntu18.04安装测试detectron2

    技术2022-07-17  75

    detectron2训练自己的数据实现目标检测和关键点检测——ubuntu18.04安装测试detectron2

    1. 配置1.1 环境要求 2. 环境安装2.1 torch 和 torchvision2.2 cocoapi (pycocotools)2.3 下载安装detectron2 3. 测试detectron2

    1. 配置

    基本配置版本号CPUIntel® Core™ i5-8400 CPU @ 2.80GHz × 6GPUGeForce RTX 2070 SUPER/PCIe/SSE2OSUbuntu18.04python3.6.9gcc5.5g++5.5cuda10.0pytorch1.5

    1.1 环境要求

    根据官网的提示, 环境有以下的几个要求:

    Python ≥ 3.6PyTorch ≥ 1.4torchvision 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

    Processed: 0.010, SQL: 9