RT-DETR实验记录
1. conda环境
python 3.8.20
pytorch 2.1.0 + cuda 11.8
2. 官方代码
https://github.com/lyuwenyu/RT-DETR
3. 依赖安装
这里选择 rtdetrv2_pytorch 文件夹
首先找到 require.txt 路径:/.../RT-DETR-main/rtdetrv2_pytorch/requirements.txt,安装所需依赖(注意 torch 不需要重复安装)
安装命令:
pip install -r requirements.txt
4. 配置文件
找到rt_detr的配置文件,在config文件夹下
文件夹路径:/home/JL/LDY/scripts/rtdetr/RT-DETR-main/rtdetrv2_pytorch/configs/rtdetrv2
选择 rtdetrv2_r18vd_120e_coco.yml 文件
如果需要训练自己的数据集,需要修改部分配置,如类别数,数据集路径等
5. 启动训练
训练命令:
python tools/train.py -c configs/rtdetrv2/A_rtdetrv2_r18vd_120e_coco.yml --use-amp
其中相对路径可以改用绝对路径,不依赖当前所在目录位置
多GPU:
torchrun --nproc_per_node=4 tools/train.py -c configs/rtdetrv2/A_rtdetrv2_r18vd_120e_coco.yml --use-amp --seed=42
这个模型训练比较慢,可以用nohup等后台跑,也可以用-r断点续跑

浙公网安备 33010602011771号