billiards / v1 /README.md
jchadwick's picture
Add CoreML and tflite images
3c58ec5

Billiards YOLOv8n Model - Exported Formats (1280x1280)

Successfully Exported Models

CoreML

  • File: billiards-yolov8n.mlpackage
  • Input Size: 1280x1280 RGB
  • Size: ~6.0 MB
  • Status: ✅ Successfully exported
  • Platform: iOS/macOS
  • Description: CoreML package ready for Apple device inference

ONNX

  • File: billiards-yolov8n.onnx
  • Input Size: 1280x1280 (1x3x1280x1280 BCHW)
  • Format: ONNX opset 19
  • Size: 12.2 MB
  • Status: ✅ Successfully exported
  • Platform: Cross-platform
  • Description: Universal format, can be used with ONNXRuntime or converted to other formats

TFLite (Float32)

  • File: billiards-yolov8n_float32.tflite
  • Input Size: 1280x1280
  • Size: 12 MB
  • Status: ✅ Successfully exported
  • Platform: Android, Edge devices, TensorFlow Lite runtime
  • Description: Full precision TFLite model

TFLite (Float16)

  • File: billiards-yolov8n_float16.tflite
  • Input Size: 1280x1280
  • Size: 6.0 MB
  • Status: ✅ Successfully exported
  • Platform: Android, Edge devices, TensorFlow Lite runtime
  • Description: Half precision TFLite model (smaller, slightly less accurate)

Model Details

  • Base Model: YOLOv8n (Nano)
  • Training: Custom billiards dataset
  • Input Size: 1280x1280x3 RGB
  • Task: Object detection
  • Output Shape: (1, 6, 33600) - 6 classes, 33600 detections at 1280 resolution

Conversion Notes

CoreML

  • Converted directly from PyTorch using Ultralytics export
  • Ready for use with Core ML framework on iOS/macOS
  • Optimized for Apple Neural Engine

ONNX

  • Exported with opset 19 for broad compatibility
  • Can be used as an intermediate format for other conversions
  • Works with ONNXRuntime on all platforms

TFLite

  • Converted via ONNX → TensorFlow SavedModel → TFLite pipeline using Docker
  • Used onnx2tf tool with TensorFlow 2.19
  • Two variants provided:
    • Float32: Full precision, larger file
    • Float16: Half precision, 50% smaller, minimal accuracy loss

Usage Examples

CoreML (Swift/iOS)

let model = try billiards_yolov8n()
let input = billiards_yolov8nInput(image: pixelBuffer)
let output = try model.prediction(input: input)

ONNX (Python)

import onnxruntime as ort
session = ort.InferenceSession("billiards-yolov8n.onnx")
output = session.run(None, {"images": input_tensor})

TFLite (Python)

import tensorflow as tf
interpreter = tf.lite.Interpreter("billiards-yolov8n_float32.tflite")
interpreter.allocate_tensors()
# Run inference...

File Sizes Summary

Format File Size
PyTorch billiards-yolov8n.pt 5.9 MB
CoreML billiards-yolov8n.mlpackage ~6.0 MB
ONNX billiards-yolov8n.onnx 12.2 MB
TFLite (FP32) billiards-yolov8n_float32.tflite 12 MB
TFLite (FP16) billiards-yolov8n_float16.tflite 6.0 MB