PT文件转ONNX
- Dominant language
- Python
- Stars
- 140
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Description
对于用yolov5m/yolov5s作为预训练模型训练之后得到的模型,models/export.py运行后无法得不到onnx模型,运行文件后会出现报错:
D:\esod-main\models\common.py:328: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
assert c == self.c, f'{c} - {self.c}'
D:\esod-main\models\common.py:331: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if torch.max(mask_pred) > 1. or torch.min(mask_pred) < 0.:
D:\esod-main\utils\general.py:304: TracerWarning: Converting a tensor to a Python float might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
return math.ceil(x / divisor) * divisor
D:\esod-main\models\common.py:469: TracerWarning: Converting a tensor to a Python float might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
ratio_x, ratio_y = int(math.ceil(width / cluster_w)), int(math.ceil(height / cluster_h))
D:\esod-main\models\common.py:473: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if getattr(self, 'grid_vtx', None) is None or self.grid_vtx.size(0) != ratio_x*ratio_y*bs:
C:\Users\0\AppData\Roaming\Python\Python39\site-packages\torch\tensor.py:587: RuntimeWarning: Iterating over a tensor might cause the trace to be incorrect. Passing a tensor of different shape won't change the number of iterations executed (and might lead to errors or silently give incorrect results).
warnings.warn('Iterating over a tensor might cause the trace to be incorrect. '
D:\esod-main\models\common.py:480: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if getattr(self, 'grid', None) is None or self.grid[0].shape[-1] != cluster_h*cluster_w:
D:\esod-main\models\common.py:489: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if (~obj_centers).all():
ONNX: export failure: Only tuples, lists and Variables are supported as JIT inputs/outputs. Dictionaries and strings are also accepted, but their usage is not recommended. Here, received an input of unsupported type: NoneType
有什么方法能够解决这个问题?
以及论文中提及能够使用yolov8作为预训练权重进行训练,但是直接使用yolov8的预训练权重是不可行的,该如何操作才能使用yolov8进行训练?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with models/export.py and reproduce the reported export command using a yolov5m or yolov5s-trained model. Read the referenced paths in models/common.py and utils/general.py to trace the NoneType ONNX failure; done means producing a usable ONNX model. The separate yolov8 pretraining question needs its compatibility and training workflow investigated independently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- computer-vision, machine-learning
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100