安装mmdetection(windows下)

这篇具有很好参考价值的文章主要介绍了安装mmdetection(windows下)。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

使用mmdetection最好使用linux系统
使用windows系统,用最佳实践去安装遇到了问题
安装mmdetection(windows下)
安装mmdetection(windows下)

下面是正确的windows安装方案

创建pytorch环境

mmdetection是基于PyTorch、CUDA环境来安装的,所以首先得安装深度学习pytorch环境、参考我的这篇pytorch环境安装文档

这里,我拷贝pt17环境为mmdetection
安装mmdetection(windows下)


之后我重装系统了,得重新安装了
过程如下
先确定需要安装的版本信息:
安装mmdetection(windows下)
安装mmdetection(windows下)

  1. 先安装pytorch
    安装mmdetection(windows下)
    安装mmdetection(windows下)
pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html

查看当前python版本
安装mmdetection(windows下)
安装虚拟环境

conda create -n pt18 python=3.8

安装mmdetection(windows下)
激活虚拟环境
安装mmdetection(windows下)
安装pytorch

如果下载慢可以配置pip.ini
安装mmdetection(windows下)

[global]
index-url = http://pypi.mirrors.ustc.edu.cn/simple
[install]
use-mirrors =true
mirrors =http://pypi.mirrors.ustc.edu.cn/simple/
trusted-host =pypi.mirrors.ustc.edu.cn

安装mmdetection(windows下)
安装mmdetection(windows下)

安装mmdetection(windows下)

最终安装的版本信息

显卡:RTX 2080 ti
系统:Windows 10
cuda:11.1
cudnn:8.0.4.30
pytorch:1.8.0
torchvision:0.9.0
mmcv-full:
mmdetection:


查看cuda版本号:在cmd中键入:nvcc --version即可

安装过程

注意:以下安装都是在具体某一虚拟环境下的! 所以记得先在cmd中激活环境进入后再安装(我是安装在mmdetection虚拟环境下的)

step1:安装mmcv-full

mmcv是mm系列的底层支持,包括安装mmclassification、mmsegmentation都会使用到mmcv,这里有两个安装版本,一个是简化的版本mmcv,一个是完整的版本mmcv-full,完整的版本中包含了大量的算子,GPU下最好还是安装这个完整的版本,安装命令如下:

pip install mmcv==2.0.0rc3 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.8/index.html

安装mmdetection(windows下)

版本参考文献

Failed building wheel for mmcv-full
注意: 如果已经安装了 mmcv,首先需要使用 pip uninstall mmcv 卸载已安装的 mmcv,如果同时安装了 mmcv 和 mmcv-full,将会报 ModuleNotFoundError 错误。

安装mmdetection(windows下)
这里我克隆pt18环境为mmdetection然后安装

安装mmdetection(windows下)
成功安装mmcv2
安装mmdetection(windows下)
测试是否安装成功的代码:

import numpy as np
import torch

from mmcv.ops import box_iou_rotated
from mmcv.utils import collect_env


def check_installation():
    """Check whether mmcv has been installed successfully."""
    np_boxes1 = np.asarray(
        [[1.0, 1.0, 3.0, 4.0, 0.5], [2.0, 2.0, 3.0, 4.0, 0.6],
         [7.0, 7.0, 8.0, 8.0, 0.4]],
        dtype=np.float32)
    np_boxes2 = np.asarray(
        [[0.0, 2.0, 2.0, 5.0, 0.3], [2.0, 1.0, 3.0, 3.0, 0.5],
         [5.0, 5.0, 6.0, 7.0, 0.4]],
        dtype=np.float32)
    boxes1 = torch.from_numpy(np_boxes1)
    boxes2 = torch.from_numpy(np_boxes2)

    # test mmcv with CPU ops
    box_iou_rotated(boxes1, boxes2)
    print('CPU ops were compiled successfully.')

    # test mmcv with both CPU and CUDA ops
    if torch.cuda.is_available():
        boxes1 = boxes1.cuda()
        boxes2 = boxes2.cuda()
        box_iou_rotated(boxes1, boxes2)
        print('CUDA ops were compiled successfully.')
    else:
        print('No CUDA runtime is found, skipping the checking of CUDA ops.')


if __name__ == '__main__':
    print('Start checking the installation of mmcv ...')
    check_installation()
    print('mmcv has been installed successfully.\n')

    env_info_dict = collect_env()
    env_info = '\n'.join([(f'{k}: {v}') for k, v in env_info_dict.items()])
    dash_line = '-' * 60 + '\n'
    print('Environment information:')
    print(dash_line + env_info + '\n' + dash_line)

安装mmdetection(windows下)
安装mmdetection(windows下)
安装mmdetection(windows下)

step2:安装mmdetection

拷贝虚拟环境

安装mmdetection(windows下)

安装mmdetection(windows下)

如果电脑上没有下载安装过git工具的话,是无法执行第一条命令的!所以我就直接在github上下载了最新版本的mmdetection包,然后依次执行的剩下两行命令。过程如下:

pip install -r requirements/build.txt   
pip install -v -e .

安装mmdetection(windows下)
然后遇到问题
安装mmdetection(windows下)

安装mmdet报错:Could not build wheels for pycocotools, which is required to install pyproject.toml-based projects

ERROR: Could not build wheels for pycocotools, which is required to install pyproject.toml-based projects

因为在安装mmdet时需要安装的相关库pycocotools无法安装,直接pip install pycocotools也会报错,具体原因不明

解决方法;
anaconda中给出建议可以上网站https://anaconda.org中进行搜索pycocotools后发现有人上传过这个包,因此在anaconda prompt 上执行以下四个命令之一先安装pycocotools

conda install -c conda-forge pycocotools
conda install -c "conda-forge/label/gcc7" pycocotools
conda install -c "conda-forge/label/cf201901" pycocotools
conda install -c "conda-forge/label/cf202003" pycocotools

在执行一次安装命令
安装mmdetection(windows下)

pip install -v -e .

安装mmdetection(windows下)
成功安装mmdetection

验证mmdetection是否可用

import mmdet
print(mmdet.__version__)

安装mmdetection(windows下)
mmcv和mmdetection版本不对应。。。

MMDetection,MMEngine 和 MMCV 的版本兼容关系如下。请选择合适的版本避免安装错误

安装mmdetection(windows下)
我最高只能下载rc5的代码
安装mmdetection(windows下)
安装mmdetection(windows下)
安装mmdetection(windows下)

安装mmdetection(windows下)
再来测试

安装mmdetection(windows下)

成功安装

进行推理测试
先下载faster rcnn权重
faster rcnn权重下载地址

更多权重目录
权重文件地址

python demo/image_demo.py demo/demo.jpg configs\faster_rcnn\faster-rcnn_r50_fpn_1x_coco.py checkpoints/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth

报错:

安装mmdetection(windows下)
在原本的测试代码中加入:

import os

os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"

安装mmdetection(windows下)
成功

配置cuda11.1环境

参考文章文章来源地址https://www.toymoban.com/news/detail-509271.html

参考文章

参考文章

参考文章

到了这里,关于安装mmdetection(windows下)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Windows 使用 Linux 子系统,轻轻松松安装多个linux

    简称WSL,是一个在Windows 1011上能够运行原生Linux二进制可执行文件(ELF格式)的兼容层。它是由微软与Canonical公司合作开发,其目标是使纯正的Ubuntu、Debian等映像能下载和解压到用户的本地计算机,并且映像内的工具和实用工具能在此子系统上原生运行。如果使用Windows10 2004以

    2024年02月14日
    浏览(35)
  • Linux中_使用wine_软件_安装使用windows软件

    如果文件内容正确,可以将其复制到~/.local/share/applications目录中,以使其在应用程序菜单中可见。 如果还不行,可以尝试使用chmod命令赋予该文件执行权限,并使用./文件名运行该文件,运行exe软件。

    2024年02月09日
    浏览(28)
  • docker安装并使用国内源(Linux、Windows、macOS)

    Windows系统安装Docker并配置国内源 安装 Docker Desktop : 访问Docker官网(https://www.docker.com/products/docker-desktop)下载适用于Windows的Docker Desktop安装包并安装。 配置国内镜像源 : 在Docker Desktop中点击顶部菜单栏的“ whale icon - Preferences - Daemon”(Windows旧版本可能是“Settings”)。 在

    2024年04月22日
    浏览(25)
  • 压测工具JMeter——安装与使用(Windows、Mac、Linux)

    目录 简单介绍: 下载与安装 下载地址 mac 版本 windows版本 linux版本 压测使用 HTTP协议GET请求 添加线程组 ​编辑添加取样器  GET请求 填写压测地址信息 添加观察压测结果项 添加查看结果树   添加聚合报告 配置压测信息 参数介绍 5个线程 压测 20000次样例 5个线程 压测 30秒样

    2024年02月05日
    浏览(34)
  • Windows 下使用 WSL 安装 Kali Linux 子系统

    使用 WSL 安装 Kali,方便快捷使用。 类似于 Cygwin 不过听说通过 WSL 安装的做了隔离,不能够访问硬件,也就无法进行硬件相关的渗透,具体有待核实。 环境:Windows 10 21H2 教育版 参考:

    2024年02月04日
    浏览(40)
  • Windows 自带的 Linux 子系统(WSL)安装与使用

    WSL官网安装教程: https://learn.microsoft.com/zh-cn/windows/wsl/install Windows 自带的Linux子系统,比用VM什么的香太多了。可以自己看官方教程,也可以以下步骤完成。 如果中间遇到我没遇到的问题百度,可以在评论区评论,或者自己百度其他教程解决。 搜索powerShell, 然后右键以管理

    2024年02月21日
    浏览(39)
  • 白盒代码审计工具——CodeQL安装与使用教程【Linux+Windows】

    该文章参考以下文章,总结提炼而成: CodeQL从入门到放弃 白盒审计工具codeql的安装(踩坑) CodeQL基础知识 Github为了解决其托管的海量项目的安全性问题,收购了CodeQL的创业公司,并宣布 开源CodeQL的规则 部分,这样全世界的安全工程师就可以贡献高效的QL审计规则给Github,

    2024年02月02日
    浏览(26)
  • C语言单元测试框架——CUnit 安装(windows和Linux)及使用

    昨天把软件测试基础基本上看完了,因为我最近工作问题,需要着重研究下Cunit这个单元测试框架,上午把之前学的基础整理出来了。 刚刚研究了下Cunit除了基本 (Basic)接口,还有三个接口没使用过,我也会经量都尝试下。 下个星期我的任务是写一个墨水屏的驱动,测试的学

    2024年02月09日
    浏览(31)
  • 安卓投屏神器 Scrcpy 安装与使用(支持 Mac、Windows、Linux)

    Scrcpy 可以在电脑上通过无线投屏操作安卓手机对于测试安卓设备非常方便,省去了电脑到安卓设备端来回奔波。 它支持将 Android 设备屏幕投放到 Windows 、 macOS 或 Linux 上。 安装 Scrcpy ,各平台安装方式 Windows - 64位 - 官方下载地址 Windows - 32位 - 官方下载地址 Linux: 执行 $ ap

    2024年02月08日
    浏览(28)
  • 【WSL】使用WSL在Windows上安装Linux(Ubuntu20.04)

    本文将介绍在win11系统下使用Windows自带的WSL功能安装Ubuntu20.04子系统,其中WSL2本质仍是基于Hyper-V的虚拟机。 Windows11 + WSL2 + Ubuntu20.04 (WSL译为适用于 Linux 的 Windows 子系统) 在Windows设置中添加可选功能,勾选 适用于Linux的Windows子系统(即WSL) 和 虚拟机平台 ,开启该功能需重

    2024年02月12日
    浏览(39)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包