Skip to content

CoreML export failure: unexpected number of inputs for node x.2 (_convolution): 13 #1667

@gchihiha

Description

@gchihiha

Before submitting a bug report, please be aware that your issue must be reproducible with all of the following, otherwise it is non-actionable, and we can not help you:

If this is a custom dataset/training question you must include your train*.jpg, test*.jpg and results.png figures, or we can not help you. You can generate these with utils.plot_results().

🐛 Bug

A clear and concise description of what the bug is.

To Reproduce (REQUIRED)

Input:
python ./models/export.py --weights ../init/yolov5s.pt --img 640 --batch 1
Output:


Namespace(batch_size=1, img_size=[640, 640], weights='../init/yolov5s.pt')
Fusing layers...
Model Summary: 140 layers, 7.45958e+06 parameters, 0 gradients

Starting TorchScript export with torch 1.7.0...
D:\ProgramData\Anaconda3\lib\site-packages\torch\jit\_trace.py:940: TracerWarning: Encountering a list at the output of the tracer might cause the trace to be incorrect, this is only valid if the container structure does not change based on the module's inputs. Consider using a constant container instead (e.g. for `list`, use a `tuple` instead. for `dict`, use a `NamedTuple` instead). If you absolutely need this and know the side effects, pass strict=False to trace() to allow this behavior.
  _force_outplace,
TorchScript export success, saved as ../init/yolov5s.torchscript.pt

Starting ONNX export with onnx 1.8.0...
ONNX export success, saved as ../init/yolov5s.onnx

Starting CoreML export with coremltools 4.0...
Tuple detected at graph output. This will be flattened in the converted model.
Converting graph.
Adding op '1' of type const
....
Converting op x.2 : _convolution
Converting Frontend ==> MIL Ops:   2%|█                                            | 23/932 [00:00<00:00, 962.15 ops/s]
CoreML export failure: unexpected number of inputs for node x.2 (_convolution): 13
Export complete (6.27s). Visualize with https://github.com/lutzroeder/netron.

Environment

  • OS: [windows10]
  • GPU [nvidia gtx1060]

Additional context

git clone https://github.com/ultralytics/yolov5.git

python train.py --img 640 --batch 8 --epochs 300 --data ./test_train_datas/data.yaml --cfg models/yolov5s.yaml
train done
get bast.pt

python ./models/export.py --weights ./best.pt --img-size 640 640
python ./models/export.py --weights ../best.pt --img 640 --batch 1
python ./models/export.py --weights ../yolov5s.pt --img 640 --batch 1

all is :
CoreML export failure: unexpected number of inputs for node x.2 (_convolution): 13

help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    StaleStale and schedule for closing soonbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions