Skip to content

(-215:Assertion failed) inputs.size() in function cv::dnn::dnn4_v20191202::Layer::getMemoryShapes #16323

@BadMachine

Description

@BadMachine
System information (version)
  • OpenCV => 4.2.0-pre
  • Operating System / Platform => Windows 10 64 Bit
  • Compiler => Visual Studio 2016
Detailed description

When im trying to load ONNX model im getting error:

F:\OpenCV\opencv-master\modules\dnn\src\dnn.cpp:4479: error: (-215:Assertion failed) inputs.size() in function 'cv::dnn::dnn4_v20191202::Layer::getMemoryShapes'\n" ...}

Model architecture:

HRNet

Model was exported from PyTorch to ONNX with following code:

    model.load_state_dict(torch.load(args.model_file))
    data = torch.zeros((1, 3, 288, 384)).cuda()
    model.eval()
    model.cuda()
    model.float()

    torch.onnx.export(model, data, 'test.onnx')

Model properties and first input layer:

image

About error

Looks like error appears in onnx_importer.cpp at line

        Ptr<Layer> layer = dstNet.getLayer(id);
        layer->getMemoryShapes(layerInpShapes, 0, layerOutShapes, layerInternalShapes);

on layer id = 113

Steps to reproduce:
  1. Upload_model
  2. load in:
auto network = readNetFromONNX("test.onnx");

Metadata

Metadata

Assignees

No one assigned

    Labels

    Hackathonhttps://opencv.org/opencv-hackathon-starts-next-week/category: dnnconfirmedThere is stable reproducer / investigation complete

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions