【使用jupyter快速跑通yolov5】

不关心yolov5的原理实现,只说怎么跑通代码

第一步 conda install git

就是说没有git,怎么git clone?所以第一步下载git,如果已有可以下一步!
PS:清华源真的下载老是断掉,所以果断换源。
找到conda配置路径直接修改,方便快捷!!!

  1. 在C盘找到下面的文件,以记事本方式打开

    C:\Users[你的用户名].condarc

  2. 删除里面的内容,贴下的源

    北京外国语大学开源软件镜像站

    https://mirrors.bfsu.edu.cn/
    注:**亲测好用!强烈推荐!!!**2020-05-02 上线,清华大学开源软件镜像站的姐妹站,下载体验极佳,再也不用忍受清华源永远下不完的 pytorch 了。

    channels:
      - defaults
    show_channel_urls: true
    channel_alias: https://mirrors.bfsu.edu.cn/anaconda
    default_channels:
      - https://mirrors.bfsu.edu.cn/anaconda/pkgs/main
      - https://mirrors.bfsu.edu.cn/anaconda/pkgs/free
      - https://mirrors.bfsu.edu.cn/anaconda/pkgs/r
      - https://mirrors.bfsu.edu.cn/anaconda/pkgs/pro
      - https://mirrors.bfsu.edu.cn/anaconda/pkgs/msys2
    custom_channels:
      conda-forge: https://mirrors.bfsu.edu.cn/anaconda/cloud
      msys2: https://mirrors.bfsu.edu.cn/anaconda/cloud
      bioconda: https://mirrors.bfsu.edu.cn/anaconda/cloud
      menpo: https://mirrors.bfsu.edu.cn/anaconda/cloud
      pytorch: https://mirrors.bfsu.edu.cn/anaconda/cloud
      simpleitk: https://mirrors.bfsu.edu.cn/anaconda/cloud
    

    上海交通大学开源软件镜像站

    https://mirrors.sjtug.sjtu.edu.cn/

    channels:
      - defaults
    show_channel_urls: true
    channel_alias: https://anaconda.mirrors.sjtug.sjtu.edu.cn/
    default_channels:
      - https://anaconda.mirrors.sjtug.sjtu.edu.cn/pkgs/main
      - https://anaconda.mirrors.sjtug.sjtu.edu.cn/pkgs/free
      - https://anaconda.mirrors.sjtug.sjtu.edu.cn/pkgs/mro
      - https://anaconda.mirrors.sjtug.sjtu.edu.cn/pkgs/msys2
      - https://anaconda.mirrors.sjtug.sjtu.edu.cn/pkgs/pro
      - https://anaconda.mirrors.sjtug.sjtu.edu.cn/pkgs/r
    custom_channels:
      conda-forge: https://anaconda.mirrors.sjtug.sjtu.edu.cn/conda-forge
      soumith: https://anaconda.mirrors.sjtug.sjtu.edu.cn/cloud/soumith
      bioconda: https://anaconda.mirrors.sjtug.sjtu.edu.cn/cloud/bioconda
      menpo: https://anaconda.mirrors.sjtug.sjtu.edu.cn/cloud/menpo
      viscid-hub: https://anaconda.mirrors.sjtug.sjtu.edu.cn/cloud/viscid-hub
      atztogo: https://anaconda.mirrors.sjtug.sjtu.edu.cn/cloud/atztogo
    

    阿里巴巴开源软件镜像站

    https://developer.aliyun.com/mirror/

    channels:
      - defaults
    show_channel_urls: true
    default_channels:
      - http://mirrors.aliyun.com/anaconda/pkgs/main
      - http://mirrors.aliyun.com/anaconda/pkgs/r
      - http://mirrors.aliyun.com/anaconda/pkgs/msys2
    custom_channels:
      conda-forge: http://mirrors.aliyun.com/anaconda/cloud
      msys2: http://mirrors.aliyun.com/anaconda/cloud
      bioconda: http://mirrors.aliyun.com/anaconda/cloud
      menpo: http://mirrors.aliyun.com/anaconda/cloud
      pytorch: http://mirrors.aliyun.com/anaconda/cloud
      simpleitk: http://mirrors.aliyun.com/anaconda/cloud
    

    清华大学开源软件镜像站

    https://mirror.tuna.tsinghua.edu.cn/

    channels:
      - defaults
    show_channel_urls: true
    channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
    default_channels:
      - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
      - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
      - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
      - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
      - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
    custom_channels:
      conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
      msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
      bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
      menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
      pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
      simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
    
  3. 跟换好源后,在jupyter中新建终端下载

    conda install git
    

【使用jupyter快速跑通yolov5】
(以下执行命令均在terminal中执行)

第二步 git clone yolov5

这里用的也是github镜像(github.com.cnpmjs.org)

git clone https://github.com.cnpmjs.org/Whiffe/yolov5-deepsort.git

切换到克隆的文件夹下

cd yolov5-deepsort

安装需要的环境

pip install -r requirements.txt

运行代码

python demoX.py

其中yolov5-deepsort中test.mp4即为我们要检测的视频,最后会生成result.mp4作为结果。
如需要更换测试视频,只需要在demoX.py文件中cap = cv2.VideoCapture(’./test.mp4’)修改

运行时问题汇总

  1. RuntimeError: “unfolded2d_copy“ not implemented for ‘Half‘

检测模块中AIDetector_pytorch.py的.half()全部改成.float()
【使用jupyter快速跑通yolov5】

  1. 错误:OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.
    允许副本存在,python程序中添加
    import os
    os.environ['KMP_DUPLICATE_LIB_OK'] = 'TRUE'
    

参考:
[1]: https://blog.csdn.net/weixin_43667077/article/details/106521015
[2]: https://www.cnblogs.com/KdeS/p/14677169.html
[3]: https://blog.csdn.net/m0_50736744/article/details/121799432
[4]: https://blog.csdn.net/WhiffeYF/article/details/121346483

上一篇:Ielts - writting(3)


下一篇:Presto实现原理(转)