Deformable DETR环境配置和应用

准备工作:
Deformable DETR代码路径如下:

GitHub - fundamentalvision/Deformable-DETR: Deformable DETR: Deformable Transformers for End-to-End Object Detection.Deformable DETR: Deformable Transformers for End-to-End Object Detection. - GitHub - fundamentalvision/Deformable-DETR: Deformable DETR: Deformable Transformers for End-to-End Object Detection.https://github.com/fundamentalvision/Deformable-DETR

论文路径如下:

https://arxiv.org/abs/2010.04159icon-default.png?t=M4ADhttps://arxiv.org/abs/2010.04159这里如果想要更好的理解deformable detr可以先将transform的论文看一下,deformable detr是detr的改良版本。在本文中,我是用deformable detr作为目标检测的工具。代码中并没有利用此算法进行目标检测的demo,因此借鉴一些大佬的代码实现了一下。

环境配置:

我是在学校的服务器中使用anaconda配置的环境。

创建python环境:

conda create -n deformable_detr python=3.7 pip

激活环境:

conda activate deformable_detr

接下来安装pytorch,此代码要求PyTorch>=1.5.1, torchvision>=0.6.1。

我的CUDA的版本是10.1,因此在如下网址中找到相应的运行的命令。

PyTorch An open source machine learning framework that accelerates the path from research prototyping to production deployment.https://pytorch.org/

 点击黄色划线查找以前的pytorch的版本。

我使用的是轮子加速的安装方式:如上图所示。pytorch和CUDA的版本需要对应,否则会出现运行错误。

其他的安装库:

pip install -r requirements.txt

 到这里环境基本已经安装成功了,后面如果自己加代码室友detr的话,可能会报缺少某某库的问题,直接百度搜索安装教程,都很简单。

编译cuda操作。

cd ./models/ops
sh ./make.sh
# unit test (should see all checking is True)
python test.py

 在运行test.py的时候,可能是服务器空间不够了,没有出现所有true,在最后两个测试中出现了“已杀死”错误。

但是发现我在后面使用的过程中并没有有影响和报错。

使用:

需要下载coco数据集:并将文件目录的格式按照如下方式放置:

 COCO 2017 dataset

code_root/
└── data/
    └── coco/
        ├── train2017/
        ├── val2017/
        └── annotations/
        	├── instances_train2017.json
        	└── instances_val2017.json

 我是没有训练,直接使用预训练模型。(前期运行了一下,官网中的train,好像也没有报错,没让他训练完,我就直接中断了)

训练:我将8改为了1,因为我只有一块gpu

GPUS_PER_NODE=8 ./tools/run_dist_launch.sh 8 ./configs/r50_deformable_detr.sh

评估:下载model

 运行命令:

<path to config file> --resume <path to pre-trained model> --eval

path to config file,路径如上图,在代码的configs文件夹下,model要和配置文件一致。

使用deformable detr,进行目标检测:展示

 

结束!!!!!!!

  • 7
    点赞
  • 57
    收藏
    觉得还不错? 一键收藏
  • 42
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值