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

人工智能学习07--pytorch23--目标检测:Deformable-DETR训练自己的数据集

参考

https://blog.csdn.net/qq_44808827/article/details/125326909https://blog.csdn.net/dystsp/article/details/125949720?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_baidulandingword~default-0-125949720-blog-125326909.235^v38^pc_relevant_sort_base2&spm=1001.2101.3001.4242.1&utm_relevant_index=3https://blog.csdn.net/m0_49752107/article/details/129887028https://www.jianshu.com/p/b364534fd0a7https://blog.csdn.net/u010826850/article/details/117325848https://pytorch.org/get-started/previous-versions/

环境准备

1、pytorch
conda create -n deformable_detr python=3.9 pip

2、激活环境
conda activate deformable_detr

3、torch

# CUDA 11.6
pip install torch==1.12.1+cu116 torchvision==0.13.1+cu116 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu116
# CUDA 11.3
pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113

4、其他的库
pip install -r requirements.txt

5、编译CUDA
cd ./models/ops
sh ./make.sh
#unit test (should see all checking is True)
python test.py (我没运行这一步)
在这里插入图片描述
主要是MultiScaleDeformableAttention包,如果中途换了torch版本,需要重新编译cuda,得到一个新的这个包,不然报错。

准备数据集

1、把自己的数据集放在coco文件夹里面

在这里插入图片描述

或者改改这里:
在这里插入图片描述

2、在main.py文件里面改分类数

在这里插入图片描述
deformable-detr 也是需要一个背景类,num_class+1
在这里插入图片描述

3、pth预训练文件

r50上coco数据集训练结果文件
要翻墙,或者:
下载链接:https://download.csdn.net/download/u010826850/21980492
好人一生平安

4、根据自己的数据集修改pth

新建一个文件:
在这里插入图片描述

5、main.py

在这里插入图片描述
改成这样:
在这里插入图片描述

7、修改参数

在这里插入图片描述

8、问题解决

参考其他博主博文里的
在这里插入图片描述

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

相关文章:

  • Statefulset 实战 1
  • 没有jodatime,rust怎么方便高效的操作时间呢?
  • 如何把pdf转成cad版本?这种转换方法非常简单
  • MySQL常用函数方法
  • Linux命令200例专栏导读:实用指南助你成为Linux大师
  • ICN6202 MIPIDSI转LVDS桥接芯片的功能及特征 调试文档资料
  • vscode 格式问题
  • OPENCV C++(三)二值化灰度函数+调用摄像头+鼠标响应+肤色检测
  • zabbix简易入门:基本的网络监控、WEB监控
  • 51单片机学习--DS1302可调时钟
  • Matlab统计字符串中共有多少种字符以及每种字符出现次数的功能实现(Matlab R2021a)
  • HTTPS文件传输
  • LOL-v2数据集和VE-LOL数据集的区别
  • RabbitMQ(一) - 基本结构、SpringBoot整合RabbitMQ、工作队列、发布订阅、直接、主题交换机模式
  • 涉及IMU的专业术语
  • 二维数组对角线判断
  • 数据可视化(六)多个子图及seaborn使用
  • opencv-34 图像平滑处理-双边滤波cv2.bilateralFilter()
  • Leetcode 268. Missing Number
  • MybatisPlus实战笔记
  • Android Studio 报错:Failed to create Jar file xxxxx.jar
  • Django实现音乐网站 ⑸
  • 基于VUE3+Layui从头搭建通用后台管理系统(前端篇)七:工作台界面实现
  • 前端vue uni-app自定义精美海报生成组件
  • 高通滤波器,低通滤波器
  • 机器学习深度学习——卷积的多输入多输出通道
  • HTML5中Canvas学习笔记:Canvas
  • Windows安装子系统Linux
  • C 语言的 pow() 函数
  • socket 基础