我有这个代码:
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))
但它不起作用。
关于如何在管道中从浮点数转换为 Uinteger 的任何想法?
谢谢