dotnet / dotnet/machinelearning-samples
Dealing with Semantic Segmentation
- Dominant language
- PowerShell
- Stars
- 4.7k
- Forks
- 2.7k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 1
Description
**I loaded a "deeplabv3_mnv2_dm05_pascal_trainaug" model from TensorFlow Model Zoo, which is a .pb file. I've met these problems:**
**1. As far as I can see, the input image and the output image of deeplabv3 should both be an unknown-size image. Does ML.NET support unknow-size input and output? I tried but failed. So I have to add a "ResizeImages" before "ExtractPixels". Below is my pipeline code:**
`var pipeline =mlContext.Transforms.LoadImages(outputColumnName:"imageinput", ImagesFolderPath,nameof(ImageData.ImagePath))
.Append(mlContext.Transforms.ResizeImages(outputColumnName: "imageinput", inputColumnName: "imageinput",imageHeight:ImageProperty.ImageHeight,imageWidth:ImageProperty.ImageWidth))
.Append(mlContext.Transforms.ExtractPixels(outputColumnName: "ImageTensor", inputColumnName: "imageinput",outputAsFloatArray:false))
.Append(mlContext.Transforms.LoadImages(outputColumnName: "annotinput", ImagesFolderPath, nameof(ImageData.AnnotPath)))
.Append(mlContext.Transforms.ResizeImages(outputColumnName: "annotinput", inputColumnName: "annotinput", imageHeight:ImageProperty.ImageHeight,imageWidth:ImageProperty.ImageWidth))
.Append(mlContext.Transforms.ExtractPixels(outputColumnName: "SemanticPredictions", inputColumnName: "annotinput", outputAsFloatArray: false))
.Append(tensorFlowModel.ScoreTensorFlowModel( outputColumnNames:
new[] { "SemanticPredictions" },inputColumnNames: new[] { "ImageTensor" }, addBatchDimensionInput: true));`
2. **I got this error message while predicting:**
The first dimension of paddings must be the rank of inputs[3,2] [1,513,513,3] [[{{node Pad}}]]”
**And here is my prediction class:**
` class SemanticPredictions
{
[ColumnName(nameof(SemanticPredictions))]
[VectorType(513,513)]
public Int64[] Output { get; set; }
}`
I really need your help.
Best Regards!
Contributor guide
Assessment
This issue has not been assessed yet.