Downloads · 30 days
17
12% of all-time downloads
Bartek7630/yolos-tiny-sku110k-refined
yolos-tiny-sku110k-refined is a object detection model from Bartek7630. Use it when you need objects located in an image. It is set up for transformers.
This repository contains a fine-tuned version of the hustvl/yolos-tiny architecture, optimized specifically for dense object detection on retail store shelves using the SKU-110k dataset layout.
Downloads · 30 days
17
12% of all-time downloads
All-time downloads
138
Public
Parameters
6.5M
25.9 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors25.9 MB · 100%
From the Hugging Face model README
This repository contains a fine-tuned version of the hustvl/yolos-tiny architecture, optimized specifically for dense object detection on retail store shelves using the SKU-110k dataset layout.
The core model is based on the You Only Look at One Sequence object detection transformer. The architecture has been adapted to handle high-density patterns of closely packed objects, typical in retail environments (shelf auditing and planogram compliance analysis).
The model was optimized using the full training split of the target dataset with the following pipeline parameters:
This model is intended for custom shelf analytics deployment, automation of out-of-stock monitoring, and object extraction workflows.
from transformers import YolosForObjectDetection, YolosImageProcessor
import torch
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = YolosForObjectDetection.from_pretrained("Bartek7630/yolos-tiny-sku110k-refined").to(device)
image_processor = YolosImageProcessor.from_pretrained("Bartek7630/yolos-tiny-sku110k-refined")
### Full Inference & Visualization Script
You can copy and run the complete pipeline below to test the model on any retail shelf image.
```python
import torch
import requests
from PIL import Image, ImageDraw
from transformers import YolosForObjectDetection, YolosImageProcessor
# 1. Configuration & Environment Setup
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model_id = "Bartek7630/yolos-tiny-sku110k-refined"
# 2. Load Model and Processor directly from Hugging Face Hub
model = YolosForObjectDetection.from_pretrained(model_id).to(device)
image_processor = YolosImageProcessor.from_pretrained(model_id)
model.eval()
# 3. Load Input Image (Replace URL with local path if necessary)
url = "[https://raw.githubusercontent.com/huggingface/transformers/main/tests/fixtures/tests_samples/COCO/000000039769.png](https://raw.githubusercontent.com/huggingface/transformers/main/tests/fixtures/tests_samples/COCO/000000039769.png)"
image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
# 4. Preprocessing
inputs = image_processor(images=image, return_tensors="pt").to(device)
# 5. Model Inference
with torch.no_grad():
outputs = model(**inputs)
# 6. Post-Processing (Bounding Box Denormalization)
target_sizes = torch.tensor([image.size[::-1]]).to(device)
results = image_processor.post_process_object_detection(outputs, threshold=0.3, target_sizes=target_sizes)[0]
# 7. Visualization
draw = ImageDraw.Draw(image)
for score, label, box in zip(results["scores"], results["labels"], results["boxes"]):
box = [int(i) for i in box.tolist()]
# Draw red rectangles over detected SKU items
draw.rectangle(box, outline="red", width=3)
# Save or display the finalized audit result
image.save("shelf_audit_result.png")
image.show()