美文网首页
计算机视觉-mmdection训练coco数据集

计算机视觉-mmdection训练coco数据集

作者: xuanxi | 来源:发表于2021-04-11 17:28 被阅读0次

    open-mmlab安装环境版本

    cuda = 10.1

    python = 3.7.10

    pytorch = 1.6.0

    mmcv-full = 1.2.4

    mmdet = 2.11.0

    conda 创建环境

    >conda remove -n open-mmlab --all

    >conda create -n open-mmlab python=3.7 -y

    >conda activate open-mmlab

    出现如下错误:

    解决方式:

    >echo "conda activate" >> ~/.bashrc

    >source ~/.bashrc

    安装pytorch

    我安装的是稳定版本的pytorch=1.7.1。pytorch的安装过程如下:

    >conda install pytorch torchvision torchaudio cudatoolkit=10.1

    出现如下错误:

    解决方法:

    >anaconda search -t conda lifelines

    找到合适的版本,py37。选择最后一个 改名字,注意vfonov lifelines之间没有/

    >conda install -c https://conda.anaconda.org/vfonov lifelines

    还是不行,尝试用pip安装

    > pip install pytorch torchvision torchaudio cudatoolkit==10.1

    最后查阅进pytorch的官网:

    >pip install torch==1.6.0+cu101 torchvision==0.7.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html --user

    安装mmcv

    >pip install mmcv-full==1.2.4-fhttps://download.openmmlab.com/mmcv/dist/cu101/torch1.6.0/index.html

    安装mmdetection

    >git clone https://github.com/open-mmlab/mmdetection.git

    >cd mmdetection

    git克隆慢的解决方法:https://blog.csdn.net/qq_27006271/article/details/110098578

    然后继续编译mmdeteion

    >pip install -r requirements/build.txt

    >pip install -v  -e .# or "python setup.py develop"

    至此mmdetection的安装完成,如果还有一些问题,那就需要安装一些mmcv的依赖包然后再编译一下,看看是否可行。

        pip install addict -i https://pypi.tuna.tsinghua.edu.cn/simple

        pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple

        pip install pyyaml -i https://pypi.tuna.tsinghua.edu.cn/simple

        pip install yapf -i https://pypi.tuna.tsinghua.edu.cn/simple

        pip install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple

        pip install pytest -i https://pypi.tuna.tsinghua.edu.cn/simple

        pip install -v -e . -i https://pypi.tuna.tsinghua.edu.cn/simple

    测试用的代码

    先敲python,然后测试

    查看torch的版本

        >import torch, torchvision

        >print(torch.__version__, torch.cuda.is_available())

    查看mmdet的版本

        >import mmdet

        >print(mmdet.__version__)

    查看mmcv 的版本

        >from mmcv.ops import get_compiling_cuda_version, get_compiler_version

        >print(get_compiling_cuda_version())

        >print(get_compiler_version())

    现有模型进行推断

    Faster RCNN

    以 R-50-FPN 为例,下载其model文件到mmdetection/checkpoints/。之后,进行推断,

    参考:https://segmentfault.com/a/1190000038901219(这个链接非常好! 完全适用,没有报错!)

    coco数据集下载:https://bendfunction.gitbook.io/dataset-download/

    复制到迅雷进行下载,按照上文连接,存放数据集位置

    打开配置文件:mmdection/configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py

    改学习率:mmdetection/configs/_base_/schedules/schedule_1x.py

    相关文章

      网友评论

          本文标题:计算机视觉-mmdection训练coco数据集

          本文链接:https://www.haomeiwen.com/subject/lzrnkltx.html