Downloads · 30 days
55
0% of all-time downloads
nickmuchi/yolos-small-finetuned-masks
yolos-small-finetuned-masks is a object detection model from nickmuchi. Use it when you need objects located in an image. It is set up for transformers. The card lists the license as apache-2.0.
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 by…
Downloads · 30 days
55
0% of all-time downloads
All-time downloads
11.6K
Public
Parameters
30.7M
73.9 GB on disk
Likes
2
Public
Click a slice to open those files.
.ckpt368 MB · 60%
From the Hugging Face model README
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 by Fang et al. and first released in this repository.
This model was further fine-tuned on the face mask dataset 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
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).
You can use the raw model for object detection. See the model hub to look for all available YOLOS models.
Here is how to use this model:
from transformers import YolosFeatureExtractor, YolosForObjectDetection
from PIL import Image
import requests
url = 'https://drive.google.com/uc?id=1VwYLbGak5c-2P5qdvfWVOeg7DTDYPbro'
image = Image.open(requests.get(url, stream=True).raw)
feature_extractor = YolosFeatureExtractor.from_pretrained('nickmuchi/yolos-small-finetuned-masks')
model = YolosForObjectDetection.from_pretrained('nickmuchi/yolos-small-finetuned-masks')
inputs = feature_extractor(images=image, return_tensors="pt")
outputs = model(**inputs)
# model predicts bounding boxes and corresponding face mask detection classes
logits = outputs.logits
bboxes = outputs.pred_boxes
Currently, both the feature extractor and model support PyTorch.
The YOLOS model was pre-trained on ImageNet-1k and fine-tuned on COCO 2017 object detection, a dataset consisting of 118k/5k annotated images for training/validation respectively.
This model was fine-tuned for 200 epochs on the face-mask-dataset.
This model achieves an AP (average precision) of 53.2.
Accumulating evaluation results...
IoU metric: bbox
| Metrics | Metric Parameter | Location | Dets | Value |
|---|---|---|---|---|
| Average Precision | (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] | 0.273 |
| Average Precision | (AP) @[ IoU=0.50 | area= all | maxDets=100 ] | 0.532 |
| Average Precision | (AP) @[ IoU=0.75 | area= all | maxDets=100 ] | 0.257 |
| Average Precision | (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] | 0.220 |
| Average Precision | (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] | 0.341 |
| Average Precision | (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] | 0.545 |
| Average Recall | (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] | 0.154 |
| Average Recall | (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] | 0.361 |
| Average Recall | (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] | 0.415 |
| Average Recall | (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] | 0.349 |
| Average Recall | (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] | 0.469 |
| Average Recall | (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] | 0.584 |