Downloads · 30 days
22
3% of all-time downloads
Javiai/3dprintfails-yolo5vs
3dprintfails-yolo5vs is a object detection model from Javiai. 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.
This model was created using in ultralytics Hub with the dataset.
Downloads · 30 days
22
3% of all-time downloads
All-time downloads
691
Public
Repo size
42.9 MB
Likes
6
Public
Click a slice to open those files.
.pt14.4 MB · 100%
From the Hugging Face model README
This model was created using YOLOv5 in ultralytics Hub with the 'Javiai/failures-3D-print' dataset.
The idea is detect some failures in a 3D printing process. This model detect the part that is been printing, the extrusor, some errors and if there is a spaghetti error type
from huggingface_hub import hf_hub_download
import torch
repo_id = "Javiai/3dprintfails-yolo5vs"
filename = "model_torch.pt"
model_path = hf_hub_download(repo_id=repo_id, filename=filename)
model = torch.hub.load('Ultralytics/yolov5', 'custom', model_path, verbose = False)
from datasets import load_dataset
dataset = load_dataset('Javiai/failures-3D-print')
image = dataset["train"][0]["image"]
from PIL import Image
image = Image.load("path/to/image")
from PIL import ImageDraw
draw = ImageDraw.Draw(image)
detections = model(image)
categories = [
{'name': 'error', 'color': (0,0,255)},
{'name': 'extrusor', 'color': (0,255,0)},
{'name': 'part', 'color': (255,0,0)},
{'name': 'spaghetti', 'color': (0,0,255)}
]
for detection in detections.xyxy[0]:
x1, y1, x2, y2, p, category_id = detection
x1, y1, x2, y2, category_id = int(x1), int(y1), int(x2), int(y2), int(category_id)
draw.rectangle((x1, y1, x2, y2),
outline=categories[category_id]['color'],
width=1)
draw.text((x1, y1), categories[category_id]['name'],
categories[category_id]['color'])
image
