CoreML conversion of
BRIA AI's RMBG-2.0 background removal model, optimized for Apple Neural Engine (ANE).
This is a native ML Program format CoreML model converted from RMBG-2.0 (BiRefNet architecture) for high-quality background removal on Apple devices.
1import RMBG2Swift
2
3// Simple one-liner
4let rmbg = try await RMBG2()
5let result = try await rmbg.removeBackground(from: image)
6
7// Access the result
8let outputImage = result.image // Image with transparent background
9let mask = result.mask // Grayscale segmentation mask
1import CoreML
2
3// Load the model
4let config = MLModelConfiguration()
5config.computeUnits = .all // Enable ANE
6
7let model = try await MLModel.load(contentsOf: modelURL, configuration: config)
8
9// Prepare input (1024x1024, NCHW format with ImageNet normalization)
10let input = MLDictionaryFeatureProvider(dictionary: ["input": inputArray])
11
12// Run inference
13let output = try model.prediction(from: input)
14
15// Get mask from output_3 (full resolution)
16let mask = output.featureValue(for: "output_3")?.multiArrayValue
For commercial licensing, contact:
bria.ai/contact-us