apple / apple/coremltools

rename_feature does not update input preprocessing name

Open
#163 3 comments 2 reactions 0 assignees View on GitHub
bug NN backend only triaged
Dominant language
Python
Stars
5.4k
Forks
850
Avg merge
4d 5h
Merged PRs (30d)
10

Description

If I have a spec that includes preprocessing information in `spec.neuralNetwork.preprocessing`, this is not updated when calling `coremltools.models.utils.rename_feature` on an input feature.

Here's an example:
```python
>>> spec.description.input
[name: "1"
type {
imageType {
width: 256
height: 256
colorSpace: GRAYSCALE
}
}
]
>>> coremltools.models.utils.rename_feature(spec, '1', 'image')
>>> spec.description.input
[name: "image"
type {
imageType {
width: 256
height: 256
colorSpace: GRAYSCALE
}
}
]
>>> spec.neuralNetwork.preprocessing
[featureName: "1" # <-- should be "image"
scaler {
channelScale: 1.0
}
]
```

Contributor guide

Open the contributing guide

Research direction

Start at coremltools.models.utils.rename_feature and inspect how it updates spec.description.input versus spec.neuralNetwork.preprocessing. Reproduce the example with the preprocessing feature named "1"; done means preprocessing.featureName is also changed to "image" after the rename.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.