Detectron2 wrapper for DETR
=======
We provide a Detectron2 wrapper for DETR, thus providing a way to better integrate it in the existing detection ecosystem. It can be used for example to easily leverage datasets or backbones provided in Detectron2.
This wrapper currently supports only box detection, and is intended to be as close as possible to the original implementation, and we checked that it indeed match the results. Some notable facts and caveats:
- The data augmentation matches DETR's original data augmentation. This required patching the RandomCrop augmentation from Detectron2, so you'll need a version from the master branch from June 24th 2020 or more recent.
- To match DETR's original backbone initialization, we use the weights of a ResNet50 trained on imagenet using torchvision. This network uses a different pixel mean and std than most of the backbones available in Detectron2 by default, so extra care must be taken when switching to another one. Note that no other torchvision models are available in Detectron2 as of now, though it may change in the future.
- The gradient clipping mode is "full_model", which is not the default in Detectron2.
# Usage
To install Detectron2, please follow the [official installation instructions](https://github.com/facebookresearch/detectron2/blob/master/INSTALL.md).
## Evaluating a model
For convenience, we provide a conversion script to convert models trained by the main DETR training loop into the format of this wrapper. To download and convert the main Resnet50 model, simply do:
```
python converter.py --source_model https://dl.fbaipublicfiles.com/detr/detr-r50-e632da11.pth --output_model converted_model.pth
```
You can then evaluate it using:
```
python train_net.py --eval-only --config configs/detr_256_6_6_torchvision.yaml MODEL.WEIGHTS "converted_model.pth"
```
## Training
To train DETR on a single node with 8 gpus, simply use:
```
python train_net.py --config configs/detr_256_6_6_torchvision.yaml --num-gpus 8
```
To fine-tune DETR for instance segmentation on a single node with 8 gpus, simply use:
```
python train_net.py --config configs/detr_segm_256_6_6_torchvision.yaml --num-gpus 8 MODEL.DETR.FROZEN_WEIGHTS <model_path>
```
没有合适的资源?快使用搜索试试~ 我知道了~
目标检测源码解读1111
共50个文件
py:28个
pyc:16个
yaml:2个
需积分: 5 0 下载量 186 浏览量
2022-12-26
20:01:54
上传
评论
收藏 108KB ZIP 举报
温馨提示
目标检测源码解读1111
资源推荐
资源详情
资源评论
收起资源包目录
detr目标检测源码解读.zip (50个子文件)
detr-master
test_all.py 9KB
.circleci
config.yml 703B
main.py 11KB
hubconf.py 6KB
tox.ini 65B
datasets
__init__.py 897B
coco.py 5KB
panoptic_eval.py 1KB
transforms.py 8KB
coco_panoptic.py 4KB
__pycache__
panoptic_eval.cpython-36.pyc 2KB
coco.cpython-36.pyc 5KB
transforms.cpython-36.pyc 9KB
__init__.cpython-36.pyc 849B
coco_eval.cpython-36.pyc 7KB
coco_eval.py 9KB
models
__init__.py 143B
segmentation.py 15KB
position_encoding.py 4KB
matcher.py 4KB
backbone.py 4KB
detr.py 17KB
transformer.py 13KB
__pycache__
transformer.cpython-36.pyc 9KB
position_encoding.cpython-36.pyc 4KB
segmentation.cpython-36.pyc 13KB
matcher.cpython-36.pyc 4KB
detr.cpython-36.pyc 15KB
__init__.cpython-36.pyc 288B
backbone.cpython-36.pyc 5KB
.gitignore 189B
engine.py 6KB
__pycache__
engine.cpython-36.pyc 6KB
util
__init__.py 71B
box_ops.py 3KB
misc.py 15KB
plot_utils.py 4KB
__pycache__
box_ops.cpython-36.pyc 3KB
misc.cpython-36.pyc 14KB
__init__.cpython-36.pyc 141B
d2
detr
__init__.py 176B
dataset_mapper.py 4KB
detr.py 11KB
config.py 888B
configs
detr_256_6_6_torchvision.yaml 1012B
detr_segm_256_6_6_torchvision.yaml 1KB
converter.py 3KB
README.md 2KB
train_net.py 5KB
run_with_submitit.py 3KB
共 50 条
- 1
资源评论
巴黎左岸°C
- 粉丝: 0
- 资源: 38
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功