Errors running a model with image input and grayscale image output
passing the same shapes in (but using numpy array as runtime input) e.g. passing a (1, 3, 512, 512) image in and expecting a (1, 1, 512, 512) grayscale image out.
II tried both mlprogram and neuralnetwork when compiling MODNet but keep getting these errors
Stack Trace
/usr/local/lib/python3.11/site-packages/coremltools/models/model.py:154: RuntimeWarning: You will not be able to run predict() on this Core ML model. Underlying exception message was: Error compiling model: "compiler error: Encountered an error while compiling a neural network model: validator error: Model image output 'pred_matte' has a different shape than its corresponding return value to main.".
_warnings.warn(
Traceback (most recent call last):
File "/Users/leepenkman/code/MODNet/onnx/inference_coreml.py", line 102, in
result = model.predict({"img": im})
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/coremltools/models/model.py", line 632, in predict
raise self._framework_error
File "/usr/local/lib/python3.11/site-packages/coremltools/models/model.py", line 152, in _get_proxy_and_spec
return _MLModelProxy(filename, compute_units.name), specification, None
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Error compiling model: "compiler error: Encountered an error while compiling a neural network model: validator error: Model image output 'pred_matte' has a different shape than its corresponding return value to main.".
Paste Python code snippet here, complete with any required import statements.
model conversion succeeded but then when i go to do inference on the model i get these errors.
## System environment (please complete the following information):
- coremltools version:
- OS (e.g. MacOS version or Linux type): happening on MacOS/latest pytorch/coremltools
- Any other relevant version information (e.g. PyTorch or TensorFlow version):
any pointers would be really appreciated
🐞Describing the bug
II tried both mlprogram and neuralnetwork when compiling MODNet but keep getting these errors
Stack Trace
/usr/local/lib/python3.11/site-packages/coremltools/models/model.py:154: RuntimeWarning: You will not be able to run predict() on this Core ML model. Underlying exception message was: Error compiling model: "compiler error: Encountered an error while compiling a neural network model: validator error: Model image output 'pred_matte' has a different shape than its corresponding return value to main.". _warnings.warn( Traceback (most recent call last): File "/Users/leepenkman/code/MODNet/onnx/inference_coreml.py", line 102, in
result = model.predict({"img": im})
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/coremltools/models/model.py", line 632, in predict
raise self._framework_error
File "/usr/local/lib/python3.11/site-packages/coremltools/models/model.py", line 152, in _get_proxy_and_spec
return _MLModelProxy(filename, compute_units.name), specification, None
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Error compiling model: "compiler error: Encountered an error while compiling a neural network model: validator error: Model image output 'pred_matte' has a different shape than its corresponding return value to main.".
Paste Python code snippet here, complete with any required import statements.