Skip to content

Unable to find input colum on tensor flow model using C# #4364

@Nightrain

Description

@Nightrain

System information

  • OS version/distro:
    Windows 10
  • .NET Version (eg., dotnet --info):
    .NET Core 3.0

Issue

  • What did you do?
    I created my own TensorFlow object detection model and tried to load it in a C# console application.
  • What happened?
    When I tried to create a model by using pipeline.fit I get this error System.ArgumentOutOfRangeException: ”Could not find input column ‘image_tensor’ (Parameter ‘inputSchema’)
  • What did you expect?
    I would have been able to create the model and continue to create the prediction engine and test my TensorFlow.

Source code / logs

I posted the question on the blog that showed how to load a pretrained TensorFlow model to "Call out @yaeldekel in the issue. She might be able to help here."

Here is what I see in Netron
image

Here is how I am loading the pipeline

var pipeline = context.Transforms
                .LoadImages("input", @"D:\tensorflow1\images",nameof(ImageNetData.ImagePath))              
                .Append(context.Transforms.ExtractPixels(outputColumnName: "input", interleavePixelColors: true))
                .Append(context.Model.LoadTensorFlowModel(@"D:\tensorflow1\models\research\object_detection\inference_graph\PotatoDetector.pb")
              .ScoreTensorFlowModel(outputColumnNames: new[] { "detection_boxes","detection_classes","detection_scores", "num_detections" } },inputColumnNames: new[] { "image_tensor" }, addBatchDimensionInput: true));

When I try to load the model inPython like so it works just fine.

image_tensor = detection_graph.get_tensor_by_name('image_tensor:0')
detection_boxes = detection_graph.get_tensor_by_name('detection_boxes:0')
detection_scores = detection_graph.get_tensor_by_name('detection_scores:0')
detection_classes = detection_graph.get_tensor_by_name('detection_classes:0')
num_detections = detection_graph.get_tensor_by_name('num_detections:0')


image = cv2.imread(PATH_TO_IMAGE)
image_expanded = np.expand_dims(image, axis=0)

print("going to run the model now")

(boxes, scores, classes, num) = sess.run(
    [detection_boxes, detection_scores, detection_classes, num_detections],
    feed_dict={image_tensor: image_expanded})

Any ideas on how to find the input column that ML.NET wants?
Please paste or attach the code or logs or traces that would be helpful to diagnose the issue you are reporting.

Metadata

Metadata

Assignees

Labels

P1Priority of the issue for triage purpose: Needs to be fixed soon.bugSomething isn't workingimageBugs related image datatype tasksloadsaveBugs related loading and saving data or models

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions