Skip to content

Input shape mismatch: Input 'input' has shape 1,224,224,3, but input data is of length 519168 #5855

@alzubitariq

Description

@alzubitariq

System information

  • OS version/distro:
  • Windows 10:

Issue

  • What did you do?

  • Converted TensorFlow model to ONNX over this command python -m tf2onnx.convert --saved-model ./checkpoints/yolov4.tf --output model.onnx --opset 11 --verbose and then imported the output file and then i changed the input and output from the sample provided by Microsoft

  • What happened?

  • This is the output

  • Model location: .....assets\Model\nsfw_mobilenet.onnx
    Default parameters: image size=(416,416)
    System.InvalidOperationException: Input shape mismatch: Input 'input' has shape 1,224,224,3, but input data is of length 519168.
    at Microsoft.ML.Transforms.Onnx.OnnxTransformer.Mapper..ctor(OnnxTransformer parent, DataViewSchema inputSchema)
    at Microsoft.ML.Transforms.Onnx.OnnxTransformer.MakeRowMapper(DataViewSchema inputSchema)
    at Microsoft.ML.Data.RowToRowTransformerBase.GetOutputSchema(DataViewSchema inputSchema)
    at Microsoft.ML.Data.TrivialEstimator1.Fit(IDataView input) at Microsoft.ML.Data.EstimatorChain1.Fit(IDataView input)
    at ObjectDetection.OnnxModelScorer.LoadModel(String modelLocation) in Downloads\machinelearning_samples\machinelearning\samples\csharp\getting-started\DeepLearning_ObjectDetection_Onnx\ObjectDetectionConsoleApp\OnnxModelScorer.cs:line 63
    at ObjectDetection.OnnxModelScorer.Score(IDataView data) in Downloads\machinelearning_samples\machinelearning\samples\csharp\getting-started\DeepLearning_ObjectDetection_Onnx\ObjectDetectionConsoleApp\OnnxModelScorer.cs:line 84
    at ObjectDetection.Program.Main() in Downloads\machinelearning_samples\machinelearning\samples\csharp\getting-started\DeepLearning_ObjectDetection_Onnx\ObjectDetectionConsoleApp\Program.cs:line 36
    ========= End of Process..Hit any Key ========

  • What did you expect?

  • it should work

and here is the onnx file
nsfw_mobilenet.zip

Source code / logs

Please paste or attach the code or logs or traces that would be helpful to diagnose the issue you are reporting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    need infoThis issue needs more info before triageonnxExporting ONNX models or loading ONNX models

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions