Tencent/ncnn

rtdetr-l转ncnn

Opened this issue · 1 comments

error log | 日志或报错信息 | ログ

model | 模型 | モデル

  1. rtdetr-l model 下载路径: https://github.com/ultralytics/assets/releases/download/v8.2.0/rtdetr-l.pt

how to reproduce | 复现步骤 | 再現方法

1.rtdetr-l.pt
2.训练后产生:best.pt
3.直接导出ncnn

PyTorch: starting from 'best.pt' with input shape (1, 3, 640, 640) BCHW and output shape(s) (1, 300, 5) (63.1 MB)

TorchScript: starting export with torch 2.4.0+cu121...
TorchScript: export success ✅ 12.9s, saved as 'best.torchscript' (122.8 MB)

NCNN: starting export with NCNN 1.0.20240410...
NCNN: running '/usr/local/lib/python3.9/site-packages/ultralytics/pnnx best.torchscript ncnnparam=best_ncnn_model/model.ncnn.param ncnnbin=best_ncnn_model/model.ncnn.bin ncnnpy=best_ncnn_model/model_ncnn.py pnnxparam=best_ncnn_model/model.pnnx.param pnnxbin=best_ncnn_model/model.pnnx.bin pnnxpy=best_ncnn_model/model_pnnx.py pnnxonnx=best_ncnn_model/model.pnnx.onnx fp16=0 device=cpu inputshape="[1, 3, 640, 640]"'
pnnxparam = best_ncnn_model/model.pnnx.param
pnnxbin = best_ncnn_model/model.pnnx.bin
pnnxpy = best_ncnn_model/model_pnnx.py
pnnxonnx = best_ncnn_model/model.pnnx.onnx
ncnnparam = best_ncnn_model/model.ncnn.param
ncnnbin = best_ncnn_model/model.ncnn.bin
ncnnpy = best_ncnn_model/model_ncnn.py
fp16 = 0
optlevel = 2
device = cpu
inputshape = [1,3,640,640]f32
inputshape2 =
customop =
moduleop =
############# pass_level0
inline module = torch.nn.modules.linear.Identity
inline module = ultralytics.nn.modules.block.HGBlock
inline module = ultralytics.nn.modules.block.HGStem
inline module = ultralytics.nn.modules.block.RepC3
inline module = ultralytics.nn.modules.conv.Concat
inline module = ultralytics.nn.modules.conv.Conv
inline module = ultralytics.nn.modules.conv.DWConv
inline module = ultralytics.nn.modules.conv.LightConv
inline module = ultralytics.nn.modules.conv.RepConv
inline module = ultralytics.nn.modules.head.RTDETRDecoder
inline module = ultralytics.nn.modules.transformer.AIFI
inline module = ultralytics.nn.modules.transformer.DeformableTransformerDecoder
inline module = ultralytics.nn.modules.transformer.DeformableTransformerDecoderLayer
inline module = ultralytics.nn.modules.transformer.MLP
inline module = ultralytics.nn.modules.transformer.MSDeformAttn
inline module = torch.nn.modules.linear.Identity
inline module = ultralytics.nn.modules.block.HGBlock
inline module = ultralytics.nn.modules.block.HGStem
inline module = ultralytics.nn.modules.block.RepC3
inline module = ultralytics.nn.modules.conv.Concat
inline module = ultralytics.nn.modules.conv.Conv
inline module = ultralytics.nn.modules.conv.DWConv
inline module = ultralytics.nn.modules.conv.LightConv
inline module = ultralytics.nn.modules.conv.RepConv
inline module = ultralytics.nn.modules.head.RTDETRDecoder
inline module = ultralytics.nn.modules.transformer.AIFI
inline module = ultralytics.nn.modules.transformer.DeformableTransformerDecoder
inline module = ultralytics.nn.modules.transformer.DeformableTransformerDecoderLayer
inline module = ultralytics.nn.modules.transformer.MLP
inline module = ultralytics.nn.modules.transformer.MSDeformAttn

inline module = torch.nn.modules.linear.Identity
inline module = ultralytics.nn.modules.block.HGBlock
inline module = ultralytics.nn.modules.block.HGStem
inline module = ultralytics.nn.modules.block.RepC3
inline module = ultralytics.nn.modules.conv.Concat
inline module = ultralytics.nn.modules.conv.Conv
inline module = ultralytics.nn.modules.conv.DWConv
inline module = ultralytics.nn.modules.conv.LightConv
inline module = ultralytics.nn.modules.conv.RepConv
inline module = ultralytics.nn.modules.head.RTDETRDecoder
inline module = ultralytics.nn.modules.transformer.AIFI
inline module = ultralytics.nn.modules.transformer.DeformableTransformerDecoder
inline module = ultralytics.nn.modules.transformer.DeformableTransformerDecoderLayer
inline module = ultralytics.nn.modules.transformer.MLP
inline module = ultralytics.nn.modules.transformer.MSDeformAttn

############# pass_level1
############# pass_level2
############# pass_level3
############# pass_level4
############# pass_level5
############# pass_ncnn
force batch axis 233 for operand 240
force batch axis 233 for operand 241
binaryop tensor0 with rank 6 is not supported yet!
binaryop tensor1 with rank 6 is not supported yet!
binaryop tensor0 with rank 6 is not supported yet!
binaryop tensor1 with rank 6 is not supported yet!
binaryop tensor0 with rank 6 is not supported yet!
binaryop tensor1 with rank 6 is not supported yet!
binaryop tensor0 with rank 6 is not supported yet!
binaryop tensor1 with rank 6 is not supported yet!
binaryop tensor0 with rank 6 is not supported yet!
binaryop tensor1 with rank 6 is not supported yet!
binaryop tensor0 with rank 6 is not supported yet!
binaryop tensor1 with rank 6 is not supported yet!
binaryop tensor0 with rank 6 is not supported yet!
binaryop tensor1 with rank 6 is not supported yet!
binaryop tensor0 with rank 6 is not supported yet!
binaryop tensor1 with rank 6 is not supported yet!
binaryop tensor0 with rank 6 is not supported yet!
binaryop tensor1 with rank 6 is not supported yet!
binaryop tensor0 with rank 6 is not supported yet!
binaryop tensor1 with rank 6 is not supported yet!
binaryop tensor0 with rank 6 is not supported yet!
binaryop tensor1 with rank 6 is not supported yet!
binaryop tensor0 with rank 6 is not supported yet!
binaryop tensor1 with rank 6 is not supported yet!
munmap_chunk(): invalid pointer
NCNN: export failure ❌ 39.0s: Command '['/usr/local/lib/python3.9/site-packages/ultralytics/pnnx', 'best.torchscript', 'ncnnparam=best_ncnn_model/model.ncnn.param', 'ncnnbin=best_ncnn_model/model.ncnn.bin', 'ncnnpy=best_ncnn_model/model_ncnn.py', 'pnnxparam=best_ncnn_model/model.pnnx.param', 'pnnxbin=best_ncnn_model/model.pnnx.bin', 'pnnxpy=best_ncnn_model/model_pnnx.py', 'pnnxonnx=best_ncnn_model/model.pnnx.onnx', 'fp16=0', 'device=cpu', 'inputshape="[1, 3, 640, 640]"']' died with <Signals.SIGABRT: 6>.
Traceback (most recent call last):
File "/data/train_table/DETR/table/train2/weights/convert.py", line 8, in
model.export(format="ncnn")
File "/usr/local/lib/python3.9/site-packages/ultralytics/engine/model.py", line 591, in export
return Exporter(overrides=args, _callbacks=self.callbacks)(model=self.model)
File "/usr/local/lib/python3.9/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/ultralytics/engine/exporter.py", line 325, in call
f[11], _ = self.export_ncnn()
File "/usr/local/lib/python3.9/site-packages/ultralytics/engine/exporter.py", line 142, in outer_func
raise e
File "/usr/local/lib/python3.9/site-packages/ultralytics/engine/exporter.py", line 137, in outer_func
f, model = inner_func(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/ultralytics/engine/exporter.py", line 594, in export_ncnn
subprocess.run(cmd, check=True)
File "/usr/local/lib/python3.9/subprocess.py", line 524, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/local/lib/python3.9/site-packages/ultralytics/pnnx', 'best.torchscript', 'ncnnparam=best_ncnn_model/model.ncnn.param', 'ncnnbin=best_ncnn_model/model.ncnn.bin', 'ncnnpy=best_ncnn_model/model_ncnn.py', 'pnnxparam=best_ncnn_model/model.pnnx.param', 'pnnxbin=best_ncnn_model/model.pnnx.bin', 'pnnxpy=best_ncnn_model/model_pnnx.py', 'pnnxonnx=best_ncnn_model/model.pnnx.onnx', 'fp16=0', 'device=cpu', 'inputshape="[1, 3, 640, 640]"']' died with <Signals.SIGABRT: 6>.

Following