ValidationError: Your model ir_version is higher than the checker's


模型轉換為onnx

import torch
import torchvision
dummy_input = torch.randn(10, 3, 224, 224, device="cuda")
model = torchvision.models.alexnet(pretrained=True).cuda()
input_names = ["actual_input_1"] + ["learned_%d" % i for i in range(16)]
output_names = ["output1"]

torch.onnx.export(model, dummy_input, "alexnet.onnx",
                  verbose=True, input_names=input_names, output_names=output_names)

轉換成功之后會在當前目錄生成onnx文件:alexnet.onnx
模型驗證

import onnx
model = onnx.load("alexnet.onnx")
onnx.checker.check_model(model)
onnx.helper.printable_graph(model.graph)

報錯:ValidationError: Your model ir_version is higher than the checker's
原因:版本不匹配
原來用的onnx=1.4.1 需要升級一下onnx

pip install --upgrade onnx
RuntimeError: CUDA error: device-side assert triggered

報錯:

lambda [](int)->auto::operator()(int)->auto: block: [0,0,0], thread: [32,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.

原因:標簽越界,我的配置文件是單類目標檢測,使用COCO數據集的時候有80個目標類別,因而導致標簽越界。修改配置文件可以解決


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM