Skip to content

PT文件转ONNX #13

@YBZ13524

Description

@YBZ13524

对于用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_xratio_ybs:
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进行训练?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions