← all repositories
hollance/CoreMLHelpers

Core ML's missing utility belt, copy-paste style

A grab-bag of Swift helpers for the sharp edges Apple left around CVPixelBuffer, MLMultiArray, and NMS.

1.4k stars Swift Inference · Serving
CoreMLHelpers
Velocity · 7d
+0.4
★ / day
Trend
steady
star history

What it does CoreMLHelpers is a loose collection of Swift files for common Core ML chores: converting images to CVPixelBuffer and back, turning MLMultiArray into something you can actually look at, running non-maximum suppression on bounding boxes, and extracting top-k predictions without writing the same argmax loop for the hundredth time. There’s also an experimental SwiftyMultiArray wrapper that tries to make Apple’s tensor type feel less like a C struct wearing a Swift costume.

The interesting bit The author openly calls it a “hodgepodge” and refuses to package it as SPM, CocoaPods, or Carthage. The intended workflow is almost aggressively old-school: copy the one or two files you need, paste them in, and adapt. This is either liberating or annoying depending on your tolerance for manual dependency hygiene.

Key highlights

  • Image ↔ CVPixelBuffer conversion utilities
  • MLMultiArray to image rendering (useful for visualizing segmentation masks or heatmaps)
  • Top-k, argmax, and other “handy functions” for classification outputs
  • Non-maximum suppression for object detection post-processing
  • Experimental SwiftyMultiArray with numpy-like aspirations
  • MIT licensed, 2017–2021

Caveats

  • Explicitly described as demonstration code you will likely need to customize
  • No unit tests (listed in TODO)
  • MultiArray bugs acknowledged in TODO, with more numpy-like functionality promised but not yet delivered
  • Last meaningful update appears 2021 based on copyright; may not reflect latest Core ML API changes

Verdict Worth bookmarking if you’re shipping Core ML on iOS and keep rewriting the same pixel-buffer boilerplate. Skip it if you need a polished, versioned dependency with test coverage and active maintenance — this is a reference drawer, not a framework.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.