Comments (4)
This issue is essentially the question "how do we interpret shapes". In this permute case, Keras wants to permute a shape from (10,64,3)
to (3,64,10)
; but because Keras uses (height, width, channels)
for image feature axis while CoreML uses (channels, height, width)
, there are two ways to interpret what Permute
in Keras is really doing:
(1) It wants the output tensor to be an image feature map with height=3, width=64, channels=10
. In this case, the converter should respect the meaning of the axes, so the output shape should be (10,3,64)
.
(2) It wants the output tensor to be exactly of shape (3,64,10)
with no meaning on the axes. In this case, the converter should respect the data layout in memory, so the output shape should be (3,64,10)
, same as Keras.
At this point the converter chooses to use (1) where the meaning of axes are respected, simply because if a Keras model has convolutions following Permute
or Reshape
, the converted CoreML model has the correct (C,H,W)
axes to do the convolution.
from coremltools.
Is there a workaround for this problem? I believe it is causing issues with Conv1D layers. See https://stackoverflow.com/questions/47557591/incorrect-input-shape-in-coreml-after-converting-keras-model and https://stackoverflow.com/questions/49047418/keras-conv1d-to-coreml-not-behaving-as-expected
from coremltools.
me too
from coremltools.
Multi-backend Keras support has been removed in coremltools 6.0.
from coremltools.
Related Issues (20)
- ML Program matmul not handling 1D input correctly HOT 2
- unet Chunking not supported in coremltools>7.1 and <7.1 does not support dynamic reshape HOT 1
- `coremltools` docs - Xcode Model Preview Type for Object Detection? HOT 1
- How to set 4 bit quantization in PostTrainingQuantizer? HOT 5
- ERROR - converting 'full' op (located at: 'heads') HOT 2
- Can't perform palettization:Unique values in weight cannot be represented by 8 bits palettization. HOT 3
- Error on mixing shapes of multiple enumerated shape inputs HOT 2
- Torch state buffer `copy_` fails to convert
- Beta macOS 15.x.x doesn't meet minimum deployment HOT 1
- view + transpose breaks model state? HOT 3
- Crash while converting models with torch.nn.BatchNorm3d layers HOT 2
- Model state doesn't work with transpose HOT 2
- AttributeError: 'Sequential' object has no attribute '_get_save_spec'. Did you mean: '_set_save_spec'? HOT 2
- CoreML maps tensorflow's pad op's symmetric mode to reflect mode.
- ConvTranspose with output_shape has completely different output for CPU only vs ALL HOT 1
- is Conv3d supported? in torch? how do i interpret and resolve this HOT 1
- Unable to parse ML Program: at unknown location: Unknown opset 'CoreML8'. HOT 1
- torch.nn.functional.grid_sample for volumetric input/ Rank 5 input and grid HOT 3
- ERROR - converting '_internal_op_tensor_inplace_copy_' op
- Update support for sklearn > 1.1.2 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coremltools.