SparseInst实例测试(含cuda10.1、pytorch1.8、detectron2安装过程)

环境配置

  • ubuntu 20.04
  • cuda10.1
  • torch1.8

手动安装cuda10.1及相关pytorch

因为国内源找不到cuda10.1的版本,只好去手动下载,再上传至服务器,安装指令: pip install xxxxxxxxxx(包名)

  • 官网链接:https://download.pytorch.org/whl/torch_stable.html
  • 找到自己的包下载至同一个自定义文件夹(上传至服务器),如图:
    在这里插入图片描述

安装detectron2

激活服务器conda虚拟环境,找到跟自己cuda以及torch匹配的detectron2版本,在服务器项目文件夹下,进行一键下载

  • 官方文档: https://detectron2-zhcn.readthedocs.io/zh-cn/latest/tutorials/install.html#detectron2-linux
    在这里插入图片描述

下载SparseInst模型

  • 官网链接: https://github.com/hustvl/SparseInst?tab=readme-ov-file
  • 下载模型相应的训练权重(访问google需要梯子,自行解决):
    在这里插入图片描述

运行测试SparseInst模型效果

  • configs配置
_BASE_: "Base-SparseInst.yaml"
MODEL:
  WEIGHTS: "pth/sparse_inst_r50vd_dcn_giam_aug_640.pth"
  BACKBONE:
    FREEZE_AT: 0
    NAME: "build_resnet_vd_backbone"
INPUT:
  CROP:
    ENABLED: True
    TYPE: "absolute_range"
    SIZE: (384, 600)
  MASK_FORMAT: "polygon"
OUTPUT_DIR: "result"

在这里插入图片描述

用梯子在github下载好SparseInst的权重模型后,将自己下载的权重上传至服务器,我这里下载了三个权重
在这里插入图片描述

安装好上述环境后,这里没有进行训练,直接找了张图片进行测试, 服务器终端运行下面这一条指令

python demo.py 
--config-file configs/sparse_inst_r50vd_giam_aug.yaml 
--input Data/images/people.jpg 
--output results 
--opt MODEL.WEIGHTS pth/sparse_inst_r50vd_dcn_giam_aug_640.pth 
INPUT.MIN_SIZE_TEST 512

  • 测试效果
    在这里插入图片描述

Bug解决

运行实例测试过程中遇到的bug,供参考

  • AttributeError: module ‘PIL.Image’ has no attribute ‘LINEAR’
  • 解决办法:pillow版本降级
pip uninstall Pillow
pip install Pillow==8.4.0

  • numPy版本需要降级至numpy==1.xx.xx版本
pip install numpy==1.21.5
  • 其他缺少的 OpenCV、spicy包,直接pip安装即可
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值