DETR-Object detection配置教程

DETR-Object detection配置教程

0. github下载为zip压缩包,解压到你的工作目录下

Object Detection with DETR : A minimal implementation DEMO点击此处

1. Anaconda环境配置

  • 创建detr环境
conda create -n detr python=3.8
conda activate detr
cd D:\Coding\AnacondaProject\detr-main #进入detr-main目录
  • 安装pytorch 1.5+ 和torchvision 0.6+
conda install -c pytorch pytorch torchvision
  • 安装pycocotools和scipy,用于在COCO数据集上进行evaluation及训练
conda install cython scipy
pip install -U 'git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI' #本机测试不行
pip install pycocotools #使用这条命令安装pycocotools
  • (可选)如果想使用panoptic
pip install git+https://github.com/cocodataset/panopticapi.git

2. 数据准备

Download and extract COCO 2017 train and val images with annotations from http://cocodataset.org. We expect the directory structure to be the following:

path/to/coco/
  annotations/  # annotation json files
  train2017/    # train images
  val2017/      # val images

3. 训练

在单节点8个gpu上对基线DETR训练300个epochs:

python -m torch.distributed.launch --nproc_per_node=8 --use_env main.py --coco_path /path/to/coco

A single epoch takes 28 minutes, so 300 epoch training takes around 6 days on a single machine with 8 V100 cards. To ease reproduction of our results we provide results and training logs for 150 epoch schedule (3 days on a single machine), achieving 39.5/60.3 AP/AP50.

4. 评估

在COCO val 5k用一个GPU对DETR R50进行评估:

python main.py --batch_size 2 --no_aux_loss --eval --resume https://dl.fbaipublicfiles.com/detr/detr-r50-e632da11.pth --coco_path /path/to/coco

5. 多节点训练

分布式训练可以使用Slurm和submitit

pip install submitit

在4个节点上对基线模型DETR-6-6训练300 epochs:

python run_with_submitit.py --timeout 3000 --coco_path /path/to/coco
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值