Swin-Transformer-Object-Detection运行环境的搭建

    swin transformer的表现就不用多说了,简单记录其目标检测的运行环境搭建过程。
在这里插入图片描述

创建Pycharm工程

在这里插入图片描述

现在虚拟环境中只有以下几个包
在这里插入图片描述

github下载源码

https://github.com/SwinTransformer/Swin-Transformer-Object-Detection

复制源码到项目中
在这里插入图片描述

安装第三方库

conda install pytorch==1.7.1 torchvision==0.8.2 cudatoolkit=10.1 -c pytorch
pip install timm==0.3.2

pycocotools的安装(后来发现用不到)

pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
pip install -r requirements.txt    
pip install mmcv-full==1.2.4

这步安装时间比较长,长时间停在:Building wheel for mmcv-full (setup.py) …

pip install -v -e .

注意后面有个点

python setup.py develop

新建weights文件夹,用于放置权重文件
在这里插入图片描述

在这里插入图片描述

运行测试代码

python demo/image_demo.py demo/demo.jpg configs/swin/mask_rcnn_swin_tiny_patch4_window7_mstrain_480-800_adamw_3x_coco.py weights/mask_rcnn_swin_tiny_patch4_window7.pth
  • 如果没有出图,看最后面的问题及参考的Q2

运行效果

在这里插入图片描述

问题及参考

Q1:TypeError: MaskRCNN: SwinTransformer: init() got an unexpected keyword argument ‘embed_dim’:
A1:https://blog.csdn.net/weixin_44777827/article/details/122310873

Q2:UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
A2:https://blog.csdn.net/qq_41073715/article/details/105033751
添加如下代码

import matplotlib
matplotlib.use('TkAgg')

在这里插入图片描述

视频参考:https://www.bilibili.com/video/BV1KS4y1g7pc?spm_id_from=333.999.0.0

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

维度攻城狮

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值