initial commit
Browse files- README.md +55 -1
- config.json +39 -0
- preprocessor_config.json +18 -0
- pytorch_model.bin +3 -0
README.md
CHANGED
|
@@ -1,3 +1,57 @@
|
|
| 1 |
---
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
tags:
|
| 3 |
+
- object-detection
|
| 4 |
+
- vision
|
| 5 |
+
finetuned_from:
|
| 6 |
+
- hustvl/yolos-small
|
| 7 |
---
|
| 8 |
+
|
| 9 |
+
# YOLOS (small-sized) model fine-tuned on Matterport balloon dataset
|
| 10 |
+
|
| 11 |
+
YOLOS is a Vision Transformer (ViT) trained using the DETR loss. Despite its simplicity, a base-sized YOLOS model is able to achieve 42 AP on COCO validation 2017 (similar to DETR and more complex frameworks such as Faster R-CNN). YOLOS model fine-tuned 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).
|
| 12 |
+
|
| 13 |
+
## Model description
|
| 14 |
+
|
| 15 |
+
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.
|
| 16 |
+
|
| 17 |
+
Currently, both the feature extractor and model support PyTorch.
|
| 18 |
+
|
| 19 |
+
## Training data
|
| 20 |
+
|
| 21 |
+
This 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. It was further fine-tuned on [Matterport Balloon Detection dataset](https://github.com/matterport/Mask_RCNN/releases/download/v2.1/balloon_dataset.zip), a dataset containg 74 annotated images.
|
| 22 |
+
|
| 23 |
+
### Training
|
| 24 |
+
|
| 25 |
+
The model was pre-trained for 200 epochs on ImageNet-1k, fine-tuned for 150 epochs on COCO and further fine-tuned for 96 epochs on Matterport Balloon Dataset.
|
| 26 |
+
|
| 27 |
+
You can go through its detailed notebook [here](https://github.com/ZohebAbai/Deep-Learning-Projects/blob/master/10_PT_Object_Detection_using_Transformers.ipynb).
|
| 28 |
+
|
| 29 |
+
## Evaluation results
|
| 30 |
+
|
| 31 |
+
This model achieves an AP (average precision) of **26.9** on Matterport Balloon validation.
|
| 32 |
+
|
| 33 |
+
### BibTeX entry and citation info
|
| 34 |
+
|
| 35 |
+
```bibtex
|
| 36 |
+
@article{DBLP:journals/corr/abs-2106-00666,
|
| 37 |
+
author = {Yuxin Fang and
|
| 38 |
+
Bencheng Liao and
|
| 39 |
+
Xinggang Wang and
|
| 40 |
+
Jiemin Fang and
|
| 41 |
+
Jiyang Qi and
|
| 42 |
+
Rui Wu and
|
| 43 |
+
Jianwei Niu and
|
| 44 |
+
Wenyu Liu},
|
| 45 |
+
title = {You Only Look at One Sequence: Rethinking Transformer in Vision through
|
| 46 |
+
Object Detection},
|
| 47 |
+
journal = {CoRR},
|
| 48 |
+
volume = {abs/2106.00666},
|
| 49 |
+
year = {2021},
|
| 50 |
+
url = {https://arxiv.org/abs/2106.00666},
|
| 51 |
+
eprinttype = {arXiv},
|
| 52 |
+
eprint = {2106.00666},
|
| 53 |
+
timestamp = {Fri, 29 Apr 2022 19:49:16 +0200},
|
| 54 |
+
biburl = {https://dblp.org/rec/journals/corr/abs-2106-00666.bib},
|
| 55 |
+
bibsource = {dblp computer science bibliography, https://dblp.org}
|
| 56 |
+
}
|
| 57 |
+
```
|
config.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"YolosForObjectDetection"
|
| 4 |
+
],
|
| 5 |
+
"attention_probs_dropout_prob": 0.0,
|
| 6 |
+
"auxiliary_loss": false,
|
| 7 |
+
"bbox_cost": 5,
|
| 8 |
+
"bbox_loss_coefficient": 5,
|
| 9 |
+
"class_cost": 1,
|
| 10 |
+
"eos_coefficient": 0.1,
|
| 11 |
+
"giou_cost": 2,
|
| 12 |
+
"giou_loss_coefficient": 2,
|
| 13 |
+
"hidden_act": "gelu",
|
| 14 |
+
"hidden_dropout_prob": 0.0,
|
| 15 |
+
"hidden_size": 384,
|
| 16 |
+
"id2label": {
|
| 17 |
+
"0": "Balloon"
|
| 18 |
+
},
|
| 19 |
+
"image_size": [
|
| 20 |
+
512,
|
| 21 |
+
864
|
| 22 |
+
],
|
| 23 |
+
"initializer_range": 0.02,
|
| 24 |
+
"intermediate_size": 1536,
|
| 25 |
+
"label2id": {
|
| 26 |
+
"Balloon": 0
|
| 27 |
+
},
|
| 28 |
+
"layer_norm_eps": 1e-12,
|
| 29 |
+
"model_type": "yolos",
|
| 30 |
+
"num_attention_heads": 6,
|
| 31 |
+
"num_channels": 3,
|
| 32 |
+
"num_detection_tokens": 100,
|
| 33 |
+
"num_hidden_layers": 12,
|
| 34 |
+
"patch_size": 16,
|
| 35 |
+
"qkv_bias": true,
|
| 36 |
+
"torch_dtype": "float32",
|
| 37 |
+
"transformers_version": "4.22.2",
|
| 38 |
+
"use_mid_position_embeddings": true
|
| 39 |
+
}
|
preprocessor_config.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"do_normalize": true,
|
| 3 |
+
"do_resize": true,
|
| 4 |
+
"feature_extractor_type": "YolosFeatureExtractor",
|
| 5 |
+
"format": "coco_detection",
|
| 6 |
+
"image_mean": [
|
| 7 |
+
0.485,
|
| 8 |
+
0.456,
|
| 9 |
+
0.406
|
| 10 |
+
],
|
| 11 |
+
"image_std": [
|
| 12 |
+
0.229,
|
| 13 |
+
0.224,
|
| 14 |
+
0.225
|
| 15 |
+
],
|
| 16 |
+
"max_size": 1333,
|
| 17 |
+
"size": 800
|
| 18 |
+
}
|
pytorch_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:073d1210ad9ce9aa2d7fed6a9fd85eb87522e258b876e23cd7a6e9edd3a3d068
|
| 3 |
+
size 122667609
|