--- license: other license_name: bsl-1.1 license_link: https://mariadb.com/bsl11/ library_name: ultralytics tags: - onnx - yolo - yolov8 - object-detection - whiteboard - diagram - shapes pipeline_tag: object-detection --- # Whiteboard Detector **Detects hand-drawn shapes on whiteboards.** YOLOv8-nano fine-tuned to recognize 30 diagram shape classes. ## Quick Stats | Spec | Value | |------|-------| | Architecture | YOLOv8-nano | | Format | ONNX | | Size | ~12 MB | | Input | 640×640 RGB | | Classes | 30 | | Training | 100 epochs, 211 images | | Hardware | M3 Max, 1.4 hours | ## Classes (30) ``` rectangle, rounded_rectangle, oval, circle, diamond, hexagon, parallelogram, triangle, star, cloud, cylinder, stick_figure, arrow_box, document_shape, database_icon, square, ellipse, pentagon, cross, heart, lightning, banner, callout, bracket, solid_arrow, dashed_arrow, bidirectional_arrow, dotted_line, curved_arrow, curved_line ``` ## Usage ### Python (ultralytics) ```python from ultralytics import YOLO model = YOLO("best.onnx") results = model("whiteboard.jpg") for box in results[0].boxes: cls = int(box.cls[0]) conf = float(box.conf[0]) x1, y1, x2, y2 = box.xyxy[0].tolist() print(f"{model.names[cls]}: {conf:.2f} at ({x1:.0f}, {y1:.0f})") ``` ### Python (onnxruntime) ```python import onnxruntime as ort import numpy as np from PIL import Image # Load model session = ort.InferenceSession("best.onnx") # Preprocess img = Image.open("whiteboard.jpg").resize((640, 640)) input_tensor = np.array(img).transpose(2, 0, 1).astype(np.float32) / 255.0 input_tensor = input_tensor[np.newaxis, ...] # Inference outputs = session.run(None, {"images": input_tensor}) # outputs[0] shape: [1, 34, 8400] # 34 = 4 (xywh) + 30 (class scores) # 8400 = detection candidates ``` ### CLI (ultralytics) ```bash yolo predict model=best.onnx source=whiteboard.jpg ``` ## Output Format YOLO outputs tensor `[1, 34, 8400]`: ``` For each of 8400 candidates: [0] x_center (0-640) [1] y_center (0-640) [2] width [3] height [4-33] confidence per class (30 classes) ``` Post-process with confidence threshold (0.25) and NMS (0.45 IoU). ## Training Performance | Class | mAP50 | Notes | |-------|-------|-------| | cloud | 0.993 | Excellent | | rounded_rectangle | 0.995 | Excellent | | stick_figure | 0.895 | Good | | oval | 0.849 | Good | | rectangle | 0.716 | Good | | text_label | 0.664 | Fair | | solid_arrow | 0.368 | Needs more data | | triangle | 0.316 | Needs more data | | cylinder | 0.045 | Needs more data | ## Files ``` whiteboard-detector/ ├── best.onnx # Model (use this) ├── best.pt # PyTorch weights ├── classes.txt # Class names ├── README.md # This file └── SKILL.md # Manifest ``` ## Training Data - 211 annotated whiteboard images - Hand-drawn diagrams, varying styles - Augmentation: rotation, blur, noise ## Limitations - Best with clear contrast (dark ink on white) - Small shapes (<20px) may be missed - Overlapping shapes can confuse detection - Some classes undertrained (cylinder, triangle) ## License **Business Source License 1.1 (BSL-1.1)** Copyright (c) 2024 Block Xaero Inc. - ✅ Free for non-production use - ⚠️ Production use requires license