Masamsa/3d-print-failure-detection
Viewer • Updated • 2.71k • 105 • 1
Binary image classifier: normal vs failure (spaghetti / bed detachment). Designed for on-device inference on Raspberry Pi 4 via ONNX Runtime (~200–400 ms/frame).
| ID | Label |
|---|---|
| 0 | failure |
| 1 | normal |
import onnxruntime as ort
import numpy as np
from PIL import Image
from transformers import MobileViTImageProcessor
processor = MobileViTImageProcessor.from_pretrained("Masamsa/3d-print-failure-mobilevit-xxs")
sess = ort.InferenceSession("model.onnx", providers=["CPUExecutionProvider"])
img = Image.open("frame.jpg").convert("RGB")
inputs = processor(images=img, return_tensors="np")
logits = sess.run(["logits"], dict(inputs))[0]
pred = int(np.argmax(logits, axis=-1)[0])
label = {0: "normal", 1: "failure"}[pred]
print(label)
apple/mobilevit-xx-small (1.3M params)Base model
apple/mobilevit-xx-small