nielsr HF staff commited on
Commit
f59c628
1 Parent(s): 947aff1

Add model card

Browse files
Files changed (1) hide show
  1. README.md +95 -0
README.md ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ tags:
4
+ - image-segmentation
5
+ datasets:
6
+ - coco
7
+ ---
8
+
9
+ # DETR (End-to-End Object Detection) model with ResNet-101 backbone
10
+
11
+ DEtection TRansformer (DETR) model trained end-to-end on COCO 2017 panoptic (118k annotated images). It was introduced in the paper [End-to-End Object Detection with Transformers](https://arxiv.org/abs/2005.12872) by Carion et al. and first released in [this repository](https://github.com/facebookresearch/detr).
12
+
13
+ Disclaimer: The team releasing DETR did not write a model card for this model so this model card has been written by the Hugging Face team.
14
+
15
+ ## Model description
16
+
17
+ The DETR model is an encoder-decoder transformer with a convolutional backbone. Two heads are added on top of the decoder outputs in order to perform object detection: a linear layer for the class labels and a MLP (multi-layer perceptron) for the bounding boxes. The model uses so-called object queries to detect objects in an image. Each object query looks for a particular object in the image. For COCO, the number of object queries is set to 100.
18
+
19
+ The model is trained using a "bipartite matching loss": one compares the predicted classes + bounding boxes of each of the N = 100 object queries to the ground truth annotations, padded up to the same length N (so if an image only contains 4 objects, 96 annotations will just have a "no object" as class and "no bounding box" as bounding box). The Hungarian matching algorithm is used to create an optimal one-to-one mapping between each of the N queries and each of the N annotations. Next, standard cross-entropy (for the classes) and a linear combination of the L1 and generalized IoU loss (for the bounding boxes) are used to optimize the parameters of the model.
20
+
21
+ DETR can be naturally extended to perform panoptic segmentation, by adding a mask head on top of the decoder outputs.
22
+
23
+ ## Intended uses & limitations
24
+
25
+ You can use the raw model for panoptic segmentation. See the [model hub](https://huggingface.co/models?search=facebook/detr) to look for all available DETR models.
26
+
27
+ ### How to use
28
+
29
+ Here is how to use this model:
30
+
31
+ ```python
32
+ from transformers import DetrFeatureExtractor, DetrForSegmentation
33
+ from PIL import Image
34
+ import requests
35
+
36
+ url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
37
+ image = Image.open(requests.get(url, stream=True).raw)
38
+
39
+ feature_extractor = DetrFeatureExtractor.from_pretrained('facebook/detr-resnet-101-panoptic')
40
+ model = DetrForSegmentation.from_pretrained('facebook/detr-resnet-101-panoptic')
41
+
42
+ inputs = feature_extractor(images=image, return_tensors="pt")
43
+ outputs = model(**inputs)
44
+ # model predicts COCO classes, bounding boxes, and masks
45
+ logits = outputs.logits
46
+ bboxes = outputs.pred_boxes
47
+ masks = outputs.pred_masks
48
+ ```
49
+
50
+ Currently, both the feature extractor and model support PyTorch.
51
+
52
+ ## Training data
53
+
54
+ The DETR model was trained on [COCO 2017 panoptic](https://cocodataset.org/#download), a dataset consisting of 118k/5k annotated images for training/validation respectively.
55
+
56
+ ## Training procedure
57
+
58
+ ### Preprocessing
59
+
60
+ The exact details of preprocessing of images during training/validation can be found [here](https://github.com/facebookresearch/detr/blob/master/datasets/coco_panoptic.py).
61
+
62
+ Images are resized/rescaled such that the shortest side is at least 800 pixels and the largest side at most 1333 pixels, and normalized across the RGB channels with the ImageNet mean (0.485, 0.456, 0.406) and standard deviation (0.229, 0.224, 0.225).
63
+
64
+ ### Training
65
+
66
+ The model was trained for 300 epochs on 16 V100 GPUs. This takes 3 days, with 4 images per GPU (hence a total batch size of 64).
67
+
68
+ ## Evaluation results
69
+
70
+ This model achieves the following results on COCO 2017 validation: a box AP (average precision) of **40.1**, a segmentation AP (average precision) of **33** and a PQ (panoptic quality) of **45.1**.
71
+
72
+ For more details regarding evaluation results, we refer to table 5 of the original paper.
73
+
74
+ ### BibTeX entry and citation info
75
+
76
+ ```bibtex
77
+ @article{DBLP:journals/corr/abs-2005-12872,
78
+ author = {Nicolas Carion and
79
+ Francisco Massa and
80
+ Gabriel Synnaeve and
81
+ Nicolas Usunier and
82
+ Alexander Kirillov and
83
+ Sergey Zagoruyko},
84
+ title = {End-to-End Object Detection with Transformers},
85
+ journal = {CoRR},
86
+ volume = {abs/2005.12872},
87
+ year = {2020},
88
+ url = {https://arxiv.org/abs/2005.12872},
89
+ archivePrefix = {arXiv},
90
+ eprint = {2005.12872},
91
+ timestamp = {Thu, 28 May 2020 17:38:09 +0200},
92
+ biburl = {https://dblp.org/rec/journals/corr/abs-2005-12872.bib},
93
+ bibsource = {dblp computer science bibliography, https://dblp.org}
94
+ }
95
+ ```