apple / apple/coremltools

`coremltools` docs - Xcode Model Preview Type for Object Detection?

Open
#2,265 3 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Python
Stars
5.4k
Forks
850
Avg merge
4d 5h
Merged PRs (30d)
10

Description

## ❓Is there an Xcode Model Preview Type for Object Detection?

Hi there, I'm going through the `coremltools` docs for exporting PyTorch models.

I've found that there's an Xcode Model Preview Type for Segmentation (see below).

But I'm wondering if there's a similar setup for object detection?

The docs I'm referring to are here: https://apple.github.io/coremltools/docs-guides/source/xcode-model-preview-types.html

Screenshot 2024-07-03 at 11 24 49 AM

Sample code for image segmentation model (from the docs):

```python
# load the model
mlmodel = ct.models.MLModel("SegmentationModel_no_metadata.mlpackage")

labels_json = {"labels": ["background", "aeroplane", "bicycle", "bird", "board", "bottle", "bus", "car", "cat", "chair", "cow", "diningTable", "dog", "horse", "motorbike", "person", "pottedPlant", "sheep", "sofa", "train", "tvOrMonitor"]}

mlmodel.user_defined_metadata["com.apple.coreml.model.preview.type"] = "imageSegmenter"
mlmodel.user_defined_metadata['com.apple.coreml.model.preview.params'] = json.dumps(labels_json)

mlmodel.save("SegmentationModel_with_metadata.mlpackage")
```

Is there a `"com.apple.coreml.model.preview.type"` such as this but for "imageDetector" or "objectDetector"?

---

**Update:** I found a similar post on the Apple Developer forums but it is unanswered: https://forums.developer.apple.com/forums/thread/718154

Will continue to update this post if I find out more.

Contributor guide

Open the contributing guide

Research direction

Start with the Xcode Model Preview Types documentation page and its imageSegmenter metadata example, then check the linked Apple Developer forum discussion. Confirm whether an object-detection preview type and required parameters exist; done means documenting the confirmed metadata or clearly stating that no supported setup is available.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
documentation, machine-learning
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.