栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

DETR-Object detection配置教程

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

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:CodingAnacondaProjectdetr-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
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/303744.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号