-
-
Notifications
You must be signed in to change notification settings - Fork 16.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CoreML export failure: unexpected number of inputs for node x.2 (_convolution): 13 #1667
Comments
Hello @gchihiha, thank you for your interest in 🚀 YOLOv5! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution. If this is a 🐛 Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you. If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available. For business inquiries or professional support requests please visit https://www.ultralytics.com or email Glenn Jocher at [email protected]. RequirementsPython 3.8 or later with all requirements.txt dependencies installed, including $ pip install -r requirements.txt EnvironmentsYOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
StatusIf this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), testing (test.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit. |
see Python : 3.8.6 pip install -r requirements.txt train command: convert to onnx command: result: |
Any updates on this? I am facing a similar error. |
Same issue, Any update please |
python -V yolov5-3.1 pip list absl-py 0.11.0 |
@glenn-jocher can you provide some insights? |
@MaddyThakker may be caused by more recent versions of torch, might try 1.6.0. |
@glenn-jocher it works with torch 1.6.0. Thanks! |
torch 1.60 okpip uninstall torch Installing collected packages: future, torch, torchvision
|
I alse meet this issue and i could not find torch==1.6.0, what should i do |
try this |
I have tried to export a yolov3 model as a coreml model. I also get this error. I have tried installing each of the versions of pytorch and torchvision suggested in the comments. None of them have worked. Specifically, I get the error
|
In the yolov3 model, all the activations that throw this error are leaky relus, which export just fine. So I wrapped this conversion in a try except, and simply don't convert it if it throws an exception. It successfully exported the model. |
@jbrownkramer could you please share your code of try except. I tried myself but I keep getting the same error. |
@kir486680 Yes. So first, I want to make it clear that I first did
That eliminated the error
to
Note also that I am exporting a YOLOv3 model, which doesn't have any Hardswish or SiLU activations to convert, so simply skipping the conversion isn't a problem for me. |
@jbrownkramer Thank you! It worked. However, my converted model has 3 different outputs |
@kir486680. Each output tensor corresponds to outputs at a particular scale. So you decode each one individually and then apply non-max suppression on all of the resulting boxes. For a particular output tensor, I believe the indices are (batch,anchor box, grid_y, grid_x, elements of encoded box). This link might help https://towardsdatascience.com/yolo-v3-object-detection-53fb7d3bfe6b#:~:text=YOLO%20v2%20used%20a%20custom,the%20layers%20downsampled%20the%20input. |
Head branch from coremltool repo which is compatible with PyTorch 1.7 pip install -Uqq git+https://github.com/apple/coremltools.git@master |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
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:
git fetch && git status -uno
to check andgit pull
to update repoIf this is a custom dataset/training question you must include your
train*.jpg
,test*.jpg
andresults.png
figures, or we can not help you. You can generate these withutils.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:
Environment
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!
The text was updated successfully, but these errors were encountered: