配置yolov5时遇到的一些问题和解决方案

本人用的是cuda11.3,未用conda,时间2022.4.3

1.不要直接在cmd里输入pip install pytorch,这样安装的pytorch是cpu版本

可以pip uninstall pytorch卸载了

应该用

pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113

2.如果有python的虚拟环境,需要在该虚拟环境下文件夹下打开cmd再安装

3.在pycharm的terminal中安装pytorch和pytorchvision遇到UnicodeDecodeError: 'gbk' codec can't decode byte 0x98 in position 1027: illegal multibyte sequence

需要在Windows里的cmd安装(配合2)

4.运行detect.py遇到NotImplementedError: Could not run 'torchvision::nms' with arguments from the 'CUDA' backend. This could be because the operator doesn't exist for this backend, or was omitted during t
he selective/custom build process (if using custom build). If you are a Facebook employee using PyTorch on mobile, please visit https://fburl.com/ptmfixes for possible resolutions. 'to
rchvision::nms' is only available for these backends: [CPU, QuantizedCPU, BackendSelect, Python, Named, Conjugate, Negative, ZeroTensor, ADInplaceOrView, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, AutogradLazy, AutogradXPU, AutogradMLC, AutogradHPU, Tracer, AutocastCPU, Autocast, Batched, VmapMode, Functionalize].

卸载pytorch:pip uninstall pytorch(配合2)

重新安装

pytorchvision0.12.0+cu113(配合1、2)

pip install torchvision==0.12.0+cu113 -f https://download.pytorch.org/whl/torch_stable.html

 

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
使用conda安装和配置YOLOv4的过程如下所示: 1. 创建和激活虚拟环境: - 打开命令行终端(Windows用户可能需要以管理员身份运行)。 - 输入以下命令创建一个新的conda环境并激活它: ``` conda create --name yolo_env python=3.7 conda activate yolo_env ``` 2. 安装依赖项: - 在激活的环境中,使用以下命令安装必要的依赖项: ``` conda install numpy opencv matplotlib pillow ``` 3. 克隆YOLOv4仓库: - 使用以下命令克隆YOLOv4的GitHub仓库: ``` git clone https://github.com/AlexeyAB/darknet.git ``` 4. 配置编译参数: - 进入克隆的darknet目录: ``` cd darknet ``` - 打开`Makefile`文件并进行必要的更改: - 将`GPU=0`更改为`GPU=1`(如果你的系统支持GPU加速)。 - 根据你的系统,取消注释并选择合适的`ARCH`参数(例如,`ARCH= -gencode arch=compute_75,code=[sm_75,compute_75]`)。 - 保存并关闭`Makefile`文件。 5. 编译YOLOv4: - 使用以下命令编译YOLOv4: ``` make ``` 6. 下载YOLOv4预训练权重: - 在darknet目录中,使用以下命令下载YOLOv4预训练权重: ``` wget https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v3_optimal/yolov4.weights ``` 7. 运行YOLOv4: - 使用以下命令运行YOLOv4并检测图像(需要将`<image_path>`替换为你要检测的图像路径): ``` ./darknet detector test cfg/coco.data cfg/yolov4.cfg yolov4.weights <image_path> ``` 这些是使用conda安装和配置YOLOv4的基本步骤。请注意,YOLOv4需要一定的计算资源和间来进行编译和运行。如果你遇到任何问题,请参考YOLOv4的官方文档(https://github.com/AlexeyAB/darknet)进行进一步的调试和解决方案。希望对你有所帮助!如有其他问题,请随提问。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值