This sample demonstrates the use of DETR converted to Core ML. It allows semantic segmentation on iOS devices, where each pixel in an image is classified according to the most probable category it belongs to.
We leverage coremltools for model conversion and compression. You can read more about it here.
- Download DETRResnet50SemanticSegmentationF16.mlpackage from the Hugging Face Hub and place it inside the
models
folder of the project. - Open
SemanticSegmentationSample.xcodeproj
in Xcode. - Build & run the project!
DEtection TRansformer (DETR) was introduced in the paper End-to-End Object Detection with Transformers by Carion et al. and first released in this repository.
Core ML packages are available in apple/coreml-detr-semantic-segmentation.
Install huggingface-cli
brew install huggingface-cli
Download DETRResnet50SemanticSegmentationF16.mlpackage
to the models
directory:
huggingface-cli download \
--local-dir models --local-dir-use-symlinks False \
apple/coreml-detr-semantic-segmentation \
--include "DETRResnet50SemanticSegmentationF16.mlpackage/*"
To download all the model versions, including quantized ones, skip the --include
argument.