我有此代码:
Dim pipeline = ImageEstimatorsCatalog.LoadImages(mlContext.Transforms,
imagesFolder, ("ImagePath", "ImageReal")).
Append(ImageEstimatorsCatalog.Resize(mlContext.Transforms, "ImageReal", "ImageReal", ImageNetSettings.imageHeight, ImageNetSettings.imageWidth, resizing:=ImageResizerTransform.ResizingKind.IsoPad)).
Append(ImageEstimatorsCatalog.ExtractPixels(mlContext.Transforms, {New ImagePixelExtractorTransform.ColumnInfo("ImageReal", "image_tensor",
colors:=ImagePixelExtractorTransform.ColorBits.Rgb, interleave:=ImageNetSettings.channelsLast,
offset:=ImageNetSettings.mean, scale:=ImageNetSettings.scale)})).
Append(New TensorFlowEstimator(mlContext, modelLocation, {"image_tensor"}, {"detection_scores", "detection_boxes", "detection_classes", "num_detections"}))
Dim modeld = pipeline.Fit(data)
编译时出现以下错误:
Schema mismatch for input column 'image_tensor': expected U1, got R4
Parameter name: inputSchema
因为我使用的模型的输入节点是Uinteger,并且由ImageEstimatorsCatalog.ExtractPixels生成的默认矢量Image是浮点数。
我尝试使用以下方法进行转换:
Append(ConversionsExtensionsCatalog.ConvertType(mlContext.Transforms.Conversion,
"image_tensor", "image_tensor", DataKind.U1))
但这不起作用。
关于如何在管道中从float转换为Uinteger的任何想法?
谢谢