You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use YOLOv7 to train a custom network and run it with ONNXRuntime in Java but I receive the following error: ai.onnxruntime.OrtException: This tensor is not representable in Java, it's too big - shape = [0, 7].
When I convert https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7.pt to onnx using the suggested method from the YOLOv7 github page python export.py --weights yolov7-tiny.pt --grid --end2end --simplify --topk-all 100 --iou-thres 0.65 --conf-thres 0.35 --img-size 640 640 --max-wh 640 it works fine. I can also use re-parameterization on https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7_training.pt convert that to onnx and that also works. But when I try using transfer learning on yolov7_training.pt then re-parameterize and convert I receive the error. I have noticed that the working non custom trained versions have a shape of [3, 7]
I have found another issue with the same problem https://github.com/microsoft/onnxruntime/issues/7270 but that appears to be related to not using a square training/inference shape, however I am using a square. Another comment suggested simply changing the '0' value in the shape but I don't know how to do that.
To reproduce
Use the roboflow tutorial to train a custom YOLOv7 network: https://www.youtube.com/watch?v=5nsmXLyDaU4&t=865s&ab_channel=Roboflow (using a public training data set, such as the hard hat one)
meeeee12
changed the title
[Training] Custom trained YOLOv7 network uisng ONNXRuntime in Java
[Training] Custom trained YOLOv7 network using ONNXRuntime in Java
Mar 18, 2023
I must have forgot to fix that error message. Python returns an empty array, but Java computes the size value, sees that it is zero, gets confused and throws an exception. Either way there's no actual output, but the exception is rather unfriendly so I'll deal with it.
)
### Description
Allows the creation of zero length tensors via the buffer path (the
array path with zero length arrays still throws as the validation logic
to check it's not ragged would require more intrusive revision), and
allows the `tensor.getValue()` method to return a Java multidimensional
array with a zero dimension. Also added a test for the creation and
extraction behaviour.
### Motivation and Context
The Python interface can return zero length tensors (e.g. if object
detection doesn't find any objects), and before this PR in Java calling
`tensor.getValue()` throws an exception with a confusing error message.
Fixes#7270 & #15107.
Describe the issue
I am trying to use YOLOv7 to train a custom network and run it with ONNXRuntime in Java but I receive the following error:
ai.onnxruntime.OrtException: This tensor is not representable in Java, it's too big - shape = [0, 7]
.When I convert
https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7.pt
to onnx using the suggested method from the YOLOv7 github pagepython export.py --weights yolov7-tiny.pt --grid --end2end --simplify --topk-all 100 --iou-thres 0.65 --conf-thres 0.35 --img-size 640 640 --max-wh 640
it works fine. I can also use re-parameterization onhttps://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7_training.pt
convert that to onnx and that also works. But when I try using transfer learning onyolov7_training.pt
then re-parameterize and convert I receive the error. I have noticed that the working non custom trained versions have a shape of[3, 7]
I have found another issue with the same problem
https://github.com/microsoft/onnxruntime/issues/7270
but that appears to be related to not using a square training/inference shape, however I am using a square. Another comment suggested simply changing the '0' value in the shape but I don't know how to do that.To reproduce
https://www.youtube.com/watch?v=5nsmXLyDaU4&t=865s&ab_channel=Roboflow
(using a public training data set, such as the hard hat one)python export.py --weights yolov7.pt --grid --end2end --simplify --topk-all 100 --iou-thres 0.65 --conf-thres 0.35 --img-size 640 640 --max-wh 640
Urgency
No response
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
1.13.1
PyTorch Version
Execution Provider
Default CPU
Execution Provider Library Version
No response
The text was updated successfully, but these errors were encountered: