Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/Sdcb.PaddleDetection/PaddleDetector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ public DetectionResult[] Run(Mat src)
if (isRbox)
{
int classId = (int)MathUtil.Round(outputData[0 + j * 10]);
if (classId > Config.LabelList.Length - 1)
{
continue;
}
float score = outputData[1 + j * 10];
int x1 = (int)(outputData[2 + j * 10] * r.Width);
int y1 = (int)(outputData[3 + j * 10] * r.Height);
Expand All @@ -186,6 +190,10 @@ public DetectionResult[] Run(Mat src)
else
{
int classId = (int)MathUtil.Round(outputData[0 + j * 6]);
if (classId > Config.LabelList.Length - 1)
{
continue;
}
float score = outputData[1 + j * 6];
int xmin = (int)(outputData[2 + j * 6] * r.Width);
int ymin = (int)(outputData[3 + j * 6] * r.Height);
Expand All @@ -194,6 +202,7 @@ public DetectionResult[] Run(Mat src)
result[j] = new DetectionResult(new[] { xmin, ymin, xmax, ymax }, classId, Config.LabelList[classId], score);
}
}
result = result.Where(r => r != null).ToArray();
return result;
}
}
Expand Down Expand Up @@ -406,4 +415,4 @@ static IEnumerable<Scalar> GenerateColorMapToScalar()
}
}
}
}
}