nielsr HF staff commited on
Commit
471e3ab
1 Parent(s): 0a971e9

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +93 -0
README.md ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ tags:
4
+ - object-detection
5
+ datasets:
6
+ - coco
7
+ widget:
8
+ - src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/savanna.jpg
9
+ example_title: Savanna
10
+ - src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/football-match.jpg
11
+ example_title: Football Match
12
+ - src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/airport.jpg
13
+ example_title: Airport
14
+ ---
15
+
16
+ # YOLOS (small-sized) model
17
+
18
+ YOLOS model trained on COCO 2017 object detection (118k annotated images). It was introduced in the paper [You Only Look at One Sequence: Rethinking Transformer in Vision through Object Detection](https://arxiv.org/abs/2106.00666) by Fang et al. and first released in [this repository](https://github.com/hustvl/YOLOS).
19
+
20
+ Disclaimer: The team releasing YOLOS did not write a model card for this model so this model card has been written by the Hugging Face team.
21
+
22
+ ## Model description
23
+
24
+ YOLOS is a Vision Transformer (ViT) trained using the DETR loss. Despite its simplicity, the model is able to achieve 42 AP on COCO validation 2017.
25
+
26
+ 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.
27
+
28
+ ## Intended uses & limitations
29
+
30
+ You can use the raw model for object detection. See the [model hub](https://huggingface.co/models?search=hustvl/yolos) to look for all available YOLOS models.
31
+
32
+ ### How to use
33
+
34
+ Here is how to use this model:
35
+
36
+ ```python
37
+ from transformers import YolosFeatureExtractor, YolosForObjectDetection
38
+ from PIL import Image
39
+ import requests
40
+
41
+ url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
42
+ image = Image.open(requests.get(url, stream=True).raw)
43
+
44
+ feature_extractor = YolosFeatureExtractor.from_pretrained('hustvl/yolos-small')
45
+ model = YolosForObjectDetection.from_pretrained('hustvl/yolos-small')
46
+
47
+ inputs = feature_extractor(images=image, return_tensors="pt")
48
+ outputs = model(**inputs)
49
+
50
+ # model predicts bounding boxes and corresponding COCO classes
51
+ logits = outputs.logits
52
+ bboxes = outputs.pred_boxes
53
+ ```
54
+
55
+ Currently, both the feature extractor and model support PyTorch.
56
+
57
+ ## Training data
58
+
59
+ The YOLOS model was pre-trained on [ImageNet-1k](https://huggingface.co/datasets/imagenet2012) and fine-tuned on [COCO 2017 object detection](https://cocodataset.org/#download), a dataset consisting of 118k/5k annotated images for training/validation respectively.
60
+
61
+ ### Training
62
+
63
+ The model was pre-trained for 200 epochs on ImageNet-1k and fine-tuned for 150 epochs on COCO.
64
+
65
+ ## Evaluation results
66
+
67
+ This model achieves an AP (average precision) of **36.1** on COCO 2017 validation. For more details regarding evaluation results, we refer to table 1 of the original paper.
68
+
69
+ ### BibTeX entry and citation info
70
+
71
+ ```bibtex
72
+ @article{DBLP:journals/corr/abs-2106-00666,
73
+ author = {Yuxin Fang and
74
+ Bencheng Liao and
75
+ Xinggang Wang and
76
+ Jiemin Fang and
77
+ Jiyang Qi and
78
+ Rui Wu and
79
+ Jianwei Niu and
80
+ Wenyu Liu},
81
+ title = {You Only Look at One Sequence: Rethinking Transformer in Vision through
82
+ Object Detection},
83
+ journal = {CoRR},
84
+ volume = {abs/2106.00666},
85
+ year = {2021},
86
+ url = {https://arxiv.org/abs/2106.00666},
87
+ eprinttype = {arXiv},
88
+ eprint = {2106.00666},
89
+ timestamp = {Fri, 29 Apr 2022 19:49:16 +0200},
90
+ biburl = {https://dblp.org/rec/journals/corr/abs-2106-00666.bib},
91
+ bibsource = {dblp computer science bibliography, https://dblp.org}
92
+ }
93
+ ```