--- license: mit base_model: ZhengPeng7/BiRefNet_HR-matting pipeline_tag: image-segmentation library_name: coreml tags: - coreml - background-removal - matting --- # BiRefNet HR-matting for Core ML [BiRefNet_HR-matting](https://huggingface.co/ZhengPeng7/BiRefNet_HR-matting) by Zheng Peng et al., converted to a Core ML ML Program (fp16) for macOS and iOS. - `BiRefNetHRMatting-1.aar`: an Apple Archive of `BiRefNetHRMatting.mlpackage`. Extract with `aa extract -i BiRefNetHRMatting-1.aar -d .`. - Input `image`: RGB, 2048 × 2048. ImageNet normalisation is inside the model. - Output `alpha`: `[1, 1, 2048, 2048]` soft matte, 0 to 1. - Run on `.cpuAndGPU`. The Neural Engine can't compile it. - Deformable convolution is reimplemented with `grid_sample`, matching torchvision to about 1e-5. Mean matte difference from PyTorch is about 0.0003. MIT licensed, like the original. Please cite the BiRefNet paper: Zheng et al., "Bilateral Reference for High-Resolution Dichotomous Image Segmentation", CAAI AIR 2024.