当前位置: 首页 > news >正文

【可变形卷积3】 DCNv2 安装

使用RTM3D 代码,CenterTrack代码需要用DCN

1、安装DCNv2

  • (1)github上最新版的DCNv2源码在"https://github.com/CharlesShang/DCNv2",但是该版本源码不支持PyTorch1.7,如果使其支持PyTorch1.7需要做以下修改:
    将DCNv2/src/cuda/dcn_v2_cuda.cu中所有的THCState_getCurrentStream(state)替换成c10::cuda::getCurrentCUDAStream()。

  • (2)github上有支持PyTorch1.7的源码,“https://github.com/lbin/DCNv2/tree/pytorch_1.7”,可以直接使用。

2、 Deformable Convolutional Networks V2 with Pytorch 1.0,不支持PyTorch1.7

Build

    ./make.sh         # buildpython test.py    # run examples and gradient check 

An Example

  • deformable conv
    from dcn_v2 import DCNinput = torch.randn(2, 64, 128, 128).cuda()# wrap all things (offset and mask) in DCNdcn = DCN(64, 64, kernel_size=(3,3), stride=1, padding=1, deformable_groups=2).cuda()output = dcn(input)print(output.shape)
  • deformable roi pooling
    from dcn_v2 import DCNPoolinginput = torch.randn(2, 32, 64, 64).cuda()batch_inds = torch.randint(2, (20, 1)).cuda().float()x = torch.randint(256, (20, 1)).cuda().float()y = torch.randint(256, (20, 1)).cuda().float()w = torch.randint(64, (20, 1)).cuda().float()h = torch.randint(64, (20, 1)).cuda().float()rois = torch.cat((batch_inds, x, y, x + w, y + h), dim=1)# mdformable pooling (V2)# wrap all things (offset and mask) in DCNPoolingdpooling = DCNPooling(spatial_scale=1.0 / 4,pooled_size=7,output_dim=32,no_trans=False,group_size=1,trans_std=0.1).cuda()dout = dpooling(input, rois)

Note

Now the master branch is for pytorch 1.0 (new ATen API), you can switch back to pytorch 0.4 with,

git checkout pytorch_0.4

3、pytorch代码

https://github.com/HiYx/pytorch-deform-conv-v2

4、mmdet 的DCN

可以直接使用mmdet 的DCN。

5、附录


在这里插入图片描述


在这里插入图片描述

6、可参考

https://blog.csdn.net/wangxiao7474/article/details/113605230

http://www.lryc.cn/news/129338.html

相关文章:

  • 归并排序 与 计数排序
  • 机器学习之逻辑回归
  • 操作符详解上(非常详细)
  • React 高阶组件(HOC)
  • 【NepCTF2023】复现
  • 大文件切片上传
  • ubuntu切换python版本
  • docker 安装 elasticsearch、kibana 7.4.2
  • 【es6】函数参数设置默认值
  • Pytest和Unittest测试框架的区别?
  • C#基础知识(一)
  • 我还不知道?Android组件化插件化模块化
  • 借助 AI 工具,真的能成为 10x 工程师?
  • TypeScript 面向对象
  • k8s 中快速启动curl pod 做api test
  • 神经网络基础-神经网络补充概念-56-迁移学习
  • 力扣:65. 有效数字(Python3)
  • 003-Spring boot 启动流程分析
  • 中间件的介绍
  • LVS-DR模式下(RS检测)ldirectord工具实现部分节点掉点后将请求发往正常设备进行处理
  • c++游戏制作指南(四):c++实现数据的存储和读取(输入流fstream)
  • 如何使用CSS实现一个响应式视频播放器?
  • Typora上传文件到Gitee
  • 系统架构设计师---2017年下午试题1分析与解答(试题三)
  • 从零搭建vue + element-plus 项目
  • 原码、补码、反码
  • 煤矿调度IP语音对讲广播模块一键求助对讲矿用调度通信系统SIP语音对讲求助终端
  • 堆 和 优先级队列(超详细讲解,就怕你学不会)
  • AIGC绘画:基于Stable Diffusion进行AI绘图
  • python实现对Android系统手机亮度的调节