nickmuchi commited on
Commit
ae427ba
1 Parent(s): aee4dfd

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +78 -0
README.md CHANGED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ tags:
4
+ - object-detection
5
+ - face mask detection
6
+ datasets:
7
+ - coco
8
+ - [face-mask-detection]("https://www.kaggle.com/datasets/andrewmvd/face-mask-detection")
9
+ widget:
10
+ - src: https://drive.google.com/uc?id=1VwYLbGak5c-2P5qdvfWVOeg7DTDYPbro
11
+ example_title: City Folk
12
+ - src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/football-match.jpg
13
+ example_title: Football Match
14
+ - model-index:
15
+ - name: yolos-small-finetuned-masks
16
+
17
+ # YOLOS (small-sized) model
18
+
19
+ The original YOLOS model was 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).
20
+
21
+ This model was further fine-tuned on the [face mask dataset]("https://www.kaggle.com/datasets/andrewmvd/face-mask-detection") from Kaggle. The dataset consists of 853 images of people with annotations categorised as "with mask","without mask" and "mask not worn correctly". The model was trained for 200 epochs on a single GPU usins Google Colab
22
+
23
+ ## Model description
24
+
25
+ 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).
26
+
27
+ ## Intended uses & limitations
28
+
29
+ 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.
30
+
31
+ ### How to use
32
+
33
+ Here is how to use this model:
34
+
35
+ ```python
36
+ from transformers import YolosFeatureExtractor, YolosForObjectDetection
37
+ from PIL import Image
38
+ import requests
39
+ url = 'https://drive.google.com/uc?id=1VwYLbGak5c-2P5qdvfWVOeg7DTDYPbro'
40
+ image = Image.open(requests.get(url, stream=True).raw)
41
+ feature_extractor = YolosFeatureExtractor.from_pretrained('nickmuchi/yolos-small-finetuned-masks')
42
+ model = YolosForObjectDetection.from_pretrained('nickmuchi/yolos-small-finetuned-masks')
43
+ inputs = feature_extractor(images=image, return_tensors="pt")
44
+ outputs = model(**inputs)
45
+ # model predicts bounding boxes and corresponding face mask detection classes
46
+ logits = outputs.logits
47
+ bboxes = outputs.pred_boxes
48
+ ```
49
+
50
+ Currently, both the feature extractor and model support PyTorch.
51
+
52
+ ## Training data
53
+
54
+ 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.
55
+
56
+ ### Training
57
+
58
+ This model was fine-tuned for 200 epochs on the face-mask-dataset.
59
+
60
+ ## Evaluation results
61
+
62
+ This model achieves an AP (average precision) of **53.1**.
63
+
64
+ Accumulating evaluation results...
65
+ DONE (t=0.14s).
66
+ IoU metric: bbox
67
+ Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.273
68
+ Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.532
69
+ Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.257
70
+ Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.220
71
+ Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.341
72
+ Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.545
73
+ Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.154
74
+ Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.361
75
+ Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.415
76
+ Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.349
77
+ Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.469
78
+ Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.584